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 #define IWINFO_AUTH_OPEN (1 << IWINFO_AUTH_OPEN)
129 #define IWINFO_AUTH_SHARED (1 << IWINFO_AUTH_SHARED)
131 extern const char * const IWINFO_AUTH_NAMES
[IWINFO_AUTH_COUNT
];
134 enum iwinfo_freq_flag
{
135 IWINFO_FREQ_NO_10MHZ
= 0,
136 IWINFO_FREQ_NO_20MHZ
,
137 IWINFO_FREQ_NO_HT40PLUS
,
138 IWINFO_FREQ_NO_HT40MINUS
,
139 IWINFO_FREQ_NO_80MHZ
,
140 IWINFO_FREQ_NO_160MHZ
,
143 IWINFO_FREQ_INDOOR_ONLY
,
146 IWINFO_FREQ_FLAG_COUNT
,
149 #define IWINFO_FREQ_NO_10MHZ (1 << IWINFO_FREQ_NO_10MHZ)
150 #define IWINFO_FREQ_NO_20MHZ (1 << IWINFO_FREQ_NO_20MHZ)
151 #define IWINFO_FREQ_NO_HT40PLUS (1 << IWINFO_FREQ_NO_HT40PLUS)
152 #define IWINFO_FREQ_NO_HT40MINUS (1 << IWINFO_FREQ_NO_HT40MINUS)
153 #define IWINFO_FREQ_NO_80MHZ (1 << IWINFO_FREQ_NO_80MHZ)
154 #define IWINFO_FREQ_NO_160MHZ (1 << IWINFO_FREQ_NO_160MHZ)
155 #define IWINFO_FREQ_NO_HE (1 << IWINFO_FREQ_NO_HE)
156 #define IWINFO_FREQ_NO_IR (1 << IWINFO_FREQ_NO_IR)
157 #define IWINFO_FREQ_INDOOR_ONLY (1 << IWINFO_FREQ_INDOOR_ONLY)
159 extern const char * const IWINFO_FREQ_FLAG_NAMES
[IWINFO_FREQ_FLAG_COUNT
];
163 IWINFO_OPMODE_UNKNOWN
= 0,
164 IWINFO_OPMODE_MASTER
,
166 IWINFO_OPMODE_CLIENT
,
167 IWINFO_OPMODE_MONITOR
,
168 IWINFO_OPMODE_AP_VLAN
,
170 IWINFO_OPMODE_MESHPOINT
,
171 IWINFO_OPMODE_P2P_CLIENT
,
172 IWINFO_OPMODE_P2P_GO
,
178 extern const char * const IWINFO_OPMODE_NAMES
[IWINFO_OPMODE_COUNT
];
182 IWINFO_HTMODE_HT20
= 0,
187 IWINFO_HTMODE_VHT80_80
,
188 IWINFO_HTMODE_VHT160
,
193 IWINFO_HTMODE_HE80_80
,
200 #define IWINFO_HTMODE_HT20 (1 << IWINFO_HTMODE_HT20)
201 #define IWINFO_HTMODE_HT40 (1 << IWINFO_HTMODE_HT40)
202 #define IWINFO_HTMODE_VHT20 (1 << IWINFO_HTMODE_VHT20)
203 #define IWINFO_HTMODE_VHT40 (1 << IWINFO_HTMODE_VHT40)
204 #define IWINFO_HTMODE_VHT80 (1 << IWINFO_HTMODE_VHT80)
205 #define IWINFO_HTMODE_VHT80_80 (1 << IWINFO_HTMODE_VHT80_80)
206 #define IWINFO_HTMODE_VHT160 (1 << IWINFO_HTMODE_VHT160)
207 #define IWINFO_HTMODE_NOHT (1 << IWINFO_HTMODE_NOHT)
208 #define IWINFO_HTMODE_HE20 (1 << IWINFO_HTMODE_HE20)
209 #define IWINFO_HTMODE_HE40 (1 << IWINFO_HTMODE_HE40)
210 #define IWINFO_HTMODE_HE80 (1 << IWINFO_HTMODE_HE80)
211 #define IWINFO_HTMODE_HE80_80 (1 << IWINFO_HTMODE_HE80_80)
212 #define IWINFO_HTMODE_HE160 (1 << IWINFO_HTMODE_HE160)
214 extern const char * const IWINFO_HTMODE_NAMES
[IWINFO_HTMODE_COUNT
];
217 struct iwinfo_rate_entry
{
221 uint8_t is_short_gi
:1;
231 struct iwinfo_assoclist_entry
{
237 uint32_t connected_time
;
240 uint64_t rx_drop_misc
;
241 struct iwinfo_rate_entry rx_rate
;
242 struct iwinfo_rate_entry tx_rate
;
248 uint8_t is_authorized
:1;
249 uint8_t is_authenticated
:1;
250 uint8_t is_preamble_short
:1;
257 char plink_state
[16];
263 struct iwinfo_survey_entry
{
264 uint64_t active_time
;
266 uint64_t busy_time_ext
;
273 struct iwinfo_txpwrlist_entry
{
278 struct iwinfo_freqlist_entry
{
286 struct iwinfo_crypto_entry
{
289 uint16_t group_ciphers
;
290 uint16_t pair_ciphers
;
295 struct iwinfo_scanlist_ht_chan_entry
{
296 uint8_t primary_chan
;
297 uint8_t secondary_chan_off
;
301 struct iwinfo_scanlist_vht_chan_entry
{
303 uint8_t center_chan_1
;
304 uint8_t center_chan_2
;
307 extern const char * const ht_secondary_offset
[4];
309 1 = 40 MHz or higher (refer to vht if supported) */
310 extern const uint16_t ht_chan_width
[2];
311 /* 0 = 40 MHz or lower (refer to ht to a more precise width)
315 extern const uint16_t vht_chan_width
[4];
317 struct iwinfo_scanlist_entry
{
319 char ssid
[IWINFO_ESSID_MAX_SIZE
+1];
320 enum iwinfo_opmode mode
;
327 struct iwinfo_crypto_entry crypto
;
328 struct iwinfo_scanlist_ht_chan_entry ht_chan_info
;
329 struct iwinfo_scanlist_vht_chan_entry vht_chan_info
;
332 struct iwinfo_country_entry
{
337 struct iwinfo_iso3166_label
{
342 struct iwinfo_hardware_id
{
345 uint16_t subsystem_vendor_id
;
346 uint16_t subsystem_device_id
;
347 char compatible
[128];
350 struct iwinfo_hardware_entry
{
351 char vendor_name
[64];
352 char device_name
[64];
355 uint16_t subsystem_vendor_id
;
356 uint16_t subsystem_device_id
;
357 int16_t txpower_offset
;
358 int16_t frequency_offset
;
359 char compatible
[128];
362 extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES
[];
364 #define IWINFO_HARDWARE_FILE "/usr/share/libiwinfo/devices.txt"
370 int (*probe
)(const char *ifname
);
371 int (*mode
)(const char *, int *);
372 int (*channel
)(const char *, int *);
373 int (*center_chan1
)(const char *, int *);
374 int (*center_chan2
)(const char *, int *);
375 int (*frequency
)(const char *, int *);
376 int (*frequency_offset
)(const char *, int *);
377 int (*txpower
)(const char *, int *);
378 int (*txpower_offset
)(const char *, int *);
379 int (*bitrate
)(const char *, int *);
380 int (*signal
)(const char *, int *);
381 int (*noise
)(const char *, int *);
382 int (*quality
)(const char *, int *);
383 int (*quality_max
)(const char *, int *);
384 int (*mbssid_support
)(const char *, int *);
385 int (*hwmodelist
)(const char *, int *);
386 int (*htmodelist
)(const char *, int *);
387 int (*htmode
)(const char *, int *);
388 int (*ssid
)(const char *, char *);
389 int (*bssid
)(const char *, char *);
390 int (*country
)(const char *, char *);
391 int (*hardware_id
)(const char *, char *);
392 int (*hardware_name
)(const char *, char *);
393 int (*encryption
)(const char *, char *);
394 int (*phyname
)(const char *, char *);
395 int (*assoclist
)(const char *, char *, int *);
396 int (*txpwrlist
)(const char *, char *, int *);
397 int (*scanlist
)(const char *, char *, int *);
398 int (*freqlist
)(const char *, char *, int *);
399 int (*countrylist
)(const char *, char *, int *);
400 int (*survey
)(const char *, char *, int *);
401 int (*lookup_phy
)(const char *, char *);
402 int (*phy_path
)(const char *phyname
, const char **path
);
406 const char * iwinfo_type(const char *ifname
);
407 const struct iwinfo_ops
* iwinfo_backend(const char *ifname
);
408 const struct iwinfo_ops
* iwinfo_backend_by_name(const char *name
);
409 void iwinfo_finish(void);
411 extern const struct iwinfo_ops wext_ops
;
412 extern const struct iwinfo_ops madwifi_ops
;
413 extern const struct iwinfo_ops nl80211_ops
;
414 extern const struct iwinfo_ops wl_ops
;
416 #include "iwinfo/utils.h"