device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-glib / nm-device-wifi.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301 USA.
17  *
18  * Copyright 2007 - 2008 Novell, Inc.
19  * Copyright 2007 - 2012 Red Hat, Inc.
20  */
21
22 #ifndef NM_DEVICE_WIFI_H
23 #define NM_DEVICE_WIFI_H
24
25 #include "nm-device.h"
26 #include "nm-access-point.h"
27
28 G_BEGIN_DECLS
29
30 #define NM_TYPE_DEVICE_WIFI            (nm_device_wifi_get_type ())
31 #define NM_DEVICE_WIFI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_WIFI, NMDeviceWifi))
32 #define NM_DEVICE_WIFI_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_WIFI, NMDeviceWifiClass))
33 #define NM_IS_DEVICE_WIFI(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_WIFI))
34 #define NM_IS_DEVICE_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIFI))
35 #define NM_DEVICE_WIFI_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIFI, NMDeviceWifiClass))
36
37 /**
38  * NMDeviceWifiError:
39  * @NM_DEVICE_WIFI_ERROR_UNKNOWN: unknown or unclassified error
40  * @NM_DEVICE_WIFI_ERROR_NOT_WIFI_CONNECTION: the connection was not of Wi-Fi type
41  * @NM_DEVICE_WIFI_ERROR_INVALID_WIFI_CONNECTION: the Wi-Fi connection was invalid
42  * @NM_DEVICE_WIFI_ERROR_INVALID_DEVICE_MAC: the device's MAC was invalid
43  * @NM_DEVICE_WIFI_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
44  * @NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_WPA_CAPS: the device missed WPA capabilities
45  * required by the connection
46  * @NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_RSN_CAPS: the device missed RSN capabilities
47  * required by the connection
48  */
49 typedef enum {
50         NM_DEVICE_WIFI_ERROR_UNKNOWN = 0,             /*< nick=UnknownError >*/
51         NM_DEVICE_WIFI_ERROR_NOT_WIFI_CONNECTION,     /*< nick=NotWifiConnection >*/
52         NM_DEVICE_WIFI_ERROR_INVALID_WIFI_CONNECTION, /*< nick=InvalidWifiConnection >*/
53         NM_DEVICE_WIFI_ERROR_INVALID_DEVICE_MAC,      /*< nick=InvalidDeviceMac >*/
54         NM_DEVICE_WIFI_ERROR_MAC_MISMATCH,            /*< nick=MacMismatch >*/
55         NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_WPA_CAPS, /*< nick=MissingDeviceWpaCaps >*/
56         NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_RSN_CAPS, /*< nick=MissingDeviceRsnCaps >*/
57 } NMDeviceWifiError;
58
59 #define NM_DEVICE_WIFI_ERROR nm_device_wifi_error_quark ()
60 GQuark nm_device_wifi_error_quark (void);
61
62 #define NM_DEVICE_WIFI_HW_ADDRESS          "hw-address"
63 #define NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS "perm-hw-address"
64 #define NM_DEVICE_WIFI_MODE                "mode"
65 #define NM_DEVICE_WIFI_BITRATE             "bitrate"
66 #define NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT "active-access-point"
67 #define NM_DEVICE_WIFI_CAPABILITIES        "wireless-capabilities"
68 #define NM_DEVICE_WIFI_ACCESS_POINTS       "access-points"
69
70 typedef struct {
71         NMDevice parent;
72 } NMDeviceWifi;
73
74 typedef struct {
75         NMDeviceClass parent;
76
77         /* Signals */
78         void (*access_point_added) (NMDeviceWifi *device, NMAccessPoint *ap);
79         void (*access_point_removed) (NMDeviceWifi *device, NMAccessPoint *ap);
80
81         /* Padding for future expansion */
82         void (*_reserved1) (void);
83         void (*_reserved2) (void);
84         void (*_reserved3) (void);
85         void (*_reserved4) (void);
86         void (*_reserved5) (void);
87         void (*_reserved6) (void);
88 } NMDeviceWifiClass;
89
90 GType nm_device_wifi_get_type (void);
91
92 GObject *nm_device_wifi_new (DBusGConnection *connection, const char *path);
93
94 const char *             nm_device_wifi_get_hw_address           (NMDeviceWifi *device);
95 const char *             nm_device_wifi_get_permanent_hw_address (NMDeviceWifi *device);
96 NM80211Mode              nm_device_wifi_get_mode                 (NMDeviceWifi *device);
97 guint32                  nm_device_wifi_get_bitrate              (NMDeviceWifi *device);
98 NMDeviceWifiCapabilities nm_device_wifi_get_capabilities         (NMDeviceWifi *device);
99 NMAccessPoint *          nm_device_wifi_get_active_access_point  (NMDeviceWifi *device);
100
101 NMAccessPoint *          nm_device_wifi_get_access_point_by_path (NMDeviceWifi *device,
102                                                                   const char *path);
103
104 const GPtrArray *        nm_device_wifi_get_access_points        (NMDeviceWifi *device);
105
106 typedef void             (*NMDeviceWifiRequestScanFn)            (NMDeviceWifi *device,
107                                                                   GError *error,
108                                                                   gpointer user_data);
109 void                     nm_device_wifi_request_scan_simple      (NMDeviceWifi *device,
110                                                                   NMDeviceWifiRequestScanFn callback,
111                                                                   gpointer user_data);
112
113 G_END_DECLS
114
115 #endif /* NM_DEVICE_WIFI_H */