NetworkManager/src/NetworkManagerDevicePrivate.h
Dan Williams 88a56d5435 2005-05-05 Dan Williams <dcbw@redhat.com>
Suggestion from Bill Moss:
	* src/NetworkManagerSystem.c
		- (nm_system_device_set_up_down_with_iface): ignore ENODEV


	* src/NetworkManager.c
		- (nm_data_free): move destruction of the various managers after
			release of device list, because deactivating and freeing a device
			requires at least the named manager
		- (nm_poll_and_update_wireless_link_state):
		  (nm_device_link_activated):
		  (nm_device_link_deactivated):
			don't grab the device list lock when actually updating device
			link status or strength, since nm_device_set_link_active()
			needs to call nm_get_active_device(), which also locks the device list.

	* src/NetworkManagerDevice.c
		- (nm_device_set_link_active): if a device's link switches from off->on,
			and it's wired, and the active device is wireless (or there is no
			active device), activate the new device whose link just came on
		- (link_to_specific_ap): try to smooth over intermittency in wireless links
			my only calling the link to the current ap "failed" when more than 2
			consecutive link checks have failed


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@606 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-05 16:52:04 +00:00

109 lines
2.7 KiB
C

/* 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 <errno.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
#include <libhal.h>
#include <iwlib.h>
#include <signal.h>
#include <string.h>
#include "NetworkManager.h"
#include "NetworkManagerMain.h"
#include "NetworkManagerDevice.h"
#include "NetworkManagerAPList.h"
/* Wireless device specific options */
typedef struct NMDeviceWirelessOptions
{
char * cur_essid; /* Mainly for test devices */
gboolean supports_wireless_scan;
gint8 strength;
gint8 invalid_strength_counter;
iwqual max_qual;
iwqual avg_qual;
guint failed_link_count;
gint8 num_freqs;
double freqs[IW_MAX_FREQUENCIES];
GMutex * scan_mutex;
NMAccessPointList * ap_list;
guint8 scan_interval; /* seconds */
guint32 last_scan;
} NMDeviceWirelessOptions;
/* Wired device specific options */
typedef struct NMDeviceWiredOptions
{
gboolean has_carrier_detect;
} NMDeviceWiredOptions;
/* General options structure */
typedef union NMDeviceOptions
{
NMDeviceWirelessOptions wireless;
NMDeviceWiredOptions wired;
} NMDeviceOptions;
/*
* NetworkManager device structure
*/
struct NMDevice
{
guint refcount;
char * udi;
char * iface;
NMDeviceType type;
NMDriverSupportLevel driver_support_level;
gboolean removed;
gboolean link_active;
guint32 ip4_address;
/* FIXME: ipv6 address too */
struct ether_addr hw_addr;
NMData * app_data;
NMDeviceOptions options;
/* IP configuration info */
void * system_config_data; /* Distro-specific config data (parsed config file, etc) */
gboolean use_dhcp;
NMIP4Config * ip4_config; /* Config from DHCP, PPP, or system config files */
GMainContext * context;
GMainLoop * loop;
GThread * worker;
gboolean worker_started;
guint renew_timeout;
guint rebind_timeout;
NMActRequest * act_request;
gboolean quit_activation; /* Flag to signal activation thread to stop activating */
gboolean test_device;
gboolean test_device_up;
};