device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-util / nm-setting-wireless.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
3 /*
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301 USA.
18  *
19  * Copyright 2007 - 2014 Red Hat, Inc.
20  * Copyright 2007 - 2008 Novell, Inc.
21  */
22
23 #ifndef NM_SETTING_WIRELESS_H
24 #define NM_SETTING_WIRELESS_H
25
26 #include <NetworkManager.h>
27 #include <nm-setting.h>
28 #include <nm-setting-wireless-security.h>
29
30 G_BEGIN_DECLS
31
32 #define NM_TYPE_SETTING_WIRELESS            (nm_setting_wireless_get_type ())
33 #define NM_SETTING_WIRELESS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_WIRELESS, NMSettingWireless))
34 #define NM_SETTING_WIRELESS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_WIRELESS, NMSettingWirelessClass))
35 #define NM_IS_SETTING_WIRELESS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_WIRELESS))
36 #define NM_IS_SETTING_WIRELESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_WIRELESS))
37 #define NM_SETTING_WIRELESS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_WIRELESS, NMSettingWirelessClass))
38
39 #define NM_SETTING_WIRELESS_SETTING_NAME "802-11-wireless"
40
41 /**
42  * NMSettingWirelessError:
43  * @NM_SETTING_WIRELESS_ERROR_UNKNOWN: unknown or unclassified error
44  * @NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY: the property was invalid
45  * @NM_SETTING_WIRELESS_ERROR_MISSING_PROPERTY: the property was missing and is
46  * required
47  * @NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING: property values require
48  * the presence of an #NMSettingWirelessSecurity object in the connection
49  * @NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND: the property channel was
50  * set to a value that requires the #NMSettingWireless:band property to be set
51  */
52 typedef enum {
53         NM_SETTING_WIRELESS_ERROR_UNKNOWN = 0,              /*< nick=UnknownError >*/
54         NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY,         /*< nick=InvalidProperty >*/
55         NM_SETTING_WIRELESS_ERROR_MISSING_PROPERTY,         /*< nick=MissingProperty >*/
56         NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING, /*< nick=MissingSecuritySetting >*/
57         NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND     /*< nick=ChannelRequiresBand >*/
58 } NMSettingWirelessError;
59
60 #define NM_SETTING_WIRELESS_ERROR nm_setting_wireless_error_quark ()
61 GQuark nm_setting_wireless_error_quark (void);
62
63 #define NM_SETTING_WIRELESS_SSID        "ssid"
64 #define NM_SETTING_WIRELESS_MODE        "mode"
65 #define NM_SETTING_WIRELESS_BAND        "band"
66 #define NM_SETTING_WIRELESS_CHANNEL     "channel"
67 #define NM_SETTING_WIRELESS_BSSID       "bssid"
68 #define NM_SETTING_WIRELESS_RATE        "rate"
69 #define NM_SETTING_WIRELESS_TX_POWER    "tx-power"
70 #define NM_SETTING_WIRELESS_MAC_ADDRESS "mac-address"
71 #define NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS "cloned-mac-address"
72 #define NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST "mac-address-blacklist"
73 #define NM_SETTING_WIRELESS_MTU         "mtu"
74 #define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids"
75 #define NM_SETTING_WIRELESS_HIDDEN      "hidden"
76 #define NM_SETTING_WIRELESS_POWERSAVE   "powersave"
77
78 /* Deprecated */
79 #define NM_SETTING_WIRELESS_SEC         "security"
80
81 /**
82  * NM_SETTING_WIRELESS_MODE_ADHOC:
83  *
84  * Indicates Ad-Hoc mode where no access point is expected to be present.
85  */
86 #define NM_SETTING_WIRELESS_MODE_ADHOC  "adhoc"
87
88 /**
89  * NM_SETTING_WIRELESS_MODE_AP:
90  *
91  * Indicates AP/master mode where the wireless device is started as an access
92  * point/hotspot.
93  *
94  * Since: 0.9.8
95  */
96 #define NM_SETTING_WIRELESS_MODE_AP     "ap"
97
98 /**
99  * NM_SETTING_WIRELESS_MODE_INFRA:
100  *
101  * Indicates infrastructure mode where an access point is expected to be present
102  * for this connection.
103  */
104 #define NM_SETTING_WIRELESS_MODE_INFRA  "infrastructure"
105
106 typedef struct {
107         NMSetting parent;
108 } NMSettingWireless;
109
110 typedef struct {
111         NMSettingClass parent;
112
113         /* Padding for future expansion */
114         void (*_reserved1) (void);
115         void (*_reserved2) (void);
116         void (*_reserved3) (void);
117         void (*_reserved4) (void);
118 } NMSettingWirelessClass;
119
120 GType nm_setting_wireless_get_type (void);
121
122 NMSetting *nm_setting_wireless_new (void);
123
124 const GByteArray *nm_setting_wireless_get_ssid               (NMSettingWireless *setting);
125 const char       *nm_setting_wireless_get_mode               (NMSettingWireless *setting);
126 const char       *nm_setting_wireless_get_band               (NMSettingWireless *setting);
127 guint32           nm_setting_wireless_get_channel            (NMSettingWireless *setting);
128 const GByteArray *nm_setting_wireless_get_bssid              (NMSettingWireless *setting);
129 guint32           nm_setting_wireless_get_rate               (NMSettingWireless *setting);
130 guint32           nm_setting_wireless_get_tx_power           (NMSettingWireless *setting);
131 const GByteArray *nm_setting_wireless_get_mac_address        (NMSettingWireless *setting);
132 const GByteArray *nm_setting_wireless_get_cloned_mac_address (NMSettingWireless *setting);
133
134 const GSList     *nm_setting_wireless_get_mac_address_blacklist   (NMSettingWireless *setting);
135 NM_AVAILABLE_IN_0_9_10
136 guint32           nm_setting_wireless_get_num_mac_blacklist_items (NMSettingWireless *setting);
137 NM_AVAILABLE_IN_0_9_10
138 const char *      nm_setting_wireless_get_mac_blacklist_item      (NMSettingWireless *setting,
139                                                                    guint32 idx);
140 NM_AVAILABLE_IN_0_9_10
141 gboolean          nm_setting_wireless_add_mac_blacklist_item      (NMSettingWireless *setting,
142                                                                    const char *mac);
143 NM_AVAILABLE_IN_0_9_10
144 void              nm_setting_wireless_remove_mac_blacklist_item   (NMSettingWireless *setting,
145                                                                    guint32 idx);
146 NM_AVAILABLE_IN_0_9_10
147 gboolean          nm_setting_wireless_remove_mac_blacklist_item_by_value (NMSettingWireless *setting,
148                                                                           const char *mac);
149 NM_AVAILABLE_IN_0_9_10
150 void              nm_setting_wireless_clear_mac_blacklist_items   (NMSettingWireless *setting);
151
152 guint32           nm_setting_wireless_get_mtu                (NMSettingWireless *setting);
153 gboolean          nm_setting_wireless_get_hidden             (NMSettingWireless *setting);
154 NM_AVAILABLE_IN_1_2
155 guint32           nm_setting_wireless_get_powersave          (NMSettingWireless *setting);
156
157 gboolean          nm_setting_wireless_add_seen_bssid         (NMSettingWireless *setting,
158                                                               const char *bssid);
159
160 guint32           nm_setting_wireless_get_num_seen_bssids    (NMSettingWireless *setting);
161 const char       *nm_setting_wireless_get_seen_bssid         (NMSettingWireless *setting,
162                                                               guint32 i);
163
164 gboolean          nm_setting_wireless_ap_security_compatible (NMSettingWireless *s_wireless,
165                                                               NMSettingWirelessSecurity *s_wireless_sec,
166                                                               NM80211ApFlags ap_flags,
167                                                               NM80211ApSecurityFlags ap_wpa,
168                                                               NM80211ApSecurityFlags ap_rsn,
169                                                               NM80211Mode ap_mode);
170
171 /* Deprecated */
172 NM_DEPRECATED_IN_0_9_10
173 const char *nm_setting_wireless_get_security (NMSettingWireless *setting);
174
175 G_END_DECLS
176
177 #endif /* NM_SETTING_WIRELESS_H */