2005-05-03 Dan Williams <dcbw@redhat.com>

* Kill dhcpcd.  We now use "dhcdbd", a dbus daemon that controls dhclient.
	  This means that NetworkManager shouldn't have DHCP issues anymore.  It also
	  means you need dhcdbd, which you can get here (get the latest one):

		http://people.redhat.com/jvdias/dhcdbd/

	  Technically NetworkManager can use any DHCP daemon that uses the same DBUS
	  interface as dhcdbd.

	* Rewrite device activation to facilitate the new DHCP infrastructure and
	  future improvements.  Its now "activation request" based, ie there is a single
	  activation request composed of the device, access point, and other info which
	  follows the entire activation process.  There are 5 stages of the activation
	  process which correspond to:

		1) Device preparation
		2) Device configuration (bring it up, set ESSID/Key/etc)
		3) IP Config Start (fire off DHCP if we're using it)
		4) IP Config Get (grab config from DHCP or static config files)
		5) IP Config Commit (set device's IP address, DNS, etc)

	  Note that there is no longer a "scanning" step, since the access point must
	  be known _before_ activation starts.  If the access point drops out or does
	  not exist for some reason, the entire activation process fails and must be
	  restarted for a different access point or device.

	Patch from Bill Moss:
	* gnome/applet/applet.c
		- Fix type of vpn_failure dialog -> vpn_banner dialog


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2005-05-03 20:41:36 +00:00
parent 4ef3e67fc1
commit 567b5e3d31
66 changed files with 3204 additions and 7588 deletions

216
src/nm-activation-request.c Normal file
View File

@@ -0,0 +1,216 @@
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2005 Red Hat, Inc.
*/
#include <glib.h>
#include <string.h>
#include "nm-activation-request.h"
#include "NetworkManagerDevice.h"
#include "nm-dhcp-manager.h"
#include "nm-utils.h"
struct NMActRequest
{
int refcount;
NMData * data;
NMDevice * dev;
NMAccessPoint * ap;
NMIP4Config * ip4_config;
gboolean user_requested;
NMActStage stage;
DBusPendingCall * user_key_pcall;
guint8 dhcp_state;
guint dhcp_timeout;
};
NMActRequest * nm_act_request_new (NMData *data, NMDevice *dev, NMAccessPoint *ap, gboolean user_requested)
{
NMActRequest * req;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (dev != NULL, NULL);
if (nm_device_is_wireless (dev))
g_return_val_if_fail (ap != NULL, NULL);
req = g_malloc0 (sizeof (NMActRequest));
req->refcount = 1;
req->data = data;
nm_device_ref (dev);
req->dev = dev;
if (ap)
nm_ap_ref (ap);
req->ap = ap;
req->user_requested = user_requested;
req->dhcp_state = nm_dhcp_manager_get_state_for_device (data->dhcp_manager, dev);
return req;
}
void nm_act_request_ref (NMActRequest *req)
{
g_return_if_fail (req != NULL);
req->refcount++;
}
void nm_act_request_unref (NMActRequest *req)
{
g_return_if_fail (req != NULL);
if (req->refcount == 1)
{
nm_device_unref (req->dev);
if (req->ap)
nm_ap_unref (req->ap);
if (req->dhcp_timeout > 0)
{
GSource * source = g_main_context_find_source_by_id (req->data->main_context, req->dhcp_timeout);
g_source_destroy (source);
}
memset (req, 0, sizeof (NMActRequest));
}
else
req->refcount--;
}
NMDevice * nm_act_request_get_dev (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, NULL);
return req->dev;
}
NMData * nm_act_request_get_data (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, NULL);
return req->data;
}
NMAccessPoint * nm_act_request_get_ap (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, NULL);
return req->ap;
}
gboolean nm_act_request_get_user_requested (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, FALSE);
return req->user_requested;
}
NMIP4Config * nm_act_request_get_ip4_config (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, NULL);
return req->ip4_config;
}
void nm_act_request_set_ip4_config (NMActRequest *req, NMIP4Config *ip4_config)
{
g_return_if_fail (req != NULL);
if (req->ip4_config)
{
nm_ip4_config_unref (req->ip4_config);
req->ip4_config = NULL;
}
if (ip4_config)
{
nm_ip4_config_ref (ip4_config);
req->ip4_config = ip4_config;
}
}
NMActStage nm_act_request_get_stage (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, ACT_STAGE_UNKNOWN);
return req->stage;
}
void nm_act_request_set_stage (NMActRequest *req, NMActStage stage)
{
g_return_if_fail (req != NULL);
req->stage = stage;
}
DBusPendingCall * nm_act_request_get_user_key_pending_call (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, NULL);
return req->user_key_pcall;
}
void nm_act_request_set_user_key_pending_call (NMActRequest *req, DBusPendingCall *pcall)
{
g_return_if_fail (req != NULL);
req->user_key_pcall = pcall;
}
guint8 nm_act_request_get_dhcp_state (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, 0);
return req->dhcp_state;
}
void nm_act_request_set_dhcp_state (NMActRequest *req, guint8 dhcp_state)
{
g_return_if_fail (req != NULL);
req->dhcp_state = dhcp_state;
}
guint nm_act_request_get_dhcp_timeout (NMActRequest *req)
{
g_return_val_if_fail (req != NULL, 0);
return req->dhcp_timeout;
}
void nm_act_request_set_dhcp_timeout (NMActRequest *req, guint dhcp_timeout)
{
g_return_if_fail (req != NULL);
req->dhcp_timeout = dhcp_timeout;
}