2007-02-12 09:23:43 +00:00
|
|
|
#include "nm-device-802-3-ethernet.h"
|
|
|
|
#include "nm-device-private.h"
|
|
|
|
|
|
|
|
#include "nm-device-802-3-ethernet-bindings.h"
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (NMDevice8023Ethernet, nm_device_802_3_ethernet, NM_TYPE_DEVICE)
|
|
|
|
|
2007-03-16 09:37:53 +00:00
|
|
|
#define NM_DEVICE_802_3_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetPrivate))
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
DBusGProxy *ethernet_proxy;
|
|
|
|
|
|
|
|
gboolean disposed;
|
|
|
|
} NMDevice8023EthernetPrivate;
|
|
|
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
static void
|
|
|
|
nm_device_802_3_ethernet_init (NMDevice8023Ethernet *device)
|
|
|
|
{
|
2007-03-16 09:37:53 +00:00
|
|
|
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device);
|
|
|
|
|
|
|
|
priv->disposed = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GObject*
|
|
|
|
constructor (GType type,
|
|
|
|
guint n_construct_params,
|
|
|
|
GObjectConstructParam *construct_params)
|
|
|
|
{
|
|
|
|
GObject *object;
|
|
|
|
NMDevice8023EthernetPrivate *priv;
|
|
|
|
|
|
|
|
object = G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->constructor (type,
|
|
|
|
n_construct_params,
|
|
|
|
construct_params);
|
|
|
|
if (!object)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object);
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
priv->ethernet_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
|
2007-03-16 09:37:53 +00:00
|
|
|
NM_DBUS_SERVICE,
|
2007-06-22 15:09:02 +00:00
|
|
|
nm_object_get_path (NM_OBJECT (object)),
|
2007-03-16 09:37:53 +00:00
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRED);
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dispose (GObject *object)
|
|
|
|
{
|
|
|
|
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object);
|
|
|
|
|
2007-12-07 15:32:45 +00:00
|
|
|
if (priv->disposed) {
|
|
|
|
G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object);
|
2007-03-16 09:37:53 +00:00
|
|
|
return;
|
2007-12-07 15:32:45 +00:00
|
|
|
}
|
2007-03-16 09:37:53 +00:00
|
|
|
|
|
|
|
priv->disposed = TRUE;
|
|
|
|
|
|
|
|
g_object_unref (priv->ethernet_proxy);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object);
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *device_class)
|
|
|
|
{
|
2007-03-16 09:37:53 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (device_class);
|
|
|
|
|
|
|
|
g_type_class_add_private (device_class, sizeof (NMDevice8023EthernetPrivate));
|
|
|
|
|
|
|
|
/* virtual methods */
|
|
|
|
object_class->constructor = constructor;
|
|
|
|
object_class->dispose = dispose;
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NMDevice8023Ethernet *
|
|
|
|
nm_device_802_3_ethernet_new (DBusGConnection *connection, const char *path)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
|
|
return (NMDevice8023Ethernet *) g_object_new (NM_TYPE_DEVICE_802_3_ETHERNET,
|
2007-06-22 15:09:02 +00:00
|
|
|
NM_OBJECT_CONNECTION, connection,
|
|
|
|
NM_OBJECT_PATH, path,
|
2007-02-12 09:23:43 +00:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-10-27 02:58:32 +00:00
|
|
|
guint32
|
2007-02-12 09:23:43 +00:00
|
|
|
nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *device)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_3_ETHERNET (device), 0);
|
|
|
|
|
2007-10-27 02:58:32 +00:00
|
|
|
return nm_object_get_uint_property (NM_OBJECT (device), NM_DBUS_INTERFACE_DEVICE_WIRED, "Speed");
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2007-02-16 11:23:49 +00:00
|
|
|
nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device)
|
2007-02-12 09:23:43 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_3_ETHERNET (device), NULL);
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
return nm_object_get_string_property (NM_OBJECT (device), NM_DBUS_INTERFACE_DEVICE_WIRED, "HwAddress");
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|