17 #include <sys/ioctl.h>
23 #define IWINFO_BUFSIZE 24 * 1024
24 #define IWINFO_ESSID_MAX_SIZE 32
26 #define IWINFO_80211_A (1 << 0)
27 #define IWINFO_80211_B (1 << 1)
28 #define IWINFO_80211_G (1 << 2)
29 #define IWINFO_80211_N (1 << 3)
30 #define IWINFO_80211_AC (1 << 4)
31 #define IWINFO_80211_AD (1 << 5)
32 #define IWINFO_80211_AX (1 << 6)
34 #define IWINFO_BAND_24 (1 << 0)
35 #define IWINFO_BAND_5 (1 << 1)
36 #define IWINFO_BAND_6 (1 << 2)
37 #define IWINFO_BAND_60 (1 << 3)
39 #define IWINFO_CIPHER_NONE (1 << 0)
40 #define IWINFO_CIPHER_WEP40 (1 << 1)
41 #define IWINFO_CIPHER_TKIP (1 << 2)
42 #define IWINFO_CIPHER_WRAP (1 << 3)
43 #define IWINFO_CIPHER_CCMP (1 << 4)
44 #define IWINFO_CIPHER_WEP104 (1 << 5)
45 #define IWINFO_CIPHER_AESOCB (1 << 6)
46 #define IWINFO_CIPHER_CKIP (1 << 7)
47 #define IWINFO_CIPHER_GCMP (1 << 8)
48 #define IWINFO_CIPHER_CCMP256 (1 << 9)
49 #define IWINFO_CIPHER_GCMP256 (1 << 10)
50 #define IWINFO_CIPHER_COUNT 11
52 #define IWINFO_KMGMT_NONE (1 << 0)
53 #define IWINFO_KMGMT_8021x (1 << 1)
54 #define IWINFO_KMGMT_PSK (1 << 2)
55 #define IWINFO_KMGMT_SAE (1 << 3)
56 #define IWINFO_KMGMT_OWE (1 << 4)
57 #define IWINFO_KMGMT_COUNT 5
59 #define IWINFO_AUTH_OPEN (1 << 0)
60 #define IWINFO_AUTH_SHARED (1 << 1)
61 #define IWINFO_AUTH_COUNT 2
63 #define IWINFO_FREQ_NO_10MHZ (1 << 0)
64 #define IWINFO_FREQ_NO_20MHZ (1 << 1)
65 #define IWINFO_FREQ_NO_HT40PLUS (1 << 2)
66 #define IWINFO_FREQ_NO_HT40MINUS (1 << 3)
67 #define IWINFO_FREQ_NO_80MHZ (1 << 4)
68 #define IWINFO_FREQ_NO_160MHZ (1 << 5)
69 #define IWINFO_FREQ_NO_HE (1 << 6)
71 extern const char * const IWINFO_CIPHER_NAMES
[IWINFO_CIPHER_COUNT
];
72 extern const char * const IWINFO_KMGMT_NAMES
[IWINFO_KMGMT_COUNT
];
73 extern const char * const IWINFO_AUTH_NAMES
[IWINFO_AUTH_COUNT
];
77 IWINFO_OPMODE_UNKNOWN
= 0,
78 IWINFO_OPMODE_MASTER
= 1,
79 IWINFO_OPMODE_ADHOC
= 2,
80 IWINFO_OPMODE_CLIENT
= 3,
81 IWINFO_OPMODE_MONITOR
= 4,
82 IWINFO_OPMODE_AP_VLAN
= 5,
83 IWINFO_OPMODE_WDS
= 6,
84 IWINFO_OPMODE_MESHPOINT
= 7,
85 IWINFO_OPMODE_P2P_CLIENT
= 8,
86 IWINFO_OPMODE_P2P_GO
= 9,
89 extern const char * const IWINFO_OPMODE_NAMES
[];
93 IWINFO_HTMODE_HT20
= (1 << 0),
94 IWINFO_HTMODE_HT40
= (1 << 1),
95 IWINFO_HTMODE_VHT20
= (1 << 2),
96 IWINFO_HTMODE_VHT40
= (1 << 3),
97 IWINFO_HTMODE_VHT80
= (1 << 4),
98 IWINFO_HTMODE_VHT80_80
= (1 << 5),
99 IWINFO_HTMODE_VHT160
= (1 << 6),
100 IWINFO_HTMODE_NOHT
= (1 << 7),
101 IWINFO_HTMODE_HE20
= (1 << 8),
102 IWINFO_HTMODE_HE40
= (1 << 9),
103 IWINFO_HTMODE_HE80
= (1 << 10),
104 IWINFO_HTMODE_HE80_80
= (1 << 11),
105 IWINFO_HTMODE_HE160
= (1 << 12),
107 IWINFO_HTMODE_COUNT
= 13
110 extern const char * const IWINFO_HTMODE_NAMES
[IWINFO_HTMODE_COUNT
];
113 struct iwinfo_rate_entry
{
117 uint8_t is_short_gi
:1;
127 struct iwinfo_assoclist_entry
{
133 uint32_t connected_time
;
136 uint64_t rx_drop_misc
;
137 struct iwinfo_rate_entry rx_rate
;
138 struct iwinfo_rate_entry tx_rate
;
144 uint8_t is_authorized
:1;
145 uint8_t is_authenticated
:1;
146 uint8_t is_preamble_short
:1;
153 char plink_state
[16];
159 struct iwinfo_survey_entry
{
160 uint64_t active_time
;
162 uint64_t busy_time_ext
;
169 struct iwinfo_txpwrlist_entry
{
174 struct iwinfo_freqlist_entry
{
181 struct iwinfo_crypto_entry
{
184 uint16_t group_ciphers
;
185 uint16_t pair_ciphers
;
190 struct iwinfo_scanlist_ht_chan_entry
{
191 uint8_t primary_chan
;
192 uint8_t secondary_chan_off
;
196 struct iwinfo_scanlist_vht_chan_entry
{
198 uint8_t center_chan_1
;
199 uint8_t center_chan_2
;
202 extern const char * const ht_secondary_offset
[4];
204 1 = 40 MHz or higher (refer to vht if supported) */
205 extern const uint16_t ht_chan_width
[2];
206 /* 0 = 40 MHz or lower (refer to ht to a more precise width)
210 extern const uint16_t vht_chan_width
[4];
212 struct iwinfo_scanlist_entry
{
214 char ssid
[IWINFO_ESSID_MAX_SIZE
+1];
215 enum iwinfo_opmode mode
;
220 struct iwinfo_crypto_entry crypto
;
221 struct iwinfo_scanlist_ht_chan_entry ht_chan_info
;
222 struct iwinfo_scanlist_vht_chan_entry vht_chan_info
;
225 struct iwinfo_country_entry
{
230 struct iwinfo_iso3166_label
{
235 struct iwinfo_hardware_id
{
238 uint16_t subsystem_vendor_id
;
239 uint16_t subsystem_device_id
;
242 struct iwinfo_hardware_entry
{
243 char vendor_name
[64];
244 char device_name
[64];
247 uint16_t subsystem_vendor_id
;
248 uint16_t subsystem_device_id
;
249 int16_t txpower_offset
;
250 int16_t frequency_offset
;
253 extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES
[];
255 #define IWINFO_HARDWARE_FILE "/usr/share/libiwinfo/devices.txt"
261 int (*probe
)(const char *ifname
);
262 int (*mode
)(const char *, int *);
263 int (*channel
)(const char *, int *);
264 int (*center_chan1
)(const char *, int *);
265 int (*center_chan2
)(const char *, int *);
266 int (*frequency
)(const char *, int *);
267 int (*frequency_offset
)(const char *, int *);
268 int (*txpower
)(const char *, int *);
269 int (*txpower_offset
)(const char *, int *);
270 int (*bitrate
)(const char *, int *);
271 int (*signal
)(const char *, int *);
272 int (*noise
)(const char *, int *);
273 int (*quality
)(const char *, int *);
274 int (*quality_max
)(const char *, int *);
275 int (*mbssid_support
)(const char *, int *);
276 int (*hwmodelist
)(const char *, int *);
277 int (*htmodelist
)(const char *, int *);
278 int (*htmode
)(const char *, int *);
279 int (*ssid
)(const char *, char *);
280 int (*bssid
)(const char *, char *);
281 int (*country
)(const char *, char *);
282 int (*hardware_id
)(const char *, char *);
283 int (*hardware_name
)(const char *, char *);
284 int (*encryption
)(const char *, char *);
285 int (*phyname
)(const char *, char *);
286 int (*assoclist
)(const char *, char *, int *);
287 int (*txpwrlist
)(const char *, char *, int *);
288 int (*scanlist
)(const char *, char *, int *);
289 int (*freqlist
)(const char *, char *, int *);
290 int (*countrylist
)(const char *, char *, int *);
291 int (*survey
)(const char *, char *, int *);
292 int (*lookup_phy
)(const char *, char *);
293 int (*phy_path
)(const char *phyname
, const char **path
);
297 const char * iwinfo_type(const char *ifname
);
298 const struct iwinfo_ops
* iwinfo_backend(const char *ifname
);
299 const struct iwinfo_ops
* iwinfo_backend_by_name(const char *name
);
300 void iwinfo_finish(void);
302 extern const struct iwinfo_ops wext_ops
;
303 extern const struct iwinfo_ops madwifi_ops
;
304 extern const struct iwinfo_ops nl80211_ops
;
305 extern const struct iwinfo_ops wl_ops
;
307 #include "iwinfo/utils.h"