/* nm-device.h - * * Copyright 2007 OpenMoko, Inc. * Authored by Chia-I Wu * * Based on libnm-glib by: Dan Williams * Copyright 2005 Red Hat, Inc. * * 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. */ #ifndef NM_DEVICE_H #define NM_DEVICE_H #include #include #include #include "NetworkManager.h" #include 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 ((obj), NM_TYPE_DEVICE)) #define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass)) typedef enum { NM_DEVICE_STATE_UNKNOWN = 0, NM_DEVICE_STATE_DOWN, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_PREPARE, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_CANCELLED, } NMDeviceState; typedef struct { GObject parent; gpointer client; /* hack for client pointer */ /* device */ NMDeviceState state; /* properties */ gchar *op; gchar *iface; guint type; gchar *udi; gboolean active; NMActStage act_stage; gchar *ip4_address; gchar *subnetmask; gchar *broadcast; gchar *hw_addr; gchar *route; gchar *primary_dns; gchar *secondary_dns; guint mode; gint strength; gboolean link_active; gint speed; guint caps; guint type_caps; gchar *active_network_path; gchar **networks; } NMDevice; typedef struct { GObjectClass parent; /* Signals */ void (*state_changed) (NMDevice *device, NMDeviceState state); /* wireless */ void (*access_point_added) (NMDevice *device, DiversityAp *ap); void (*access_point_removed) (NMDevice *device, DiversityAp *ap); } NMDeviceClass; GType nm_device_get_type (void); NMDevice *nm_device_new (DBusGConnection *connection, const char *path); DiversityAp *nm_device_get_active_access_point(NMDevice *device); GSList * nm_device_get_access_points (NMDevice *device); void nm_device_deactivate (NMDevice *device); void nm_device_replace_ap(NMDevice *dev, DiversityAp *src, DiversityAp *dst); G_END_DECLS #endif /* NM_DEVICE_H */