1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2007 - 2014 Red Hat, Inc.
4 * Copyright (C) 2007 - 2008 Novell, Inc.
5 */
6
7#ifndef __NM_SETTING_WIRELESS_H__
8#define __NM_SETTING_WIRELESS_H__
9
10#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
11#error "Only <NetworkManager.h> can be included directly."
12#endif
13
14#include "nm-setting.h"
15#include "nm-setting-wireless-security.h"
16
17G_BEGIN_DECLS
18
19#define NM_TYPE_SETTING_WIRELESS (nm_setting_wireless_get_type())
20#define NM_SETTING_WIRELESS(obj) \
21 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_WIRELESS, NMSettingWireless))
22#define NM_SETTING_WIRELESS_CLASS(klass) \
23 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_WIRELESS, NMSettingWirelessClass))
24#define NM_IS_SETTING_WIRELESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_WIRELESS))
25#define NM_IS_SETTING_WIRELESS_CLASS(klass) \
26 (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_WIRELESS))
27#define NM_SETTING_WIRELESS_GET_CLASS(obj) \
28 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_WIRELESS, NMSettingWirelessClass))
29
30#define NM_SETTING_WIRELESS_SETTING_NAME "802-11-wireless"
31
32/**
33 * NMSettingWirelessWakeOnWLan:
34 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE: Wake-on-WLAN disabled
35 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY: Wake on any activity
36 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT: Wake on disconnect
37 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC: Wake on magic packet
38 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE: Wake on GTK rekey failure
39 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST: Wake on EAP identity request
40 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE: Wake on 4way handshake
41 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE: Wake on rfkill release
42 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL: Wake on all events. This does not
43 * include the exclusive flags @NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT or
44 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE.
45 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT: Use the default value
46 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE: Don't change configured settings
47 * @NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS: Mask of flags that are
48 * incompatible with other flags
49 *
50 * Options for #NMSettingWireless:wake-on-wlan. Note that not all options
51 * are supported by all devices.
52 *
53 * Since: 1.12
54 */
55/* clang-format off */
56typedef enum { /*< flags >*/
57 NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE = 0, /*< skip >*/
58 NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY = 0x2,
59 NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT = 0x4,
60 NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC = 0x8,
61 NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE = 0x10,
62 NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST = 0x20,
63 NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE = 0x40,
64 NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE = 0x80,
65 NM_SETTING_WIRELESS_WAKE_ON_WLAN_TCP = 0x100,
66
67 NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL = 0x1FE,
68
69 NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT = 0x1,
70 NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE = 0x8000,
71
72 NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT | NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE, /*< skip >*/
73} NMSettingWirelessWakeOnWLan;
74/* clang-format on */
75
76#define NM_SETTING_WIRELESS_SSID "ssid"
77#define NM_SETTING_WIRELESS_MODE "mode"
78#define NM_SETTING_WIRELESS_BAND "band"
79#define NM_SETTING_WIRELESS_CHANNEL "channel"
80#define NM_SETTING_WIRELESS_BSSID "bssid"
81#define NM_SETTING_WIRELESS_RATE "rate"
82#define NM_SETTING_WIRELESS_TX_POWER "tx-power"
83#define NM_SETTING_WIRELESS_MAC_ADDRESS "mac-address"
84#define NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS "cloned-mac-address"
85#define NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK "generate-mac-address-mask"
86#define NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST "mac-address-blacklist"
87#define NM_SETTING_WIRELESS_MTU "mtu"
88#define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids"
89#define NM_SETTING_WIRELESS_HIDDEN "hidden"
90#define NM_SETTING_WIRELESS_POWERSAVE "powersave"
91#define NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION "mac-address-randomization"
92#define NM_SETTING_WIRELESS_WAKE_ON_WLAN "wake-on-wlan"
93#define NM_SETTING_WIRELESS_AP_ISOLATION "ap-isolation"
94
95/**
96 * NM_SETTING_WIRELESS_MODE_ADHOC:
97 *
98 * Indicates Ad-Hoc mode where no access point is expected to be present.
99 */
100#define NM_SETTING_WIRELESS_MODE_ADHOC "adhoc"
101
102/**
103 * NM_SETTING_WIRELESS_MODE_AP:
104 *
105 * Indicates AP/master mode where the wireless device is started as an access
106 * point/hotspot.
107 */
108#define NM_SETTING_WIRELESS_MODE_AP "ap"
109
110/**
111 * NM_SETTING_WIRELESS_MODE_INFRA:
112 *
113 * Indicates infrastructure mode where an access point is expected to be present
114 * for this connection.
115 */
116#define NM_SETTING_WIRELESS_MODE_INFRA "infrastructure"
117
118/**
119 * NM_SETTING_WIRELESS_MODE_MESH:
120 *
121 * Indicates that the connection should create a mesh point.
122 *
123 * Since: 1.20
124 */
125#define NM_SETTING_WIRELESS_MODE_MESH "mesh"
126
127/**
128 * NMSettingWirelessPowersave:
129 * @NM_SETTING_WIRELESS_POWERSAVE_DEFAULT: use the default value
130 * @NM_SETTING_WIRELESS_POWERSAVE_IGNORE: don't touch existing setting
131 * @NM_SETTING_WIRELESS_POWERSAVE_DISABLE: disable powersave
132 * @NM_SETTING_WIRELESS_POWERSAVE_ENABLE: enable powersave
133 *
134 * These flags indicate whether wireless powersave must be enabled.
135 **/
136typedef enum {
137 NM_SETTING_WIRELESS_POWERSAVE_DEFAULT = 0,
138 NM_SETTING_WIRELESS_POWERSAVE_IGNORE = 1,
139 NM_SETTING_WIRELESS_POWERSAVE_DISABLE = 2,
140 NM_SETTING_WIRELESS_POWERSAVE_ENABLE = 3,
141 _NM_SETTING_WIRELESS_POWERSAVE_NUM, /*< skip >*/
142 NM_SETTING_WIRELESS_POWERSAVE_LAST = _NM_SETTING_WIRELESS_POWERSAVE_NUM - 1, /*< skip >*/
143} NMSettingWirelessPowersave;
144
145typedef struct _NMSettingWirelessClass NMSettingWirelessClass;
146
147GType nm_setting_wireless_get_type(void);
148
149NMSetting *nm_setting_wireless_new(void);
150
151GBytes *nm_setting_wireless_get_ssid(NMSettingWireless *setting);
152const char *nm_setting_wireless_get_mode(NMSettingWireless *setting);
153const char *nm_setting_wireless_get_band(NMSettingWireless *setting);
154guint32 nm_setting_wireless_get_channel(NMSettingWireless *setting);
155const char *nm_setting_wireless_get_bssid(NMSettingWireless *setting);
156guint32 nm_setting_wireless_get_rate(NMSettingWireless *setting);
157guint32 nm_setting_wireless_get_tx_power(NMSettingWireless *setting);
158const char *nm_setting_wireless_get_mac_address(NMSettingWireless *setting);
159const char *nm_setting_wireless_get_cloned_mac_address(NMSettingWireless *setting);
160
161NM_AVAILABLE_IN_1_4
162const char *nm_setting_wireless_get_generate_mac_address_mask(NMSettingWireless *setting);
163
164const char *const *nm_setting_wireless_get_mac_address_blacklist(NMSettingWireless *setting);
165guint32 nm_setting_wireless_get_num_mac_blacklist_items(NMSettingWireless *setting);
166const char *nm_setting_wireless_get_mac_blacklist_item(NMSettingWireless *setting, guint32 idx);
167gboolean nm_setting_wireless_add_mac_blacklist_item(NMSettingWireless *setting, const char *mac);
168void nm_setting_wireless_remove_mac_blacklist_item(NMSettingWireless *setting, guint32 idx);
169gboolean nm_setting_wireless_remove_mac_blacklist_item_by_value(NMSettingWireless *setting,
170 const char *mac);
171void nm_setting_wireless_clear_mac_blacklist_items(NMSettingWireless *setting);
172
173guint32 nm_setting_wireless_get_mtu(NMSettingWireless *setting);
174gboolean nm_setting_wireless_get_hidden(NMSettingWireless *setting);
175NM_AVAILABLE_IN_1_2
176guint32 nm_setting_wireless_get_powersave(NMSettingWireless *setting);
177
178NM_AVAILABLE_IN_1_2
179NMSettingMacRandomization
180nm_setting_wireless_get_mac_address_randomization(NMSettingWireless *setting);
181
182gboolean nm_setting_wireless_add_seen_bssid(NMSettingWireless *setting, const char *bssid);
183
184guint32 nm_setting_wireless_get_num_seen_bssids(NMSettingWireless *setting);
185const char *nm_setting_wireless_get_seen_bssid(NMSettingWireless *setting, guint32 i);
186
187gboolean nm_setting_wireless_ap_security_compatible(NMSettingWireless *s_wireless,
188 NMSettingWirelessSecurity *s_wireless_sec,
189 NM80211ApFlags ap_flags,
190 NM80211ApSecurityFlags ap_wpa,
191 NM80211ApSecurityFlags ap_rsn,
192 NM80211Mode ap_mode);
193
194NM_AVAILABLE_IN_1_12
195NMSettingWirelessWakeOnWLan nm_setting_wireless_get_wake_on_wlan(NMSettingWireless *setting);
196
197NM_AVAILABLE_IN_1_28
198NMTernary nm_setting_wireless_get_ap_isolation(NMSettingWireless *setting);
199
200G_END_DECLS
201
202#endif /* __NM_SETTING_WIRELESS_H__ */
203

source code of include/libnm/nm-setting-wireless.h