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
,
141 IWINFO_FREQ_FLAG_COUNT
,
144 #define IWINFO_FREQ_NO_10MHZ (1 << IWINFO_FREQ_NO_10MHZ)
145 #define IWINFO_FREQ_NO_20MHZ (1 << IWINFO_FREQ_NO_20MHZ)
146 #define IWINFO_FREQ_NO_HT40PLUS (1 << IWINFO_FREQ_NO_HT40PLUS)
147 #define IWINFO_FREQ_NO_HT40MINUS (1 << IWINFO_FREQ_NO_HT40MINUS)
148 #define IWINFO_FREQ_NO_80MHZ (1 << IWINFO_FREQ_NO_80MHZ)
149 #define IWINFO_FREQ_NO_160MHZ (1 << IWINFO_FREQ_NO_160MHZ)
150 #define IWINFO_FREQ_NO_HE (1 << IWINFO_FREQ_NO_HE)
154 IWINFO_OPMODE_UNKNOWN
= 0,
155 IWINFO_OPMODE_MASTER
,
157 IWINFO_OPMODE_CLIENT
,
158 IWINFO_OPMODE_MONITOR
,
159 IWINFO_OPMODE_AP_VLAN
,
161 IWINFO_OPMODE_MESHPOINT
,
162 IWINFO_OPMODE_P2P_CLIENT
,
163 IWINFO_OPMODE_P2P_GO
,
169 extern const char * const IWINFO_OPMODE_NAMES
[IWINFO_OPMODE_COUNT
];
173 IWINFO_HTMODE_HT20
= 0,
178 IWINFO_HTMODE_VHT80_80
,
179 IWINFO_HTMODE_VHT160
,
184 IWINFO_HTMODE_HE80_80
,
191 #define IWINFO_HTMODE_HT20 (1 << IWINFO_HTMODE_HT20)
192 #define IWINFO_HTMODE_HT40 (1 << IWINFO_HTMODE_HT40)
193 #define IWINFO_HTMODE_VHT20 (1 << IWINFO_HTMODE_VHT20)
194 #define IWINFO_HTMODE_VHT40 (1 << IWINFO_HTMODE_VHT40)
195 #define IWINFO_HTMODE_VHT80 (1 << IWINFO_HTMODE_VHT80)
196 #define IWINFO_HTMODE_VHT80_80 (1 << IWINFO_HTMODE_VHT80_80)
197 #define IWINFO_HTMODE_VHT160 (1 << IWINFO_HTMODE_VHT160)
198 #define IWINFO_HTMODE_NOHT (1 << IWINFO_HTMODE_NOHT)
199 #define IWINFO_HTMODE_HE20 (1 << IWINFO_HTMODE_HE20)
200 #define IWINFO_HTMODE_HE40 (1 << IWINFO_HTMODE_HE40)
201 #define IWINFO_HTMODE_HE80 (1 << IWINFO_HTMODE_HE80)
202 #define IWINFO_HTMODE_HE80_80 (1 << IWINFO_HTMODE_HE80_80)
203 #define IWINFO_HTMODE_HE160 (1 << IWINFO_HTMODE_HE160)
205 extern const char * const IWINFO_HTMODE_NAMES
[IWINFO_HTMODE_COUNT
];
208 struct iwinfo_rate_entry
{
212 uint8_t is_short_gi
:1;
222 struct iwinfo_assoclist_entry
{
228 uint32_t connected_time
;
231 uint64_t rx_drop_misc
;
232 struct iwinfo_rate_entry rx_rate
;
233 struct iwinfo_rate_entry tx_rate
;
239 uint8_t is_authorized
:1;
240 uint8_t is_authenticated
:1;
241 uint8_t is_preamble_short
:1;
248 char plink_state
[16];
254 struct iwinfo_survey_entry
{
255 uint64_t active_time
;
257 uint64_t busy_time_ext
;
264 struct iwinfo_txpwrlist_entry
{
269 struct iwinfo_freqlist_entry
{
276 struct iwinfo_crypto_entry
{
279 uint16_t group_ciphers
;
280 uint16_t pair_ciphers
;
285 struct iwinfo_scanlist_ht_chan_entry
{
286 uint8_t primary_chan
;
287 uint8_t secondary_chan_off
;
291 struct iwinfo_scanlist_vht_chan_entry
{
293 uint8_t center_chan_1
;
294 uint8_t center_chan_2
;
297 extern const char * const ht_secondary_offset
[4];
299 1 = 40 MHz or higher (refer to vht if supported) */
300 extern const uint16_t ht_chan_width
[2];
301 /* 0 = 40 MHz or lower (refer to ht to a more precise width)
305 extern const uint16_t vht_chan_width
[4];
307 struct iwinfo_scanlist_entry
{
309 char ssid
[IWINFO_ESSID_MAX_SIZE
+1];
310 enum iwinfo_opmode mode
;
315 struct iwinfo_crypto_entry crypto
;
316 struct iwinfo_scanlist_ht_chan_entry ht_chan_info
;
317 struct iwinfo_scanlist_vht_chan_entry vht_chan_info
;
320 struct iwinfo_country_entry
{
325 struct iwinfo_iso3166_label
{
330 struct iwinfo_hardware_id
{
333 uint16_t subsystem_vendor_id
;
334 uint16_t subsystem_device_id
;
335 char compatible
[128];
338 struct iwinfo_hardware_entry
{
339 char vendor_name
[64];
340 char device_name
[64];
343 uint16_t subsystem_vendor_id
;
344 uint16_t subsystem_device_id
;
345 int16_t txpower_offset
;
346 int16_t frequency_offset
;
347 char compatible
[128];
350 extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES
[];
352 #define IWINFO_HARDWARE_FILE "/usr/share/libiwinfo/devices.txt"
358 int (*probe
)(const char *ifname
);
359 int (*mode
)(const char *, int *);
360 int (*channel
)(const char *, int *);
361 int (*center_chan1
)(const char *, int *);
362 int (*center_chan2
)(const char *, int *);
363 int (*frequency
)(const char *, int *);
364 int (*frequency_offset
)(const char *, int *);
365 int (*txpower
)(const char *, int *);
366 int (*txpower_offset
)(const char *, int *);
367 int (*bitrate
)(const char *, int *);
368 int (*signal
)(const char *, int *);
369 int (*noise
)(const char *, int *);
370 int (*quality
)(const char *, int *);
371 int (*quality_max
)(const char *, int *);
372 int (*mbssid_support
)(const char *, int *);
373 int (*hwmodelist
)(const char *, int *);
374 int (*htmodelist
)(const char *, int *);
375 int (*htmode
)(const char *, int *);
376 int (*ssid
)(const char *, char *);
377 int (*bssid
)(const char *, char *);
378 int (*country
)(const char *, char *);
379 int (*hardware_id
)(const char *, char *);
380 int (*hardware_name
)(const char *, char *);
381 int (*encryption
)(const char *, char *);
382 int (*phyname
)(const char *, char *);
383 int (*assoclist
)(const char *, char *, int *);
384 int (*txpwrlist
)(const char *, char *, int *);
385 int (*scanlist
)(const char *, char *, int *);
386 int (*freqlist
)(const char *, char *, int *);
387 int (*countrylist
)(const char *, char *, int *);
388 int (*survey
)(const char *, char *, int *);
389 int (*lookup_phy
)(const char *, char *);
390 int (*phy_path
)(const char *phyname
, const char **path
);
394 const char * iwinfo_type(const char *ifname
);
395 const struct iwinfo_ops
* iwinfo_backend(const char *ifname
);
396 const struct iwinfo_ops
* iwinfo_backend_by_name(const char *name
);
397 void iwinfo_finish(void);
399 extern const struct iwinfo_ops wext_ops
;
400 extern const struct iwinfo_ops madwifi_ops
;
401 extern const struct iwinfo_ops nl80211_ops
;
402 extern const struct iwinfo_ops wl_ops
;
404 #include "iwinfo/utils.h"