17 #include <sys/ioctl.h>
23 #define IWINFO_BUFSIZE 24 * 1024
24 #define IWINFO_ESSID_MAX_SIZE 32
39 #define IWINFO_80211_A (1 << IWINFO_80211_A)
40 #define IWINFO_80211_B (1 << IWINFO_80211_B)
41 #define IWINFO_80211_G (1 << IWINFO_80211_G)
42 #define IWINFO_80211_N (1 << IWINFO_80211_N)
43 #define IWINFO_80211_AC (1 << IWINFO_80211_AC)
44 #define IWINFO_80211_AD (1 << IWINFO_80211_AD)
45 #define IWINFO_80211_AX (1 << IWINFO_80211_AX)
47 extern const char * const IWINFO_80211_NAMES
[IWINFO_80211_COUNT
];
60 #define IWINFO_BAND_24 (1 << IWINFO_BAND_24)
61 #define IWINFO_BAND_5 (1 << IWINFO_BAND_5)
62 #define IWINFO_BAND_6 (1 << IWINFO_BAND_6)
63 #define IWINFO_BAND_60 (1 << IWINFO_BAND_60)
65 extern const char * const IWINFO_BAND_NAMES
[IWINFO_BAND_COUNT
];
69 IWINFO_CIPHER_NONE
= 0,
78 IWINFO_CIPHER_CCMP256
,
79 IWINFO_CIPHER_GCMP256
,
85 #define IWINFO_CIPHER_NONE (1 << IWINFO_CIPHER_NONE)
86 #define IWINFO_CIPHER_WEP40 (1 << IWINFO_CIPHER_WEP40)
87 #define IWINFO_CIPHER_TKIP (1 << IWINFO_CIPHER_TKIP)
88 #define IWINFO_CIPHER_WRAP (1 << IWINFO_CIPHER_WRAP)
89 #define IWINFO_CIPHER_CCMP (1 << IWINFO_CIPHER_CCMP)
90 #define IWINFO_CIPHER_WEP104 (1 << IWINFO_CIPHER_WEP104)
91 #define IWINFO_CIPHER_AESOCB (1 << IWINFO_CIPHER_AESOCB)
92 #define IWINFO_CIPHER_CKIP (1 << IWINFO_CIPHER_CKIP)
93 #define IWINFO_CIPHER_GCMP (1 << IWINFO_CIPHER_GCMP)
94 #define IWINFO_CIPHER_CCMP256 (1 << IWINFO_CIPHER_CCMP256)
95 #define IWINFO_CIPHER_GCMP256 (1 << IWINFO_CIPHER_GCMP256)
97 extern const char * const IWINFO_CIPHER_NAMES
[IWINFO_CIPHER_COUNT
];
101 IWINFO_KMGMT_NONE
= 0,
111 #define IWINFO_KMGMT_NONE (1 << IWINFO_KMGMT_NONE)
112 #define IWINFO_KMGMT_8021x (1 << IWINFO_KMGMT_8021x)
113 #define IWINFO_KMGMT_PSK (1 << IWINFO_KMGMT_PSK)
114 #define IWINFO_KMGMT_SAE (1 << IWINFO_KMGMT_SAE)
115 #define IWINFO_KMGMT_OWE (1 << IWINFO_KMGMT_OWE)
117 extern const char * const IWINFO_KMGMT_NAMES
[IWINFO_KMGMT_COUNT
];
121 IWINFO_AUTH_OPEN
= 0,
128 extern const char * const IWINFO_AUTH_NAMES
[IWINFO_AUTH_COUNT
];
131 enum iwinfo_freq_flag
{
132 IWINFO_FREQ_NO_10MHZ
= 0,
133 IWINFO_FREQ_NO_20MHZ
,
134 IWINFO_FREQ_NO_HT40PLUS
,
135 IWINFO_FREQ_NO_HT40MINUS
,
136 IWINFO_FREQ_NO_80MHZ
,
137 IWINFO_FREQ_NO_160MHZ
,
140 IWINFO_FREQ_INDOOR_ONLY
,
143 IWINFO_FREQ_FLAG_COUNT
,
146 #define IWINFO_FREQ_NO_10MHZ (1 << IWINFO_FREQ_NO_10MHZ)
147 #define IWINFO_FREQ_NO_20MHZ (1 << IWINFO_FREQ_NO_20MHZ)
148 #define IWINFO_FREQ_NO_HT40PLUS (1 << IWINFO_FREQ_NO_HT40PLUS)
149 #define IWINFO_FREQ_NO_HT40MINUS (1 << IWINFO_FREQ_NO_HT40MINUS)
150 #define IWINFO_FREQ_NO_80MHZ (1 << IWINFO_FREQ_NO_80MHZ)
151 #define IWINFO_FREQ_NO_160MHZ (1 << IWINFO_FREQ_NO_160MHZ)
152 #define IWINFO_FREQ_NO_HE (1 << IWINFO_FREQ_NO_HE)
153 #define IWINFO_FREQ_NO_IR (1 << IWINFO_FREQ_NO_IR)
154 #define IWINFO_FREQ_INDOOR_ONLY (1 << IWINFO_FREQ_INDOOR_ONLY)
158 IWINFO_OPMODE_UNKNOWN
= 0,
159 IWINFO_OPMODE_MASTER
,
161 IWINFO_OPMODE_CLIENT
,
162 IWINFO_OPMODE_MONITOR
,
163 IWINFO_OPMODE_AP_VLAN
,
165 IWINFO_OPMODE_MESHPOINT
,
166 IWINFO_OPMODE_P2P_CLIENT
,
167 IWINFO_OPMODE_P2P_GO
,
173 extern const char * const IWINFO_OPMODE_NAMES
[IWINFO_OPMODE_COUNT
];
177 IWINFO_HTMODE_HT20
= 0,
182 IWINFO_HTMODE_VHT80_80
,
183 IWINFO_HTMODE_VHT160
,
188 IWINFO_HTMODE_HE80_80
,
195 #define IWINFO_HTMODE_HT20 (1 << IWINFO_HTMODE_HT20)
196 #define IWINFO_HTMODE_HT40 (1 << IWINFO_HTMODE_HT40)
197 #define IWINFO_HTMODE_VHT20 (1 << IWINFO_HTMODE_VHT20)
198 #define IWINFO_HTMODE_VHT40 (1 << IWINFO_HTMODE_VHT40)
199 #define IWINFO_HTMODE_VHT80 (1 << IWINFO_HTMODE_VHT80)
200 #define IWINFO_HTMODE_VHT80_80 (1 << IWINFO_HTMODE_VHT80_80)
201 #define IWINFO_HTMODE_VHT160 (1 << IWINFO_HTMODE_VHT160)
202 #define IWINFO_HTMODE_NOHT (1 << IWINFO_HTMODE_NOHT)
203 #define IWINFO_HTMODE_HE20 (1 << IWINFO_HTMODE_HE20)
204 #define IWINFO_HTMODE_HE40 (1 << IWINFO_HTMODE_HE40)
205 #define IWINFO_HTMODE_HE80 (1 << IWINFO_HTMODE_HE80)
206 #define IWINFO_HTMODE_HE80_80 (1 << IWINFO_HTMODE_HE80_80)
207 #define IWINFO_HTMODE_HE160 (1 << IWINFO_HTMODE_HE160)
209 extern const char * const IWINFO_HTMODE_NAMES
[IWINFO_HTMODE_COUNT
];
212 struct iwinfo_rate_entry
{
216 uint8_t is_short_gi
:1;
226 struct iwinfo_assoclist_entry
{
232 uint32_t connected_time
;
235 uint64_t rx_drop_misc
;
236 struct iwinfo_rate_entry rx_rate
;
237 struct iwinfo_rate_entry tx_rate
;
243 uint8_t is_authorized
:1;
244 uint8_t is_authenticated
:1;
245 uint8_t is_preamble_short
:1;
252 char plink_state
[16];
258 struct iwinfo_survey_entry
{
259 uint64_t active_time
;
261 uint64_t busy_time_ext
;
268 struct iwinfo_txpwrlist_entry
{
273 struct iwinfo_freqlist_entry
{
281 struct iwinfo_crypto_entry
{
284 uint16_t group_ciphers
;
285 uint16_t pair_ciphers
;
290 struct iwinfo_scanlist_ht_chan_entry
{
291 uint8_t primary_chan
;
292 uint8_t secondary_chan_off
;
296 struct iwinfo_scanlist_vht_chan_entry
{
298 uint8_t center_chan_1
;
299 uint8_t center_chan_2
;
302 extern const char * const ht_secondary_offset
[4];
304 1 = 40 MHz or higher (refer to vht if supported) */
305 extern const uint16_t ht_chan_width
[2];
306 /* 0 = 40 MHz or lower (refer to ht to a more precise width)
310 extern const uint16_t vht_chan_width
[4];
312 struct iwinfo_scanlist_entry
{
314 char ssid
[IWINFO_ESSID_MAX_SIZE
+1];
315 enum iwinfo_opmode mode
;
320 struct iwinfo_crypto_entry crypto
;
321 struct iwinfo_scanlist_ht_chan_entry ht_chan_info
;
322 struct iwinfo_scanlist_vht_chan_entry vht_chan_info
;
325 struct iwinfo_country_entry
{
330 struct iwinfo_iso3166_label
{
335 struct iwinfo_hardware_id
{
338 uint16_t subsystem_vendor_id
;
339 uint16_t subsystem_device_id
;
340 char compatible
[128];
343 struct iwinfo_hardware_entry
{
344 char vendor_name
[64];
345 char device_name
[64];
348 uint16_t subsystem_vendor_id
;
349 uint16_t subsystem_device_id
;
350 int16_t txpower_offset
;
351 int16_t frequency_offset
;
352 char compatible
[128];
355 extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES
[];
357 #define IWINFO_HARDWARE_FILE "/usr/share/libiwinfo/devices.txt"
363 int (*probe
)(const char *ifname
);
364 int (*mode
)(const char *, int *);
365 int (*channel
)(const char *, int *);
366 int (*center_chan1
)(const char *, int *);
367 int (*center_chan2
)(const char *, int *);
368 int (*frequency
)(const char *, int *);
369 int (*frequency_offset
)(const char *, int *);
370 int (*txpower
)(const char *, int *);
371 int (*txpower_offset
)(const char *, int *);
372 int (*bitrate
)(const char *, int *);
373 int (*signal
)(const char *, int *);
374 int (*noise
)(const char *, int *);
375 int (*quality
)(const char *, int *);
376 int (*quality_max
)(const char *, int *);
377 int (*mbssid_support
)(const char *, int *);
378 int (*hwmodelist
)(const char *, int *);
379 int (*htmodelist
)(const char *, int *);
380 int (*htmode
)(const char *, int *);
381 int (*ssid
)(const char *, char *);
382 int (*bssid
)(const char *, char *);
383 int (*country
)(const char *, char *);
384 int (*hardware_id
)(const char *, char *);
385 int (*hardware_name
)(const char *, char *);
386 int (*encryption
)(const char *, char *);
387 int (*phyname
)(const char *, char *);
388 int (*assoclist
)(const char *, char *, int *);
389 int (*txpwrlist
)(const char *, char *, int *);
390 int (*scanlist
)(const char *, char *, int *);
391 int (*freqlist
)(const char *, char *, int *);
392 int (*countrylist
)(const char *, char *, int *);
393 int (*survey
)(const char *, char *, int *);
394 int (*lookup_phy
)(const char *, char *);
395 int (*phy_path
)(const char *phyname
, const char **path
);
399 const char * iwinfo_type(const char *ifname
);
400 const struct iwinfo_ops
* iwinfo_backend(const char *ifname
);
401 const struct iwinfo_ops
* iwinfo_backend_by_name(const char *name
);
402 void iwinfo_finish(void);
404 extern const struct iwinfo_ops wext_ops
;
405 extern const struct iwinfo_ops madwifi_ops
;
406 extern const struct iwinfo_ops nl80211_ops
;
407 extern const struct iwinfo_ops wl_ops
;
409 #include "iwinfo/utils.h"