diff --git a/ChangeLog b/ChangeLog index 1ec957213..a2ec35aa1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-10 Dan Williams + + The grand 802-3-ethernet rename. Get rid of the 802-3/8023/802_3 bits. + 2008-06-10 Dan Williams Patch from Tambet Ingo diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c index b760812a4..8da80fee3 100644 --- a/callouts/nm-dispatcher-action.c +++ b/callouts/nm-dispatcher-action.c @@ -302,7 +302,7 @@ nm_dispatcher_action (Handler *h, NMConnection *connection; char *iface = NULL; char *parent_iface = NULL; - NMDeviceType type = DEVICE_TYPE_UNKNOWN; + NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN; GValue *value; /* Back off the quit timeout */ diff --git a/include/NetworkManager.h b/include/NetworkManager.h index 59c685ae3..7d3437957 100644 --- a/include/NetworkManager.h +++ b/include/NetworkManager.h @@ -70,13 +70,20 @@ typedef enum NMState */ typedef enum NMDeviceType { - DEVICE_TYPE_UNKNOWN = 0, - DEVICE_TYPE_802_3_ETHERNET, - DEVICE_TYPE_802_11_WIRELESS, - DEVICE_TYPE_GSM, - DEVICE_TYPE_CDMA + NM_DEVICE_TYPE_UNKNOWN = 0, + NM_DEVICE_TYPE_ETHERNET, + NM_DEVICE_TYPE_WIFI, + NM_DEVICE_TYPE_GSM, + NM_DEVICE_TYPE_CDMA } NMDeviceType; +/* DEPRECATED TYPE NAMES */ +#define DEVICE_TYPE_UNKNOWN NM_DEVICE_TYPE_UNKNOWN +#define DEVICE_TYPE_802_3_ETHERNET NM_DEVICE_TYPE_ETHERNET +#define DEVICE_TYPE_802_11_WIRELESS NM_DEVICE_TYPE_WIFI +#define DEVICE_TYPE_GSM NM_DEVICE_TYPE_GSM +#define DEVICE_TYPE_CDMA NM_DEVICE_TYPE_CDMA + /* * General device capability bits diff --git a/introspection/Makefile.am b/introspection/Makefile.am index 10d0fc146..ee6d6a64c 100644 --- a/introspection/Makefile.am +++ b/introspection/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ nm-access-point.xml \ nm-device-802-11-wireless.xml \ - nm-device-802-3-ethernet.xml \ + nm-device-ethernet.xml \ nm-device-cdma.xml \ nm-device-gsm.xml \ nm-device-serial.xml \ diff --git a/introspection/nm-device-802-3-ethernet.xml b/introspection/nm-device-ethernet.xml similarity index 100% rename from introspection/nm-device-802-3-ethernet.xml rename to introspection/nm-device-ethernet.xml diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am index 973b59e34..0c1793129 100644 --- a/libnm-glib/Makefile.am +++ b/libnm-glib/Makefile.am @@ -7,7 +7,7 @@ BUILT_SOURCES = \ nm-access-point-bindings.h \ nm-client-bindings.h \ nm-device-bindings.h \ - nm-device-802-3-ethernet-bindings.h \ + nm-device-ethernet-bindings.h \ nm-device-802-11-wireless-bindings.h \ nm-exported-connection-glue.h \ nm-exported-connection-bindings.h \ @@ -34,7 +34,7 @@ libnminclude_HEADERS = \ nm-object.h \ nm-client.h \ nm-device.h \ - nm-device-802-3-ethernet.h \ + nm-device-ethernet.h \ nm-device-802-11-wireless.h \ nm-access-point.h \ nm-ip4-config.h \ @@ -59,7 +59,7 @@ libnm_glib_la_SOURCES = \ nm-dbus-utils.h \ nm-device.c \ nm-device-private.h \ - nm-device-802-3-ethernet.c \ + nm-device-ethernet.c \ nm-device-802-11-wireless.c \ nm-access-point.c \ nm-ip4-config.c \ @@ -103,8 +103,8 @@ nm-client-bindings.h: $(top_srcdir)/introspection/nm-manager-client.xml nm-device-bindings.h: $(top_srcdir)/introspection/nm-device.xml dbus-binding-tool --prefix=nm_device --mode=glib-client --output=nm-device-bindings.h $(top_srcdir)/introspection/nm-device.xml -nm-device-802-3-ethernet-bindings.h: $(top_srcdir)/introspection/nm-device-802-3-ethernet.xml - dbus-binding-tool --prefix=nm_device_802_3_ethernet --mode=glib-client --output=nm-device-802-3-ethernet-bindings.h $(top_srcdir)/introspection/nm-device-802-3-ethernet.xml +nm-device-ethernet-bindings.h: $(top_srcdir)/introspection/nm-device-ethernet.xml + dbus-binding-tool --prefix=nm_device_ethernet --mode=glib-client --output=nm-device-ethernet-bindings.h $(top_srcdir)/introspection/nm-device-ethernet.xml nm-device-802-11-wireless-bindings.h: $(top_srcdir)/introspection/nm-device-802-11-wireless.xml dbus-binding-tool --prefix=nm_device_802_11_wireless --mode=glib-client --output=nm-device-802-11-wireless-bindings.h $(top_srcdir)/introspection/nm-device-802-11-wireless.xml diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index 23dff096b..601f531b5 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -9,7 +9,7 @@ #include "nm-client.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-device-802-11-wireless.h" #include "nm-utils.h" #include "nm-active-connection.h" @@ -158,13 +158,13 @@ dump_wireless (NMDevice80211Wireless *device) } static void -dump_wired (NMDevice8023Ethernet *device) +dump_wired (NMDeviceEthernet *device) { const char *str; - g_print ("Speed: %d\n", nm_device_802_3_ethernet_get_speed (device)); + g_print ("Speed: %d\n", nm_device_ethernet_get_speed (device)); - str = nm_device_802_3_ethernet_get_hw_address (device); + str = nm_device_ethernet_get_hw_address (device); g_print ("MAC: %s\n", str); } @@ -195,8 +195,8 @@ dump_device (NMDevice *device) if (state == NM_DEVICE_STATE_ACTIVATED) dump_ip4_config (nm_device_get_ip4_config (device)); - if (NM_IS_DEVICE_802_3_ETHERNET (device)) - dump_wired (NM_DEVICE_802_3_ETHERNET (device)); + if (NM_IS_DEVICE_ETHERNET (device)) + dump_wired (NM_DEVICE_ETHERNET (device)); else if (NM_IS_DEVICE_802_11_WIRELESS (device)) dump_wireless (NM_DEVICE_802_11_WIRELESS (device)); } diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 35a411159..b483e2036 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -5,7 +5,7 @@ #include #include "nm-client.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-device-802-11-wireless.h" #include "nm-gsm-device.h" #include "nm-cdma-device.h" diff --git a/libnm-glib/nm-device-802-3-ethernet.h b/libnm-glib/nm-device-802-3-ethernet.h deleted file mode 100644 index bcde6adef..000000000 --- a/libnm-glib/nm-device-802-3-ethernet.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef NM_DEVICE_802_3_ETHERNET_H -#define NM_DEVICE_802_3_ETHERNET_H - -#include "nm-device.h" - -G_BEGIN_DECLS - -#define NM_TYPE_DEVICE_802_3_ETHERNET (nm_device_802_3_ethernet_get_type ()) -#define NM_DEVICE_802_3_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023Ethernet)) -#define NM_DEVICE_802_3_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetClass)) -#define NM_IS_DEVICE_802_3_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_802_3_ETHERNET)) -#define NM_IS_DEVICE_802_3_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_DEVICE_802_3_ETHERNET)) -#define NM_DEVICE_802_3_ETHERNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetClass)) - -#define NM_DEVICE_802_3_ETHERNET_HW_ADDRESS "hw-address" -#define NM_DEVICE_802_3_ETHERNET_SPEED "speed" -#define NM_DEVICE_802_3_ETHERNET_CARRIER "carrier" - -typedef struct { - NMDevice parent; -} NMDevice8023Ethernet; - -typedef struct { - NMDeviceClass parent; -} NMDevice8023EthernetClass; - -GType nm_device_802_3_ethernet_get_type (void); - -GObject *nm_device_802_3_ethernet_new (DBusGConnection *connection, const char *path); - -const char * nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device); -guint32 nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *device); -gboolean nm_device_802_3_ethernet_get_carrier (NMDevice8023Ethernet *device); - -G_END_DECLS - -#endif /* NM_DEVICE_802_3_ETHERNET_H */ diff --git a/libnm-glib/nm-device-802-3-ethernet.c b/libnm-glib/nm-device-ethernet.c similarity index 56% rename from libnm-glib/nm-device-802-3-ethernet.c rename to libnm-glib/nm-device-ethernet.c index 1bcc896a5..d8d43e55c 100644 --- a/libnm-glib/nm-device-802-3-ethernet.c +++ b/libnm-glib/nm-device-ethernet.c @@ -1,12 +1,12 @@ -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-device-private.h" #include "nm-object-private.h" -#include "nm-device-802-3-ethernet-bindings.h" +#include "nm-device-ethernet-bindings.h" -G_DEFINE_TYPE (NMDevice8023Ethernet, nm_device_802_3_ethernet, NM_TYPE_DEVICE) +G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE) -#define NM_DEVICE_802_3_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetPrivate)) +#define NM_DEVICE_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate)) typedef struct { DBusGProxy *proxy; @@ -17,7 +17,7 @@ typedef struct { gboolean carrier_valid; gboolean disposed; -} NMDevice8023EthernetPrivate; +} NMDeviceEthernetPrivate; enum { PROP_0, @@ -33,25 +33,25 @@ enum { #define DBUS_PROP_CARRIER "Carrier" GObject * -nm_device_802_3_ethernet_new (DBusGConnection *connection, const char *path) +nm_device_ethernet_new (DBusGConnection *connection, const char *path) { g_return_val_if_fail (connection != NULL, NULL); g_return_val_if_fail (path != NULL, NULL); - return g_object_new (NM_TYPE_DEVICE_802_3_ETHERNET, + return g_object_new (NM_TYPE_DEVICE_ETHERNET, NM_OBJECT_DBUS_CONNECTION, connection, NM_OBJECT_DBUS_PATH, path, NULL); } const char * -nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device) +nm_device_ethernet_get_hw_address (NMDeviceEthernet *device) { - NMDevice8023EthernetPrivate *priv; + NMDeviceEthernetPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_802_3_ETHERNET (device), NULL); + g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL); - priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device); + priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); if (!priv->hw_address) { priv->hw_address = nm_object_get_string_property (NM_OBJECT (device), NM_DBUS_INTERFACE_DEVICE_WIRED, @@ -62,13 +62,13 @@ nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device) } guint32 -nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *device) +nm_device_ethernet_get_speed (NMDeviceEthernet *device) { - NMDevice8023EthernetPrivate *priv; + NMDeviceEthernetPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_802_3_ETHERNET (device), 0); + g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), 0); - priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device); + priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); if (!priv->speed) { priv->speed = nm_object_get_uint_property (NM_OBJECT (device), NM_DBUS_INTERFACE_DEVICE_WIRED, @@ -79,13 +79,13 @@ nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *device) } gboolean -nm_device_802_3_ethernet_get_carrier (NMDevice8023Ethernet *device) +nm_device_ethernet_get_carrier (NMDeviceEthernet *device) { - NMDevice8023EthernetPrivate *priv; + NMDeviceEthernetPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_802_3_ETHERNET (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), FALSE); - priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device); + priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); if (!priv->carrier_valid) { priv->carrier = nm_object_get_boolean_property (NM_OBJECT (device), NM_DBUS_INTERFACE_DEVICE_WIRED, @@ -97,9 +97,9 @@ nm_device_802_3_ethernet_get_carrier (NMDevice8023Ethernet *device) } static void -nm_device_802_3_ethernet_init (NMDevice8023Ethernet *device) +nm_device_ethernet_init (NMDeviceEthernet *device) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); priv->disposed = FALSE; priv->carrier = FALSE; @@ -107,13 +107,13 @@ nm_device_802_3_ethernet_init (NMDevice8023Ethernet *device) } static void -register_for_property_changed (NMDevice8023Ethernet *device) +register_for_property_changed (NMDeviceEthernet *device) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); const NMPropertiesChangedInfo property_changed_info[] = { - { NM_DEVICE_802_3_ETHERNET_HW_ADDRESS, nm_object_demarshal_generic, &priv->hw_address }, - { NM_DEVICE_802_3_ETHERNET_SPEED, nm_object_demarshal_generic, &priv->speed }, - { NM_DEVICE_802_3_ETHERNET_CARRIER, nm_object_demarshal_generic, &priv->carrier }, + { NM_DEVICE_ETHERNET_HW_ADDRESS, nm_object_demarshal_generic, &priv->hw_address }, + { NM_DEVICE_ETHERNET_SPEED, nm_object_demarshal_generic, &priv->speed }, + { NM_DEVICE_ETHERNET_CARRIER, nm_object_demarshal_generic, &priv->carrier }, { NULL }, }; @@ -128,22 +128,22 @@ constructor (GType type, GObjectConstructParam *construct_params) { GObject *object; - NMDevice8023EthernetPrivate *priv; + NMDeviceEthernetPrivate *priv; - object = G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->constructor (type, + object = G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructor (type, n_construct_params, construct_params); if (!object) return NULL; - priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object); + priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object); priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)), NM_DBUS_SERVICE, nm_object_get_path (NM_OBJECT (object)), NM_DBUS_INTERFACE_DEVICE_WIRED); - register_for_property_changed (NM_DEVICE_802_3_ETHERNET (object)); + register_for_property_changed (NM_DEVICE_ETHERNET (object)); return object; } @@ -151,10 +151,10 @@ constructor (GType type, static void dispose (GObject *object) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object); if (priv->disposed) { - G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object); return; } @@ -162,18 +162,18 @@ dispose (GObject *object) g_object_unref (priv->proxy); - G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object); } static void finalize (GObject *object) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object); if (priv->hw_address) g_free (priv->hw_address); - G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_device_ethernet_parent_class)->finalize (object); } static void @@ -182,17 +182,17 @@ get_property (GObject *object, GValue *value, GParamSpec *pspec) { - NMDevice8023Ethernet *device = NM_DEVICE_802_3_ETHERNET (object); + NMDeviceEthernet *device = NM_DEVICE_ETHERNET (object); switch (prop_id) { case PROP_HW_ADDRESS: - g_value_set_string (value, nm_device_802_3_ethernet_get_hw_address (device)); + g_value_set_string (value, nm_device_ethernet_get_hw_address (device)); break; case PROP_SPEED: - g_value_set_uint (value, nm_device_802_3_ethernet_get_speed (device)); + g_value_set_uint (value, nm_device_ethernet_get_speed (device)); break; case PROP_CARRIER: - g_value_set_boolean (value, nm_device_802_3_ethernet_get_carrier (device)); + g_value_set_boolean (value, nm_device_ethernet_get_carrier (device)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -201,11 +201,11 @@ get_property (GObject *object, } static void -nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *device_class) +nm_device_ethernet_class_init (NMDeviceEthernetClass *device_class) { GObjectClass *object_class = G_OBJECT_CLASS (device_class); - g_type_class_add_private (device_class, sizeof (NMDevice8023EthernetPrivate)); + g_type_class_add_private (device_class, sizeof (NMDeviceEthernetPrivate)); /* virtual methods */ object_class->constructor = constructor; @@ -216,7 +216,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *device_class) /* properties */ g_object_class_install_property (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_802_3_ETHERNET_HW_ADDRESS, + g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS, "MAC Address", "Hardware MAC address", NULL, @@ -224,7 +224,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *device_class) g_object_class_install_property (object_class, PROP_SPEED, - g_param_spec_uint (NM_DEVICE_802_3_ETHERNET_SPEED, + g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "Speed", "Speed", 0, G_MAXUINT32, 0, @@ -232,7 +232,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *device_class) g_object_class_install_property (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_802_3_ETHERNET_CARRIER, + g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER, "Carrier", "Carrier", FALSE, diff --git a/libnm-glib/nm-device-ethernet.h b/libnm-glib/nm-device-ethernet.h new file mode 100644 index 000000000..730439678 --- /dev/null +++ b/libnm-glib/nm-device-ethernet.h @@ -0,0 +1,37 @@ +#ifndef NM_DEVICE_ETHERNET_H +#define NM_DEVICE_ETHERNET_H + +#include "nm-device.h" + +G_BEGIN_DECLS + +#define NM_TYPE_DEVICE_ETHERNET (nm_device_ethernet_get_type ()) +#define NM_DEVICE_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernet)) +#define NM_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass)) +#define NM_IS_DEVICE_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_ETHERNET)) +#define NM_IS_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_DEVICE_ETHERNET)) +#define NM_DEVICE_ETHERNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass)) + +#define NM_DEVICE_ETHERNET_HW_ADDRESS "hw-address" +#define NM_DEVICE_ETHERNET_SPEED "speed" +#define NM_DEVICE_ETHERNET_CARRIER "carrier" + +typedef struct { + NMDevice parent; +} NMDeviceEthernet; + +typedef struct { + NMDeviceClass parent; +} NMDeviceEthernetClass; + +GType nm_device_ethernet_get_type (void); + +GObject *nm_device_ethernet_new (DBusGConnection *connection, const char *path); + +const char * nm_device_ethernet_get_hw_address (NMDeviceEthernet *device); +guint32 nm_device_ethernet_get_speed (NMDeviceEthernet *device); +gboolean nm_device_ethernet_get_carrier (NMDeviceEthernet *device); + +G_END_DECLS + +#endif /* NM_DEVICE_ETHERNET_H */ diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 757cd491f..905d07068 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -1,7 +1,7 @@ #include #include "NetworkManager.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-device-802-11-wireless.h" #include "nm-gsm-device.h" #include "nm-cdma-device.h" @@ -338,16 +338,16 @@ nm_device_new (DBusGConnection *connection, const char *path) } switch (g_value_get_uint (&value)) { - case DEVICE_TYPE_802_3_ETHERNET: - dtype = NM_TYPE_DEVICE_802_3_ETHERNET; + case NM_DEVICE_TYPE_ETHERNET: + dtype = NM_TYPE_DEVICE_ETHERNET; break; - case DEVICE_TYPE_802_11_WIRELESS: + case NM_DEVICE_TYPE_WIFI: dtype = NM_TYPE_DEVICE_802_11_WIRELESS; break; - case DEVICE_TYPE_GSM: + case NM_DEVICE_TYPE_GSM: dtype = NM_TYPE_GSM_DEVICE; break; - case DEVICE_TYPE_CDMA: + case NM_DEVICE_TYPE_CDMA: dtype = NM_TYPE_CDMA_DEVICE; break; default: diff --git a/src/Makefile.am b/src/Makefile.am index 8a19e3f89..086504e59 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,8 +28,8 @@ NetworkManager_SOURCES = \ nm-device-interface.c \ nm-device-interface.h \ nm-device-private.h \ - nm-device-802-3-ethernet.c \ - nm-device-802-3-ethernet.h \ + nm-device-ethernet.c \ + nm-device-ethernet.h \ nm-device-802-11-wireless.c \ nm-device-802-11-wireless.h \ NetworkManagerAP.c \ @@ -81,8 +81,8 @@ nm-manager-glue.h: $(top_srcdir)/introspection/nm-manager.xml nm-device-interface-glue.h: $(top_srcdir)/introspection/nm-device.xml dbus-binding-tool --prefix=nm_device_interface --mode=glib-server --output=nm-device-interface-glue.h $(top_srcdir)/introspection/nm-device.xml -nm-device-802-3-ethernet-glue.h: $(top_srcdir)/introspection/nm-device-802-3-ethernet.xml - dbus-binding-tool --prefix=nm_device_802_3_ethernet --mode=glib-server --output=nm-device-802-3-ethernet-glue.h $(top_srcdir)/introspection/nm-device-802-3-ethernet.xml +nm-device-ethernet-glue.h: $(top_srcdir)/introspection/nm-device-ethernet.xml + dbus-binding-tool --prefix=nm_device_ethernet --mode=glib-server --output=nm-device-ethernet-glue.h $(top_srcdir)/introspection/nm-device-ethernet.xml nm-device-802-11-wireless-glue.h: $(top_srcdir)/introspection/nm-device-802-11-wireless.xml dbus-binding-tool --prefix=nm_device_802_11_wireless --mode=glib-server --output=nm-device-802-11-wireless-glue.h $(top_srcdir)/introspection/nm-device-802-11-wireless.xml @@ -106,7 +106,7 @@ built_sources = \ nm-access-point-glue.h \ nm-manager-glue.h \ nm-device-interface-glue.h \ - nm-device-802-3-ethernet-glue.h \ + nm-device-ethernet-glue.h \ nm-device-802-11-wireless-glue.h \ nm-serial-device-glue.h \ nm-cdma-device-glue.h \ diff --git a/src/NetworkManager.c b/src/NetworkManager.c index 753a819d4..8491ca9d2 100644 --- a/src/NetworkManager.c +++ b/src/NetworkManager.c @@ -41,11 +41,7 @@ #include "NetworkManager.h" #include "nm-utils.h" #include "NetworkManagerUtils.h" -#include "nm-device-interface.h" #include "nm-manager.h" -#include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "NetworkManagerPolicy.h" #include "NetworkManagerSystem.h" #include "nm-named-manager.h" diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index 8c4559793..5a1bd3802 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -40,7 +40,7 @@ #include "nm-device-interface.h" #include "nm-device.h" #include "nm-device-802-11-wireless.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-gsm-device.h" #include "nm-cdma-device.h" #include "nm-dbus-manager.h" @@ -108,7 +108,7 @@ get_device_priority (NMDevice *dev) if (NM_IS_DEVICE_802_11_WIRELESS (dev)) return 4; - if (NM_IS_DEVICE_802_3_ETHERNET (dev)) + if (NM_IS_DEVICE_ETHERNET (dev)) return 5; return 1; diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index eb58d789f..2f7356351 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -29,7 +29,7 @@ #include "nm-utils.h" #include "nm-device.h" #include "nm-device-802-11-wireless.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-dbus-manager.h" #include "nm-dispatcher-action.h" #include "nm-dbus-glib-types.h" @@ -118,7 +118,7 @@ nm_print_device_capabilities (NMDevice *dev) return; } - if (NM_IS_DEVICE_802_3_ETHERNET (dev)) { + if (NM_IS_DEVICE_ETHERNET (dev)) { if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) { nm_info ("%s: Driver '%s' does not support carrier detection.\n" "\tYou must switch to it manually.", diff --git a/src/autoip.c b/src/autoip.c index 31702356e..af879a374 100644 --- a/src/autoip.c +++ b/src/autoip.c @@ -31,7 +31,7 @@ #include #include "NetworkManager.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-device-802-11-wireless.h" #include "NetworkManagerUtils.h" #include "nm-utils.h" @@ -225,8 +225,8 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip) memset (&saddr, 0, sizeof (saddr)); strncpy (saddr.sa_data, iface, sizeof (saddr.sa_data)); - if (NM_IS_DEVICE_802_3_ETHERNET (dev)) - nm_device_802_3_ethernet_get_address (NM_DEVICE_802_3_ETHERNET (dev), &addr); + if (NM_IS_DEVICE_ETHERNET (dev)) + nm_device_ethernet_get_address (NM_DEVICE_ETHERNET (dev), &addr); else if (NM_IS_DEVICE_802_11_WIRELESS (dev)) nm_device_802_11_wireless_get_address (NM_DEVICE_802_11_WIRELESS (dev), &addr); else diff --git a/src/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c index e68cc8fea..c5c3f736a 100644 --- a/src/backends/NetworkManagerArch.c +++ b/src/backends/NetworkManagerArch.c @@ -49,8 +49,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "interface_parser.h" #include "nm-utils.h" diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c index f1b89f7f8..386973e3d 100644 --- a/src/backends/NetworkManagerDebian.c +++ b/src/backends/NetworkManagerDebian.c @@ -38,8 +38,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "interface_parser.h" #include "nm-utils.h" diff --git a/src/backends/NetworkManagerFrugalware.c b/src/backends/NetworkManagerFrugalware.c index 091b3b740..fa10ce177 100644 --- a/src/backends/NetworkManagerFrugalware.c +++ b/src/backends/NetworkManagerFrugalware.c @@ -33,8 +33,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" // Provided by the frugalwareutils package on Frugalware diff --git a/src/backends/NetworkManagerGeneric.c b/src/backends/NetworkManagerGeneric.c index 2ee133933..a98eb8a02 100644 --- a/src/backends/NetworkManagerGeneric.c +++ b/src/backends/NetworkManagerGeneric.c @@ -35,8 +35,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" #include "nm-netlink.h" diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index 4157ae709..98db2db82 100644 --- a/src/backends/NetworkManagerGentoo.c +++ b/src/backends/NetworkManagerGentoo.c @@ -38,8 +38,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" #include "shvar.h" diff --git a/src/backends/NetworkManagerMandriva.c b/src/backends/NetworkManagerMandriva.c index d77473623..bff02cc3e 100644 --- a/src/backends/NetworkManagerMandriva.c +++ b/src/backends/NetworkManagerMandriva.c @@ -36,8 +36,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" #include "shvar.h" diff --git a/src/backends/NetworkManagerPaldo.c b/src/backends/NetworkManagerPaldo.c index d4fb0a7bb..24ef45d44 100644 --- a/src/backends/NetworkManagerPaldo.c +++ b/src/backends/NetworkManagerPaldo.c @@ -38,8 +38,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" /* diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index d6bfb6672..d8cde68c0 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -34,8 +34,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" #include "shvar.h" diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index d4377d6df..1e857e863 100644 --- a/src/backends/NetworkManagerSlackware.c +++ b/src/backends/NetworkManagerSlackware.c @@ -34,8 +34,6 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" /* diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index 2fe3ea02c..0a9aa7cc6 100644 --- a/src/backends/NetworkManagerSuSE.c +++ b/src/backends/NetworkManagerSuSE.c @@ -43,8 +43,6 @@ #include "NetworkManagerUtils.h" #include "nm-device.h" #include "NetworkManagerPolicy.h" -#include "nm-device-802-3-ethernet.h" -#include "nm-device-802-11-wireless.h" #include "nm-utils.h" #include "shvar.h" diff --git a/src/nm-cdma-device.c b/src/nm-cdma-device.c index 4be18163c..f4d0b0ee0 100644 --- a/src/nm-cdma-device.c +++ b/src/nm-cdma-device.c @@ -357,7 +357,7 @@ setup_monitor_device (NMCdmaDevice *device) static void nm_cdma_device_init (NMCdmaDevice *self) { - nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_CDMA); + nm_device_set_device_type (NM_DEVICE (self), NM_DEVICE_TYPE_CDMA); } static gboolean diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index fb7c9e675..9b4aa81b6 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -414,7 +414,7 @@ nm_device_802_11_wireless_init (NMDevice80211Wireless * self) memset (&(self->priv->hw_addr), 0, sizeof (struct ether_addr)); - nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_802_11_WIRELESS); + nm_device_set_device_type (NM_DEVICE (self), NM_DEVICE_TYPE_WIFI); } static guint32 iw_freq_to_uint32 (struct iw_freq *freq) diff --git a/src/nm-device-802-3-ethernet.h b/src/nm-device-802-3-ethernet.h deleted file mode 100644 index 7137ca25a..000000000 --- a/src/nm-device-802-3-ethernet.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ - -/* NetworkManager -- Network link manager - * - * Dan Williams - * - * 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_802_3_ETHERNET_H -#define NM_DEVICE_802_3_ETHERNET_H - -#include -#include - -#include "nm-device.h" - -G_BEGIN_DECLS - -#define NM_TYPE_DEVICE_802_3_ETHERNET (nm_device_802_3_ethernet_get_type ()) -#define NM_DEVICE_802_3_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023Ethernet)) -#define NM_DEVICE_802_3_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetClass)) -#define NM_IS_DEVICE_802_3_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_802_3_ETHERNET)) -#define NM_IS_DEVICE_802_3_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_802_3_ETHERNET)) -#define NM_DEVICE_802_3_ETHERNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetClass)) - -#define NM_DEVICE_802_3_ETHERNET_HW_ADDRESS "hw-address" -#define NM_DEVICE_802_3_ETHERNET_SPEED "speed" -#define NM_DEVICE_802_3_ETHERNET_CARRIER "carrier" - -typedef struct { - NMDevice parent; -} NMDevice8023Ethernet; - -typedef struct { - NMDeviceClass parent; - - /* Signals */ - void (*properties_changed) (NMDevice8023Ethernet *device, GHashTable *properties); -} NMDevice8023EthernetClass; - - -GType nm_device_802_3_ethernet_get_type (void); - - -NMDevice8023Ethernet *nm_device_802_3_ethernet_new (const char *udi, - const char *iface, - const char *driver, - gboolean managed); - -void nm_device_802_3_ethernet_get_address (NMDevice8023Ethernet *dev, - struct ether_addr *addr); - -gboolean nm_device_802_3_ethernet_get_carrier (NMDevice8023Ethernet *dev); - -G_END_DECLS - -#endif /* NM_DEVICE_802_3_ETHERNET_H */ diff --git a/src/nm-device-802-3-ethernet.c b/src/nm-device-ethernet.c similarity index 83% rename from src/nm-device-802-3-ethernet.c rename to src/nm-device-ethernet.c index 4c3371ed2..ef1f25dcf 100644 --- a/src/nm-device-802-3-ethernet.c +++ b/src/nm-device-ethernet.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * @@ -34,7 +34,7 @@ #include #include -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-device-interface.h" #include "nm-device-private.h" #include "nm-activation-request.h" @@ -53,12 +53,12 @@ #include "nm-utils.h" #include "nm-properties-changed-signal.h" -#include "nm-device-802-3-ethernet-glue.h" +#include "nm-device-ethernet-glue.h" -G_DEFINE_TYPE (NMDevice8023Ethernet, nm_device_802_3_ethernet, NM_TYPE_DEVICE) +G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE) -#define NM_DEVICE_802_3_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetPrivate)) +#define NM_DEVICE_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate)) #define WIRED_SECRETS_TRIES "wired-secrets-tries" @@ -102,7 +102,7 @@ typedef struct { /* PPPoE */ NMPPPManager *ppp_manager; NMIP4Config *pending_ip4_config; -} NMDevice8023EthernetPrivate; +} NMDeviceEthernetPrivate; enum { PROPERTIES_CHANGED, @@ -122,8 +122,8 @@ enum { }; -static gboolean supports_mii_carrier_detect (NMDevice8023Ethernet *dev); -static gboolean supports_ethtool_carrier_detect (NMDevice8023Ethernet *dev); +static gboolean supports_mii_carrier_detect (NMDeviceEthernet *dev); +static gboolean supports_ethtool_carrier_detect (NMDeviceEthernet *dev); static GQuark nm_ethernet_error_quark (void) @@ -158,19 +158,19 @@ nm_ethernet_error_get_type (void) } static void -set_carrier (NMDevice8023Ethernet *self, const gboolean carrier) +set_carrier (NMDeviceEthernet *self, const gboolean carrier) { - NMDevice8023EthernetPrivate *priv; + NMDeviceEthernetPrivate *priv; NMDeviceState state; g_return_if_fail (NM_IS_DEVICE (self)); - priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); if (priv->carrier == carrier) return; priv->carrier = carrier; - g_object_notify (G_OBJECT (self), NM_DEVICE_802_3_ETHERNET_CARRIER); + g_object_notify (G_OBJECT (self), NM_DEVICE_ETHERNET_CARRIER); state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self)); nm_info ("(%s): carrier now %s (device state %d)", nm_device_get_iface (NM_DEVICE (self)), carrier ? "ON" : "OFF", state); @@ -184,7 +184,7 @@ nm_info ("(%s): carrier now %s (device state %d)", nm_device_get_iface (NM_DEVIC } static void -nm_device_802_3_ethernet_carrier_on (NMNetlinkMonitor *monitor, +nm_device_ethernet_carrier_on (NMNetlinkMonitor *monitor, int idx, gpointer user_data) { @@ -198,12 +198,12 @@ nm_device_802_3_ethernet_carrier_on (NMNetlinkMonitor *monitor, if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) return; - set_carrier (NM_DEVICE_802_3_ETHERNET (dev), TRUE); + set_carrier (NM_DEVICE_ETHERNET (dev), TRUE); } } static void -nm_device_802_3_ethernet_carrier_off (NMNetlinkMonitor *monitor, +nm_device_ethernet_carrier_off (NMNetlinkMonitor *monitor, int idx, gpointer user_data) { @@ -217,7 +217,7 @@ nm_device_802_3_ethernet_carrier_off (NMNetlinkMonitor *monitor, if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) return; - set_carrier (NM_DEVICE_802_3_ETHERNET (dev), FALSE); + set_carrier (NM_DEVICE_ETHERNET (dev), FALSE); } } @@ -231,8 +231,8 @@ unavailable_to_disconnected (gpointer user_data) static void device_state_changed (NMDeviceInterface *device, NMDeviceState state, gpointer user_data) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (user_data); - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); /* Remove any previous delayed transition to disconnected */ if (priv->state_to_disconnected_id) { @@ -256,18 +256,18 @@ constructor (GType type, GObjectConstructParam *construct_params) { GObject *object; - NMDevice8023EthernetPrivate * priv; + NMDeviceEthernetPrivate * priv; NMDevice * dev; guint32 caps; - object = G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->constructor (type, + object = G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructor (type, n_construct_params, construct_params); if (!object) return NULL; dev = NM_DEVICE (object); - priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev); + priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev); priv->carrier_file_path = g_strdup_printf ("/sys/class/net/%s/carrier", nm_device_get_iface (dev)); @@ -280,10 +280,10 @@ constructor (GType type, NMNetlinkMonitor * monitor = nm_netlink_monitor_get (); priv->link_connected_id = g_signal_connect (monitor, "carrier-on", - G_CALLBACK (nm_device_802_3_ethernet_carrier_on), + G_CALLBACK (nm_device_ethernet_carrier_on), dev); priv->link_disconnected_id = g_signal_connect (monitor, "carrier-off", - G_CALLBACK (nm_device_802_3_ethernet_carrier_off), + G_CALLBACK (nm_device_ethernet_carrier_off), dev); if (!nm_netlink_monitor_request_status (monitor, &error)) { @@ -304,22 +304,22 @@ constructor (GType type, } static void -nm_device_802_3_ethernet_init (NMDevice8023Ethernet * self) +nm_device_ethernet_init (NMDeviceEthernet * self) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); priv->dispose_has_run = FALSE; memset (&(priv->hw_addr), 0, sizeof (struct ether_addr)); priv->carrier = FALSE; - nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_802_3_ETHERNET); + nm_device_set_device_type (NM_DEVICE (self), NM_DEVICE_TYPE_ETHERNET); } static gboolean real_is_up (NMDevice *device) { - if (!NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device)->supplicant.mgr) + if (!NM_DEVICE_ETHERNET_GET_PRIVATE (device)->supplicant.mgr) return FALSE; return TRUE; @@ -328,7 +328,7 @@ real_is_up (NMDevice *device) static gboolean real_bring_up (NMDevice *dev) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev); priv->supplicant.mgr = nm_supplicant_manager_get (); @@ -338,7 +338,7 @@ real_bring_up (NMDevice *dev) static void real_take_down (NMDevice *dev) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev); if (priv->supplicant.mgr) { g_object_unref (priv->supplicant.mgr); @@ -364,8 +364,8 @@ real_hw_take_down (NMDevice *dev) nm_system_device_set_up_down (dev, FALSE); } -NMDevice8023Ethernet * -nm_device_802_3_ethernet_new (const char *udi, +NMDeviceEthernet * +nm_device_ethernet_new (const char *udi, const char *iface, const char *driver, gboolean managed) @@ -374,7 +374,7 @@ nm_device_802_3_ethernet_new (const char *udi, g_return_val_if_fail (iface != NULL, NULL); g_return_val_if_fail (driver != NULL, NULL); - return (NMDevice8023Ethernet *) g_object_new (NM_TYPE_DEVICE_802_3_ETHERNET, + return (NMDeviceEthernet *) g_object_new (NM_TYPE_DEVICE_ETHERNET, NM_DEVICE_INTERFACE_UDI, udi, NM_DEVICE_INTERFACE_IFACE, iface, NM_DEVICE_INTERFACE_DRIVER, driver, @@ -384,34 +384,34 @@ nm_device_802_3_ethernet_new (const char *udi, /* - * nm_device_802_3_ethernet_get_address + * nm_device_ethernet_get_address * * Get a device's hardware address * */ void -nm_device_802_3_ethernet_get_address (NMDevice8023Ethernet *self, struct ether_addr *addr) +nm_device_ethernet_get_address (NMDeviceEthernet *self, struct ether_addr *addr) { g_return_if_fail (self != NULL); g_return_if_fail (addr != NULL); - memcpy (addr, &(NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self)->hw_addr), sizeof (struct ether_addr)); + memcpy (addr, &(NM_DEVICE_ETHERNET_GET_PRIVATE (self)->hw_addr), sizeof (struct ether_addr)); } /* * Get/set functions for carrier */ gboolean -nm_device_802_3_ethernet_get_carrier (NMDevice8023Ethernet *self) +nm_device_ethernet_get_carrier (NMDeviceEthernet *self) { g_return_val_if_fail (self != NULL, FALSE); - return NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self)->carrier; + return NM_DEVICE_ETHERNET_GET_PRIVATE (self)->carrier; } /* Returns speed in Mb/s */ static guint32 -nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self) +nm_device_ethernet_get_speed (NMDeviceEthernet *self) { int fd; struct ifreq ifr; @@ -445,8 +445,8 @@ out: static void real_update_hw_address (NMDevice *dev) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (dev); - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); struct ifreq req; int ret, fd; @@ -467,7 +467,7 @@ real_update_hw_address (NMDevice *dev) if (memcmp (&priv->hw_addr, &req.ifr_hwaddr.sa_data, sizeof (struct ether_addr))) { memcpy (&priv->hw_addr, &req.ifr_hwaddr.sa_data, sizeof (struct ether_addr)); - g_object_notify (G_OBJECT (dev), NM_DEVICE_802_3_ETHERNET_HW_ADDRESS); + g_object_notify (G_OBJECT (dev), NM_DEVICE_ETHERNET_HW_ADDRESS); } out: @@ -477,7 +477,7 @@ out: static guint32 real_get_generic_capabilities (NMDevice *dev) { - NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev); + NMDeviceEthernet * self = NM_DEVICE_ETHERNET (dev); guint32 caps = NM_DEVICE_CAP_NONE; /* cipsec devices are also explicitly unsupported at this time */ @@ -495,14 +495,14 @@ real_get_generic_capabilities (NMDevice *dev) static gboolean real_can_interrupt_activation (NMDevice *dev) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (dev); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); gboolean interrupt = FALSE; /* Devices that support carrier detect can interrupt activation * if the link becomes inactive. */ if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_CARRIER_DETECT) { - if (nm_device_802_3_ethernet_get_carrier (self) == FALSE) + if (nm_device_ethernet_get_carrier (self) == FALSE) interrupt = TRUE; } return interrupt; @@ -511,10 +511,10 @@ real_can_interrupt_activation (NMDevice *dev) static gboolean real_can_activate (NMDevice *dev) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (dev); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); /* Can't do anything if there isn't a carrier */ - if (!nm_device_802_3_ethernet_get_carrier (self)) + if (!nm_device_ethernet_get_carrier (self)) return FALSE; return TRUE; @@ -525,8 +525,8 @@ real_get_best_auto_connection (NMDevice *dev, GSList *connections, char **specific_object) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (dev); - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); GSList *iter; for (iter = connections; iter; iter = g_slist_next (iter)) { @@ -567,7 +567,7 @@ real_connection_secrets_updated (NMDevice *dev, NMConnection *connection, GSList *updated_settings) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev); NMActRequest *req; gboolean valid = FALSE; GSList *iter; @@ -622,9 +622,9 @@ device_get_setting (NMDevice *device, GType setting_type) /* 802.1X */ static void -remove_supplicant_timeouts (NMDevice8023Ethernet *self) +remove_supplicant_timeouts (NMDeviceEthernet *self) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); if (priv->supplicant.con_timeout_id) { g_source_remove (priv->supplicant.con_timeout_id); @@ -638,9 +638,9 @@ remove_supplicant_timeouts (NMDevice8023Ethernet *self) } static void -remove_supplicant_interface_connection_error_handler (NMDevice8023Ethernet *self) +remove_supplicant_interface_connection_error_handler (NMDeviceEthernet *self) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); if (priv->supplicant.iface_error_id != 0) { g_signal_handler_disconnect (priv->supplicant.iface, priv->supplicant.iface_error_id); @@ -649,9 +649,9 @@ remove_supplicant_interface_connection_error_handler (NMDevice8023Ethernet *self } static void -supplicant_interface_clean (NMDevice8023Ethernet *self) +supplicant_interface_clean (NMDeviceEthernet *self) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); remove_supplicant_timeouts (self); remove_supplicant_interface_connection_error_handler (self); @@ -681,8 +681,8 @@ supplicant_interface_clean (NMDevice8023Ethernet *self) static gboolean link_timeout_cb (gpointer user_data) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (user_data); - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); NMDevice *dev = NM_DEVICE (self); NMActRequest *req; NMConnection *connection; @@ -727,13 +727,13 @@ time_out: } struct state_cb_data { - NMDevice8023Ethernet *self; + NMDeviceEthernet *self; guint32 new_state; guint32 old_state; }; static gboolean -schedule_state_handler (NMDevice8023Ethernet *self, +schedule_state_handler (NMDeviceEthernet *self, GSourceFunc handler, guint32 new_state, guint32 old_state) @@ -784,13 +784,13 @@ supplicant_mgr_state_cb (NMSupplicantInterface * iface, new_state, old_state); - schedule_state_handler (NM_DEVICE_802_3_ETHERNET (user_data), + schedule_state_handler (NM_DEVICE_ETHERNET (user_data), supplicant_mgr_state_cb_handler, new_state, old_state); } static NMSupplicantConfig * -build_supplicant_config (NMDevice8023Ethernet *self) +build_supplicant_config (NMDeviceEthernet *self) { DBusGProxy *proxy; const char *con_path; @@ -830,7 +830,7 @@ supplicant_iface_state_cb_handler (gpointer user_data) iface = nm_device_get_iface (NM_DEVICE (info->self)); config = build_supplicant_config (info->self); if (config) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (info->self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (info->self); success = nm_supplicant_interface_set_config (priv->supplicant.iface, config); g_object_unref (config); @@ -869,7 +869,7 @@ supplicant_iface_state_cb (NMSupplicantInterface * iface, new_state, old_state); - schedule_state_handler (NM_DEVICE_802_3_ETHERNET (user_data), + schedule_state_handler (NM_DEVICE_ETHERNET (user_data), supplicant_iface_state_cb_handler, new_state, old_state); @@ -895,7 +895,7 @@ supplicant_iface_connection_state_cb_handler (gpointer user_data) } } else if (info->new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED) { if (nm_device_get_state (dev) == NM_DEVICE_STATE_ACTIVATED || nm_device_is_activating (dev)) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (info->self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (info->self); /* Start the link timeout so we allow some time for reauthentication */ if (!priv->link_timeout_id) @@ -917,7 +917,7 @@ supplicant_iface_connection_state_cb (NMSupplicantInterface * iface, nm_info ("(%s) Supplicant interface state change: %d -> %d", nm_device_get_iface (NM_DEVICE (user_data)), old_state, new_state); - schedule_state_handler (NM_DEVICE_802_3_ETHERNET (user_data), + schedule_state_handler (NM_DEVICE_ETHERNET (user_data), supplicant_iface_connection_state_cb_handler, new_state, old_state); @@ -926,7 +926,7 @@ supplicant_iface_connection_state_cb (NMSupplicantInterface * iface, static gboolean supplicant_iface_connection_error_cb_handler (gpointer user_data) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (user_data); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data); supplicant_interface_clean (self); nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED); @@ -949,7 +949,7 @@ supplicant_iface_connection_error_cb (NMSupplicantInterface *iface, } static NMActStageReturn -handle_auth_or_fail (NMDevice8023Ethernet *self, +handle_auth_or_fail (NMDeviceEthernet *self, NMActRequest *req, gboolean new_secrets) { @@ -987,7 +987,7 @@ handle_auth_or_fail (NMDevice8023Ethernet *self, static gboolean supplicant_connection_timeout_cb (gpointer user_data) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (user_data); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data); NMDevice *device = NM_DEVICE (self); NMActRequest *req; const char *iface; @@ -1010,9 +1010,9 @@ supplicant_connection_timeout_cb (gpointer user_data) } static gboolean -supplicant_interface_init (NMDevice8023Ethernet *self) +supplicant_interface_init (NMDeviceEthernet *self) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); const char *iface; iface = nm_device_get_iface (NM_DEVICE (self)); @@ -1056,7 +1056,7 @@ supplicant_interface_init (NMDevice8023Ethernet *self) } static NMActStageReturn -nm_8021x_stage2_config (NMDevice8023Ethernet *self) +nm_8021x_stage2_config (NMDeviceEthernet *self) { NMConnection *connection; NMSetting8021x *security; @@ -1131,14 +1131,14 @@ ppp_ip4_config (NMPPPManager *ppp_manager, NMDevice *device = NM_DEVICE (user_data); nm_device_set_ip_iface (device, iface); - NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device)->pending_ip4_config = g_object_ref (config); + NM_DEVICE_ETHERNET_GET_PRIVATE (device)->pending_ip4_config = g_object_ref (config); nm_device_activate_schedule_stage4_ip_config_get (device); } static NMActStageReturn -pppoe_stage2_config (NMDevice8023Ethernet *self) +pppoe_stage2_config (NMDeviceEthernet *self) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); NMActRequest *req; GError *err = NULL; NMActStageReturn ret; @@ -1185,11 +1185,11 @@ real_act_stage2_config (NMDevice *device) security = (NMSetting8021x *) device_get_setting (device, NM_TYPE_SETTING_802_1X); if (security) - ret = nm_8021x_stage2_config (NM_DEVICE_802_3_ETHERNET (device)); + ret = nm_8021x_stage2_config (NM_DEVICE_ETHERNET (device)); else ret = NM_ACT_STAGE_RETURN_SUCCESS; } else if (!strcmp (s_connection->type, NM_SETTING_PPPOE_SETTING_NAME)) - ret = pppoe_stage2_config (NM_DEVICE_802_3_ETHERNET (device)); + ret = pppoe_stage2_config (NM_DEVICE_ETHERNET (device)); else { nm_warning ("Invalid connection type '%s' for ethernet device", s_connection->type); ret = NM_ACT_STAGE_RETURN_FAILURE; @@ -1201,8 +1201,8 @@ real_act_stage2_config (NMDevice *device) static NMActStageReturn real_act_stage4_get_ip4_config (NMDevice *device, NMIP4Config **config) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (device); - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); NMActStageReturn ret; g_return_val_if_fail (config != NULL, NM_ACT_STAGE_RETURN_FAILURE); @@ -1212,7 +1212,7 @@ real_act_stage4_get_ip4_config (NMDevice *device, NMIP4Config **config) /* Regular ethernet connection. */ /* Chain up to parent */ - ret = NM_DEVICE_CLASS (nm_device_802_3_ethernet_parent_class)->act_stage4_get_ip4_config (device, config); + ret = NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage4_get_ip4_config (device, config); if ((ret == NM_ACT_STAGE_RETURN_SUCCESS)) { NMConnection *connection; @@ -1240,7 +1240,7 @@ real_act_stage4_get_ip4_config (NMDevice *device, NMIP4Config **config) static void real_deactivate_quickly (NMDevice *device) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); nm_device_set_ip_iface (device, NULL); @@ -1254,7 +1254,7 @@ real_deactivate_quickly (NMDevice *device) priv->ppp_manager = NULL; } - supplicant_interface_clean (NM_DEVICE_802_3_ETHERNET (device)); + supplicant_interface_clean (NM_DEVICE_ETHERNET (device)); } static gboolean @@ -1262,8 +1262,8 @@ real_check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error) { - NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (device); - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self); + NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); NMSettingConnection *s_con; NMSettingWired *s_wired; gboolean is_pppoe = FALSE; @@ -1307,13 +1307,13 @@ real_check_connection_compatible (NMDevice *device, } static void -nm_device_802_3_ethernet_dispose (GObject *object) +nm_device_ethernet_dispose (GObject *object) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object); NMNetlinkMonitor *monitor; if (priv->dispose_has_run) { - G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object); return; } @@ -1335,36 +1335,36 @@ nm_device_802_3_ethernet_dispose (GObject *object) priv->state_to_disconnected_id = 0; } - G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object); } static void -nm_device_802_3_ethernet_finalize (GObject *object) +nm_device_ethernet_finalize (GObject *object) { - NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object); + NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object); g_free (priv->carrier_file_path); - G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_device_ethernet_parent_class)->finalize (object); } static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - NMDevice8023Ethernet *device = NM_DEVICE_802_3_ETHERNET (object); + NMDeviceEthernet *device = NM_DEVICE_ETHERNET (object); struct ether_addr hw_addr; switch (prop_id) { case PROP_HW_ADDRESS: - nm_device_802_3_ethernet_get_address (device, &hw_addr); + nm_device_ethernet_get_address (device, &hw_addr); g_value_take_string (value, nm_ether_ntop (&hw_addr)); break; case PROP_SPEED: - g_value_set_uint (value, nm_device_802_3_ethernet_get_speed (device)); + g_value_set_uint (value, nm_device_ethernet_get_speed (device)); break; case PROP_CARRIER: - g_value_set_boolean (value, nm_device_802_3_ethernet_get_carrier (device)); + g_value_set_boolean (value, nm_device_ethernet_get_carrier (device)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1374,18 +1374,18 @@ get_property (GObject *object, guint prop_id, static void -nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) +nm_device_ethernet_class_init (NMDeviceEthernetClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass); - g_type_class_add_private (object_class, sizeof (NMDevice8023EthernetPrivate)); + g_type_class_add_private (object_class, sizeof (NMDeviceEthernetPrivate)); /* virtual methods */ object_class->constructor = constructor; - object_class->dispose = nm_device_802_3_ethernet_dispose; + object_class->dispose = nm_device_ethernet_dispose; object_class->get_property = get_property; - object_class->finalize = nm_device_802_3_ethernet_finalize; + object_class->finalize = nm_device_ethernet_finalize; parent_class->get_generic_capabilities = real_get_generic_capabilities; parent_class->hw_is_up = real_hw_is_up; @@ -1408,7 +1408,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) /* properties */ g_object_class_install_property (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_802_3_ETHERNET_HW_ADDRESS, + g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS, "MAC Address", "Hardware MAC address", NULL, @@ -1416,7 +1416,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) g_object_class_install_property (object_class, PROP_SPEED, - g_param_spec_uint (NM_DEVICE_802_3_ETHERNET_SPEED, + g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "Speed", "Speed", 0, G_MAXUINT32, 0, @@ -1424,7 +1424,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) g_object_class_install_property (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_802_3_ETHERNET_CARRIER, + g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER, "Carrier", "Carrier", FALSE, @@ -1433,10 +1433,10 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) /* Signals */ signals[PROPERTIES_CHANGED] = nm_properties_changed_signal_new (object_class, - G_STRUCT_OFFSET (NMDevice8023EthernetClass, properties_changed)); + G_STRUCT_OFFSET (NMDeviceEthernetClass, properties_changed)); dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), - &dbus_glib_nm_device_802_3_ethernet_object_info); + &dbus_glib_nm_device_ethernet_object_info); dbus_g_error_domain_register (NM_ETHERNET_ERROR, NULL, NM_TYPE_ETHERNET_ERROR); } @@ -1447,7 +1447,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) /**************************************/ static gboolean -supports_ethtool_carrier_detect (NMDevice8023Ethernet *self) +supports_ethtool_carrier_detect (NMDeviceEthernet *self) { int fd; struct ifreq ifr; @@ -1487,7 +1487,7 @@ out: #undef _LINUX_IF_H static int -mdio_read (NMDevice8023Ethernet *self, int fd, struct ifreq *ifr, int location) +mdio_read (NMDeviceEthernet *self, int fd, struct ifreq *ifr, int location) { struct mii_ioctl_data *mii; int val = -1; @@ -1508,7 +1508,7 @@ mdio_read (NMDevice8023Ethernet *self, int fd, struct ifreq *ifr, int location) } static gboolean -supports_mii_carrier_detect (NMDevice8023Ethernet *self) +supports_mii_carrier_detect (NMDeviceEthernet *self) { int err, fd, bmsr; struct ifreq ifr; diff --git a/src/nm-device-ethernet.h b/src/nm-device-ethernet.h new file mode 100644 index 000000000..a05c69ce3 --- /dev/null +++ b/src/nm-device-ethernet.h @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* NetworkManager -- Network link manager + * + * Dan Williams + * + * 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_ETHERNET_H +#define NM_DEVICE_ETHERNET_H + +#include +#include + +#include "nm-device.h" + +G_BEGIN_DECLS + +#define NM_TYPE_DEVICE_ETHERNET (nm_device_ethernet_get_type ()) +#define NM_DEVICE_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernet)) +#define NM_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass)) +#define NM_IS_DEVICE_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_ETHERNET)) +#define NM_IS_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_ETHERNET)) +#define NM_DEVICE_ETHERNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass)) + +#define NM_DEVICE_ETHERNET_HW_ADDRESS "hw-address" +#define NM_DEVICE_ETHERNET_SPEED "speed" +#define NM_DEVICE_ETHERNET_CARRIER "carrier" + +typedef struct { + NMDevice parent; +} NMDeviceEthernet; + +typedef struct { + NMDeviceClass parent; + + /* Signals */ + void (*properties_changed) (NMDeviceEthernet *device, GHashTable *properties); +} NMDeviceEthernetClass; + + +GType nm_device_ethernet_get_type (void); + + +NMDeviceEthernet *nm_device_ethernet_new (const char *udi, + const char *iface, + const char *driver, + gboolean managed); + +void nm_device_ethernet_get_address (NMDeviceEthernet *dev, + struct ether_addr *addr); + +gboolean nm_device_ethernet_get_carrier (NMDeviceEthernet *dev); + +G_END_DECLS + +#endif /* NM_DEVICE_ETHERNET_H */ diff --git a/src/nm-device-interface.c b/src/nm-device-interface.c index 350c579ed..d393ab5d2 100644 --- a/src/nm-device-interface.c +++ b/src/nm-device-interface.c @@ -109,7 +109,7 @@ nm_device_interface_init (gpointer g_iface) g_param_spec_uint (NM_DEVICE_INTERFACE_DEVICE_TYPE, "DeviceType", "DeviceType", - 0, G_MAXUINT32, DEVICE_TYPE_UNKNOWN, + 0, G_MAXUINT32, NM_DEVICE_TYPE_UNKNOWN, G_PARAM_READABLE)); g_object_interface_install_property diff --git a/src/nm-device.c b/src/nm-device.c index 34749fad6..9a1ad148b 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -124,7 +124,7 @@ nm_device_init (NMDevice * self) self->priv->initialized = FALSE; self->priv->udi = NULL; self->priv->iface = NULL; - self->priv->type = DEVICE_TYPE_UNKNOWN; + self->priv->type = NM_DEVICE_TYPE_UNKNOWN; self->priv->capabilities = NM_DEVICE_CAP_NONE; self->priv->driver = NULL; @@ -274,7 +274,7 @@ nm_device_get_driver (NMDevice *self) NMDeviceType nm_device_get_device_type (NMDevice *self) { - g_return_val_if_fail (NM_IS_DEVICE (self), DEVICE_TYPE_UNKNOWN); + g_return_val_if_fail (NM_IS_DEVICE (self), NM_DEVICE_TYPE_UNKNOWN); return self->priv->type; } @@ -284,7 +284,7 @@ void nm_device_set_device_type (NMDevice *dev, NMDeviceType type) { g_return_if_fail (NM_IS_DEVICE (dev)); - g_return_if_fail (NM_DEVICE_GET_PRIVATE (dev)->type == DEVICE_TYPE_UNKNOWN); + g_return_if_fail (NM_DEVICE_GET_PRIVATE (dev)->type == NM_DEVICE_TYPE_UNKNOWN); NM_DEVICE_GET_PRIVATE (dev)->type = type; } diff --git a/src/nm-gsm-device.c b/src/nm-gsm-device.c index b237023b3..b457c3677 100644 --- a/src/nm-gsm-device.c +++ b/src/nm-gsm-device.c @@ -710,7 +710,7 @@ setup_monitor_device (NMGsmDevice *device) static void nm_gsm_device_init (NMGsmDevice *self) { - nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_GSM); + nm_device_set_device_type (NM_DEVICE (self), NM_DEVICE_TYPE_GSM); } static gboolean diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index 052f7f4f5..47c40dc09 100644 --- a/src/nm-hal-manager.c +++ b/src/nm-hal-manager.c @@ -12,7 +12,7 @@ #include "nm-dbus-manager.h" #include "nm-utils.h" #include "nm-device-802-11-wireless.h" -#include "nm-device-802-3-ethernet.h" +#include "nm-device-ethernet.h" #include "nm-gsm-device.h" #include "nm-cdma-device.h" @@ -141,7 +141,7 @@ wired_device_creator (NMHalManager *self, const char *udi, gboolean managed) } driver = nm_get_device_driver_name (priv->hal_ctx, udi); - device = (GObject *) nm_device_802_3_ethernet_new (udi, iface, driver, managed); + device = (GObject *) nm_device_ethernet_new (udi, iface, driver, managed); libhal_free_string (iface); g_free (driver); diff --git a/system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c b/system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c index 0e64d1b84..6e62b1926 100644 --- a/system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c +++ b/system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c @@ -124,26 +124,26 @@ get_ether_device_udi (DBusGConnection *g_connection, GByteArray *mac, GSList *de static NMDeviceType get_device_type_for_connection (NMConnection *connection) { - NMDeviceType devtype = DEVICE_TYPE_UNKNOWN; + NMDeviceType devtype = NM_DEVICE_TYPE_UNKNOWN; NMSettingConnection *s_con; s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); if (!s_con) - return DEVICE_TYPE_UNKNOWN; + return NM_DEVICE_TYPE_UNKNOWN; if ( !strcmp (s_con->type, NM_SETTING_WIRED_SETTING_NAME) || !strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME)) { if (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED)) - devtype = DEVICE_TYPE_802_3_ETHERNET; + devtype = NM_DEVICE_TYPE_ETHERNET; } else if (!strcmp (s_con->type, NM_SETTING_WIRELESS_SETTING_NAME)) { if (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS)) - devtype = DEVICE_TYPE_802_11_WIRELESS; + devtype = NM_DEVICE_TYPE_WIFI; } else if (!strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME)) { if (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM)) - devtype = DEVICE_TYPE_GSM; + devtype = NM_DEVICE_TYPE_GSM; } else if (!strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME)) { if (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA)) - devtype = DEVICE_TYPE_CDMA; + devtype = NM_DEVICE_TYPE_CDMA; } return devtype; @@ -160,22 +160,22 @@ get_udi_for_connection (NMConnection *connection, char *udi = NULL; GSList *devices = NULL; - if (devtype == DEVICE_TYPE_UNKNOWN) + if (devtype == NM_DEVICE_TYPE_UNKNOWN) devtype = get_device_type_for_connection (connection); switch (devtype) { - case DEVICE_TYPE_802_3_ETHERNET: + case NM_DEVICE_TYPE_ETHERNET: s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED); if (s_wired) { - devices = nm_system_config_hal_manager_get_devices_of_type (hal_mgr, DEVICE_TYPE_802_3_ETHERNET); + devices = nm_system_config_hal_manager_get_devices_of_type (hal_mgr, NM_DEVICE_TYPE_ETHERNET); udi = get_ether_device_udi (g_connection, s_wired->mac_address, devices); } break; - case DEVICE_TYPE_802_11_WIRELESS: + case NM_DEVICE_TYPE_WIFI: s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS); if (s_wireless) { - devices = nm_system_config_hal_manager_get_devices_of_type (hal_mgr, DEVICE_TYPE_802_11_WIRELESS); + devices = nm_system_config_hal_manager_get_devices_of_type (hal_mgr, NM_DEVICE_TYPE_WIFI); udi = get_ether_device_udi (g_connection, s_wireless->mac_address, devices); } break; @@ -255,7 +255,7 @@ nm_ifcfg_connection_new (const char *filename, if (!wrapped) return NULL; - udi = get_udi_for_connection (wrapped, g_connection, hal_mgr, DEVICE_TYPE_UNKNOWN); + udi = get_udi_for_connection (wrapped, g_connection, hal_mgr, NM_DEVICE_TYPE_UNKNOWN); object = (GObject *) g_object_new (NM_TYPE_IFCFG_CONNECTION, NM_IFCFG_CONNECTION_FILENAME, filename, diff --git a/system-settings/plugins/ifcfg-suse/parser.c b/system-settings/plugins/ifcfg-suse/parser.c index 276df4cd5..59de19fe4 100644 --- a/system-settings/plugins/ifcfg-suse/parser.c +++ b/system-settings/plugins/ifcfg-suse/parser.c @@ -658,10 +658,10 @@ parse_ifcfg (const char *iface, NMDeviceType type) connection = nm_connection_new (); switch (type) { - case DEVICE_TYPE_802_3_ETHERNET: + case NM_DEVICE_TYPE_ETHERNET: parse_ethernet (connection, file, iface); break; - case DEVICE_TYPE_802_11_WIRELESS: + case NM_DEVICE_TYPE_WIFI: parse_wireless (connection, file, iface); break; default: diff --git a/system-settings/plugins/ifcfg-suse/plugin.c b/system-settings/plugins/ifcfg-suse/plugin.c index da08cf19a..87cd98afb 100644 --- a/system-settings/plugins/ifcfg-suse/plugin.c +++ b/system-settings/plugins/ifcfg-suse/plugin.c @@ -232,7 +232,7 @@ device_added_cb (NMSystemConfigHalManager *hal_mgr, { SCPluginIfcfg *self = SC_PLUGIN_IFCFG (user_data); - if (dev_type != DEVICE_TYPE_802_3_ETHERNET && dev_type != DEVICE_TYPE_802_11_WIRELESS) + if (dev_type != NM_DEVICE_TYPE_ETHERNET && dev_type != NM_DEVICE_TYPE_WIFI) return; read_connection (self, udi, dev_type); @@ -248,7 +248,7 @@ device_removed_cb (NMSystemConfigHalManager *hal_mgr, SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); NMExportedConnection *exported; - if (dev_type != DEVICE_TYPE_802_3_ETHERNET && dev_type != DEVICE_TYPE_802_11_WIRELESS) + if (dev_type != NM_DEVICE_TYPE_ETHERNET && dev_type != NM_DEVICE_TYPE_WIFI) return; if (g_hash_table_remove (priv->unmanaged_devices, udi)) @@ -291,8 +291,8 @@ get_connections (NMSystemConfigInterface *config) if (!priv->initialized) { const char *filename; - read_connections_by_type (self, DEVICE_TYPE_802_3_ETHERNET); - read_connections_by_type (self, DEVICE_TYPE_802_11_WIRELESS); + read_connections_by_type (self, NM_DEVICE_TYPE_ETHERNET); + read_connections_by_type (self, NM_DEVICE_TYPE_WIFI); filename = SYSCONFDIR"/sysconfig/network/routes"; monitor_routes (self, filename); diff --git a/system-settings/src/main.c b/system-settings/src/main.c index 0d0d087e7..3d6764ed4 100644 --- a/system-settings/src/main.c +++ b/system-settings/src/main.c @@ -178,9 +178,9 @@ load_stuff (gpointer user_data) GSList *devs, *iter; /* Grab wired devices to make default DHCP connections for them if needed */ - devs = nm_system_config_hal_manager_get_devices_of_type (app->hal_mgr, DEVICE_TYPE_802_3_ETHERNET); + devs = nm_system_config_hal_manager_get_devices_of_type (app->hal_mgr, NM_DEVICE_TYPE_ETHERNET); for (iter = devs; iter; iter = g_slist_next (iter)) { - device_added_cb (NULL, (const char *) iter->data, DEVICE_TYPE_802_3_ETHERNET, app); + device_added_cb (NULL, (const char *) iter->data, NM_DEVICE_TYPE_ETHERNET, app); g_free (iter->data); } @@ -390,7 +390,7 @@ device_added_cb (DBusGProxy *proxy, const char *udi, NMDeviceType devtype, gpoin Application *app = (Application *) user_data; WiredDeviceInfo *info; - if (devtype != DEVICE_TYPE_802_3_ETHERNET) + if (devtype != NM_DEVICE_TYPE_ETHERNET) return; /* Wait for a plugin to figure out if the device should be managed or not */ diff --git a/system-settings/src/nm-system-config-hal-manager.c b/system-settings/src/nm-system-config-hal-manager.c index 686a8f090..8d43769b4 100644 --- a/system-settings/src/nm-system-config-hal-manager.c +++ b/system-settings/src/nm-system-config-hal-manager.c @@ -29,7 +29,7 @@ NMSystemConfigHalManager *nm_system_config_hal_manager_get (DBusGConnection *g_connection); -#define NUM_DEVICE_TYPES DEVICE_TYPE_CDMA +#define NUM_DEVICE_TYPES NM_DEVICE_TYPE_CDMA typedef struct { DBusGConnection *g_connection; @@ -56,7 +56,7 @@ static NMDeviceType get_type_for_udi (NMSystemConfigHalManager *manager, const char *udi) { NMSystemConfigHalManagerPrivate *priv = NM_SYSTEM_CONFIG_HAL_MANAGER_GET_PRIVATE (manager); - NMDeviceType devtype = DEVICE_TYPE_UNKNOWN; + NMDeviceType devtype = NM_DEVICE_TYPE_UNKNOWN; DBusGProxy *dev_proxy; GError *error = NULL; GSList *capabilities = NULL, *iter; @@ -66,7 +66,7 @@ get_type_for_udi (NMSystemConfigHalManager *manager, const char *udi) udi, "org.freedesktop.Hal.Device"); if (!dev_proxy) - return DEVICE_TYPE_UNKNOWN; + return NM_DEVICE_TYPE_UNKNOWN; if (!dbus_g_proxy_call_with_timeout (dev_proxy, "GetPropertyStringList", 10000, &error, @@ -79,11 +79,11 @@ get_type_for_udi (NMSystemConfigHalManager *manager, const char *udi) if (!g_slist_length (capabilities)) goto out; - for (iter = capabilities; iter && (devtype == DEVICE_TYPE_UNKNOWN); iter = g_slist_next (iter)) { + for (iter = capabilities; iter && (devtype == NM_DEVICE_TYPE_UNKNOWN); iter = g_slist_next (iter)) { if (!strcmp (iter->data, "net.80203")) - devtype = DEVICE_TYPE_802_3_ETHERNET; + devtype = NM_DEVICE_TYPE_ETHERNET; else if (!strcmp (iter->data, "net.80211")) - devtype = DEVICE_TYPE_802_11_WIRELESS; + devtype = NM_DEVICE_TYPE_WIFI; else if (!strcmp (iter->data, "modem")) { GSList *csets = NULL, *elt; @@ -91,11 +91,11 @@ get_type_for_udi (NMSystemConfigHalManager *manager, const char *udi) "GetPropertyStringList", 10000, &error, G_TYPE_STRING, "modem.command_sets", G_TYPE_INVALID, DBUS_TYPE_G_LIST_OF_STRING, &csets, G_TYPE_INVALID)) { - for (elt = csets; elt && (devtype == DEVICE_TYPE_UNKNOWN); elt = g_slist_next (elt)) { + for (elt = csets; elt && (devtype == NM_DEVICE_TYPE_UNKNOWN); elt = g_slist_next (elt)) { if (!strcmp (elt->data, "GSM-07.07")) - devtype = DEVICE_TYPE_GSM; + devtype = NM_DEVICE_TYPE_GSM; else if (!strcmp (elt->data, "IS-707-A")) - devtype = DEVICE_TYPE_CDMA; + devtype = NM_DEVICE_TYPE_CDMA; } g_slist_foreach (csets, (GFunc) g_free, NULL); @@ -120,7 +120,7 @@ device_added_cb (DBusGProxy *proxy, const char *udi, gpointer user_data) if (!g_hash_table_lookup (priv->devices, udi)) { devtype = get_type_for_udi (manager, udi); - if (devtype != DEVICE_TYPE_UNKNOWN) { + if (devtype != NM_DEVICE_TYPE_UNKNOWN) { g_hash_table_insert (priv->devices, g_strdup (udi), GUINT_TO_POINTER (devtype)); g_signal_emit (manager, signals[DEVICE_ADDED], 0, udi, devtype); } @@ -135,7 +135,7 @@ device_removed_cb (DBusGProxy *proxy, const char *udi, gpointer user_data) NMDeviceType devtype; devtype = GPOINTER_TO_UINT (g_hash_table_lookup (priv->devices, udi)); - if (devtype != DEVICE_TYPE_UNKNOWN) { + if (devtype != NM_DEVICE_TYPE_UNKNOWN) { g_signal_emit (manager, signals[DEVICE_REMOVED], 0, udi, devtype); g_hash_table_remove (priv->devices, udi); } @@ -153,7 +153,7 @@ device_new_capability_cb (DBusGProxy *proxy, if (!g_hash_table_lookup (priv->devices, udi)) { devtype = get_type_for_udi (manager, udi); - if (devtype != DEVICE_TYPE_UNKNOWN) { + if (devtype != NM_DEVICE_TYPE_UNKNOWN) { g_hash_table_insert (priv->devices, g_strdup (udi), GUINT_TO_POINTER (devtype)); g_signal_emit (manager, signals[DEVICE_ADDED], 0, udi, devtype); } @@ -363,8 +363,8 @@ nm_system_config_hal_manager_get_type_for_udi (NMSystemConfigHalManager *manager { NMSystemConfigHalManagerPrivate *priv; - g_return_val_if_fail (NM_IS_SYSTEM_CONFIG_HAL_MANAGER (manager), DEVICE_TYPE_UNKNOWN); - g_return_val_if_fail (udi != NULL, DEVICE_TYPE_UNKNOWN); + g_return_val_if_fail (NM_IS_SYSTEM_CONFIG_HAL_MANAGER (manager), NM_DEVICE_TYPE_UNKNOWN); + g_return_val_if_fail (udi != NULL, NM_DEVICE_TYPE_UNKNOWN); priv = NM_SYSTEM_CONFIG_HAL_MANAGER_GET_PRIVATE (manager); return GPOINTER_TO_UINT (g_hash_table_lookup (priv->devices, udi)); diff --git a/test/nm-tool.c b/test/nm-tool.c index 4dfe2a89e..495e32043 100644 --- a/test/nm-tool.c +++ b/test/nm-tool.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include @@ -213,7 +213,7 @@ detail_device (gpointer data, gpointer user_data) nm_device_get_iface (device)); /* General information */ - if (NM_IS_DEVICE_802_3_ETHERNET (device)) + if (NM_IS_DEVICE_ETHERNET (device)) print_string ("Type", "Wired"); else if (NM_IS_DEVICE_802_11_WIRELESS (device)) print_string ("Type", "802.11 Wireless"); @@ -243,8 +243,8 @@ detail_device (gpointer data, gpointer user_data) } tmp = NULL; - if (NM_IS_DEVICE_802_3_ETHERNET (device)) - tmp = g_strdup (nm_device_802_3_ethernet_get_hw_address (NM_DEVICE_802_3_ETHERNET (device))); + if (NM_IS_DEVICE_ETHERNET (device)) + tmp = g_strdup (nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (device))); else if (NM_IS_DEVICE_802_11_WIRELESS (device)) tmp = g_strdup (nm_device_802_11_wireless_get_hw_address (NM_DEVICE_802_11_WIRELESS (device))); @@ -264,13 +264,13 @@ detail_device (gpointer data, gpointer user_data) print_string (" Carrier Detect", "yes"); speed = 0; - if (NM_IS_DEVICE_802_3_ETHERNET (device)) { + if (NM_IS_DEVICE_ETHERNET (device)) { /* Speed in Mb/s */ - speed = nm_device_802_3_ethernet_get_speed (NM_DEVICE_802_3_ETHERNET (device)); + speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (device)); } else if (NM_IS_DEVICE_802_11_WIRELESS (device)) { /* Speed in b/s */ speed = nm_device_802_11_wireless_get_bitrate (NM_DEVICE_802_11_WIRELESS (device)); - speed /= 1000000; + speed /= 1000; } if (speed) { @@ -309,7 +309,7 @@ detail_device (gpointer data, gpointer user_data) aps = nm_device_802_11_wireless_get_access_points (NM_DEVICE_802_11_WIRELESS (device)); if (aps && aps->len) g_ptr_array_foreach ((GPtrArray *) aps, detail_access_point, (gpointer) active_bssid); - } else if (NM_IS_DEVICE_802_3_ETHERNET (device)) { + } else if (NM_IS_DEVICE_ETHERNET (device)) { printf ("\n Wired Settings\n"); /* FIXME */ #if 0 diff --git a/test/nmtestdevices.c b/test/nmtestdevices.c index dffe12c73..17deed96b 100644 --- a/test/nmtestdevices.c +++ b/test/nmtestdevices.c @@ -38,7 +38,7 @@ static void create_device (DBusConnection *connection, NMDeviceType type) char *string; g_return_if_fail (connection != NULL); - g_return_if_fail (((type == DEVICE_TYPE_802_3_ETHERNET) || (type == DEVICE_TYPE_802_11_WIRELESS))); + g_return_if_fail (((type == NM_DEVICE_TYPE_ETHERNET) || (type == NM_DEVICE_TYPE_WIFI))); message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "createTestDevice"); if (message == NULL) @@ -189,7 +189,7 @@ int main( int argc, char *argv[] ) gboolean destroy = FALSE; gboolean make_link_active = FALSE; gboolean make_link_inactive = FALSE; - NMDeviceType dev_type = DEVICE_TYPE_UNKNOWN; + NMDeviceType dev_type = NM_DEVICE_TYPE_UNKNOWN; if (argc < 2) { print_usage (); @@ -231,9 +231,9 @@ int main( int argc, char *argv[] ) if (optarg) { if (strcmp (optarg, "wired") == 0) - dev_type = DEVICE_TYPE_802_3_ETHERNET; + dev_type = NM_DEVICE_TYPE_ETHERNET; else if (strcmp (optarg, "wireless") == 0) - dev_type = DEVICE_TYPE_802_11_WIRELESS; + dev_type = NM_DEVICE_TYPE_WIFI; } } else if (strcmp (opt, "remove-device") == 0)