2005-12-31 08:21:24 +00:00
|
|
|
/* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef NM_DEVICE_H
|
|
|
|
|
#define NM_DEVICE_H
|
|
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
#include <dbus/dbus.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
|
|
#include "NetworkManager.h"
|
2007-06-11 13:36:34 +00:00
|
|
|
#include "nm-activation-request.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
#include "nm-ip4-config.h"
|
2007-05-07 15:17:45 +00:00
|
|
|
#include "nm-connection.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
#if 0
|
2006-05-25 22:37:41 +00:00
|
|
|
# define IOCTL_DEBUG 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef IOCTL_DEBUG
|
|
|
|
|
# define nm_ioctl_info(fmt, args...) \
|
|
|
|
|
G_STMT_START { \
|
|
|
|
|
g_message ("<information>\t" fmt "\n", ##args); \
|
|
|
|
|
} G_STMT_END
|
|
|
|
|
#else
|
|
|
|
|
# define nm_ioctl_info(fmt, args...) do { } while(0)
|
2005-12-31 08:21:24 +00:00
|
|
|
#endif
|
|
|
|
|
|
2006-01-03 17:07:07 +00:00
|
|
|
typedef enum NMActStageReturn
|
|
|
|
|
{
|
|
|
|
|
NM_ACT_STAGE_RETURN_FAILURE = 0,
|
|
|
|
|
NM_ACT_STAGE_RETURN_SUCCESS,
|
|
|
|
|
NM_ACT_STAGE_RETURN_POSTPONE
|
|
|
|
|
} NMActStageReturn;
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
#define NM_TYPE_DEVICE (nm_device_get_type ())
|
|
|
|
|
#define NM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
|
|
|
|
|
#define NM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE, NMDeviceClass))
|
|
|
|
|
#define NM_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE))
|
|
|
|
|
#define NM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE))
|
|
|
|
|
#define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass))
|
|
|
|
|
|
|
|
|
|
typedef struct _NMDevice NMDevice;
|
|
|
|
|
typedef struct _NMDeviceClass NMDeviceClass;
|
|
|
|
|
typedef struct _NMDevicePrivate NMDevicePrivate;
|
|
|
|
|
|
|
|
|
|
struct _NMDevice
|
|
|
|
|
{
|
|
|
|
|
GObject parent;
|
|
|
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
|
NMDevicePrivate *priv;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct NMData;
|
|
|
|
|
|
|
|
|
|
struct _NMDeviceClass
|
|
|
|
|
{
|
|
|
|
|
GObjectClass parent;
|
|
|
|
|
|
2006-01-03 17:07:07 +00:00
|
|
|
void (* update_link) (NMDevice *self);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
gboolean (* is_up) (NMDevice *self);
|
2007-03-12 04:49:29 +00:00
|
|
|
gboolean (* bring_up) (NMDevice *self);
|
2005-12-31 08:21:24 +00:00
|
|
|
void (* bring_down) (NMDevice *self);
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
void (* set_hw_address) (NMDevice *self);
|
|
|
|
|
|
2006-01-03 17:07:07 +00:00
|
|
|
guint32 (* get_type_capabilities) (NMDevice *self);
|
|
|
|
|
guint32 (* get_generic_capabilities) (NMDevice *self);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-09-10 19:11:40 +00:00
|
|
|
NMConnection * (* get_best_connection) (NMDevice *self,
|
2007-09-26 15:38:51 +00:00
|
|
|
GSList *connections,
|
2007-09-10 19:11:40 +00:00
|
|
|
char **specific_object);
|
2007-09-09 17:58:44 +00:00
|
|
|
|
2007-09-11 18:02:27 +00:00
|
|
|
void (* connection_secrets_updated) (NMDevice *self,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *setting_name);
|
|
|
|
|
|
2007-12-27 08:06:27 +00:00
|
|
|
gboolean (* check_connection) (NMDevice *self, NMConnection *connection, GError **error);
|
2007-05-07 15:17:45 +00:00
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
NMActStageReturn (* act_stage1_prepare) (NMDevice *self);
|
|
|
|
|
NMActStageReturn (* act_stage2_config) (NMDevice *self);
|
|
|
|
|
NMActStageReturn (* act_stage3_ip_config_start) (NMDevice *self);
|
2006-01-03 17:07:07 +00:00
|
|
|
NMActStageReturn (* act_stage4_get_ip4_config) (NMDevice *self,
|
2007-06-11 13:36:34 +00:00
|
|
|
NMIP4Config **config);
|
2006-01-03 17:47:38 +00:00
|
|
|
NMActStageReturn (* act_stage4_ip_config_timeout) (NMDevice *self,
|
|
|
|
|
NMIP4Config **config);
|
2005-12-31 08:21:24 +00:00
|
|
|
void (* deactivate) (NMDevice *self);
|
2006-01-13 16:53:55 +00:00
|
|
|
void (* deactivate_quickly) (NMDevice *self);
|
2006-01-03 22:11:35 +00:00
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
void (* activation_cancel_handler) (NMDevice *self);
|
2006-01-22 22:40:14 +00:00
|
|
|
|
|
|
|
|
gboolean (* can_interrupt_activation) (NMDevice *self);
|
2005-12-31 08:21:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GType nm_device_get_type (void);
|
|
|
|
|
|
|
|
|
|
const char * nm_device_get_udi (NMDevice *dev);
|
|
|
|
|
const char * nm_device_get_iface (NMDevice *dev);
|
|
|
|
|
const char * nm_device_get_driver (NMDevice *dev);
|
|
|
|
|
|
|
|
|
|
NMDeviceType nm_device_get_device_type (NMDevice *dev);
|
|
|
|
|
guint32 nm_device_get_capabilities (NMDevice *dev);
|
|
|
|
|
guint32 nm_device_get_type_capabilities (NMDevice *dev);
|
|
|
|
|
|
|
|
|
|
gboolean nm_device_has_active_link (NMDevice *dev);
|
|
|
|
|
guint32 nm_device_get_ip4_address (NMDevice *dev);
|
|
|
|
|
void nm_device_update_ip4_address (NMDevice *dev);
|
|
|
|
|
struct in6_addr * nm_device_get_ip6_address (NMDevice *dev);
|
|
|
|
|
|
|
|
|
|
gboolean nm_device_get_use_dhcp (NMDevice *dev);
|
|
|
|
|
void nm_device_set_use_dhcp (NMDevice *dev,
|
|
|
|
|
gboolean use_dhcp);
|
|
|
|
|
|
|
|
|
|
NMIP4Config * nm_device_get_ip4_config (NMDevice *dev);
|
2007-12-06 14:51:43 +00:00
|
|
|
gboolean nm_device_set_ip4_config (NMDevice *dev,
|
2005-12-31 08:21:24 +00:00
|
|
|
NMIP4Config *config);
|
|
|
|
|
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
gboolean nm_device_is_up (NMDevice *dev);
|
2007-03-12 04:49:29 +00:00
|
|
|
gboolean nm_device_bring_up (NMDevice *dev, gboolean wait);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
void nm_device_bring_down (NMDevice *dev, gboolean wait);
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
void * nm_device_get_system_config_data (NMDevice *dev);
|
|
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
NMActRequest * nm_device_get_act_request (NMDevice *dev);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-09-10 19:11:40 +00:00
|
|
|
NMConnection * nm_device_get_best_connection (NMDevice *dev,
|
2007-09-26 15:38:51 +00:00
|
|
|
GSList *connections,
|
2007-09-10 19:11:40 +00:00
|
|
|
char **specific_object);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
void nm_device_activate_schedule_stage1_device_prepare (NMDevice *device);
|
|
|
|
|
void nm_device_activate_schedule_stage2_device_config (NMDevice *device);
|
|
|
|
|
void nm_device_activate_schedule_stage4_ip_config_get (NMDevice *device);
|
|
|
|
|
void nm_device_activate_schedule_stage4_ip_config_timeout (NMDevice *device);
|
2005-12-31 08:21:24 +00:00
|
|
|
gboolean nm_device_deactivate_quickly (NMDevice *dev);
|
|
|
|
|
gboolean nm_device_is_activating (NMDevice *dev);
|
|
|
|
|
void nm_device_activation_cancel (NMDevice *dev);
|
|
|
|
|
|
2006-01-22 22:40:14 +00:00
|
|
|
gboolean nm_device_can_interrupt_activation (NMDevice *self);
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
NMDeviceState nm_device_get_state (NMDevice *device);
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif /* NM_DEVICE_H */
|