iwinfo: improve center channel handling
[project/iwinfo.git] / include / iwinfo.h
index 62e58913760bf9917412262d76daa2dd2aa5aca1..40ef3a7b60246ac5399099208dafcf47c808eed7 100644 (file)
@@ -28,6 +28,7 @@
 #define IWINFO_80211_G       (1 << 2)
 #define IWINFO_80211_N       (1 << 3)
 #define IWINFO_80211_AC      (1 << 4)
+#define IWINFO_80211_AD      (1 << 5)
 
 #define IWINFO_CIPHER_NONE   (1 << 0)
 #define IWINFO_CIPHER_WEP40  (1 << 1)
 #define IWINFO_CIPHER_WEP104 (1 << 5)
 #define IWINFO_CIPHER_AESOCB (1 << 6)
 #define IWINFO_CIPHER_CKIP   (1 << 7)
-#define IWINFO_CIPHER_COUNT  8
+#define IWINFO_CIPHER_GCMP   (1 << 8)
+#define IWINFO_CIPHER_COUNT  9
 
 #define IWINFO_KMGMT_NONE    (1 << 0)
 #define IWINFO_KMGMT_8021x   (1 << 1)
 #define IWINFO_KMGMT_PSK     (1 << 2)
-#define IWINFO_KMGMT_COUNT   3
+#define IWINFO_KMGMT_SAE     (1 << 3)
+#define IWINFO_KMGMT_OWE     (1 << 4)
+#define IWINFO_KMGMT_COUNT   5
 
 #define IWINFO_AUTH_OPEN     (1 << 0)
 #define IWINFO_AUTH_SHARED   (1 << 1)
 #define IWINFO_AUTH_COUNT    2
 
+#define IWINFO_FREQ_NO_10MHZ           (1 << 0)
+#define IWINFO_FREQ_NO_20MHZ           (1 << 1)
+#define IWINFO_FREQ_NO_HT40PLUS                (1 << 2)
+#define IWINFO_FREQ_NO_HT40MINUS       (1 << 3)
+#define IWINFO_FREQ_NO_80MHZ           (1 << 4)
+#define IWINFO_FREQ_NO_160MHZ          (1 << 5)
+#define IWINFO_FREQ_NO_2160MHZ         (1 << 6)
+
 extern const char *IWINFO_CIPHER_NAMES[IWINFO_CIPHER_COUNT];
 extern const char *IWINFO_KMGMT_NAMES[IWINFO_KMGMT_COUNT];
 extern const char *IWINFO_AUTH_NAMES[IWINFO_AUTH_COUNT];
@@ -77,8 +89,9 @@ enum iwinfo_htmode {
        IWINFO_HTMODE_VHT80      = (1 << 4),
        IWINFO_HTMODE_VHT80_80   = (1 << 5),
        IWINFO_HTMODE_VHT160     = (1 << 6),
+       IWINFO_HTMODE_NOHT       = (1 << 7),
 
-       IWINFO_HTMODE_COUNT      = 7
+       IWINFO_HTMODE_COUNT      = 8
 };
 
 extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
@@ -89,15 +102,22 @@ struct iwinfo_rate_entry {
        int8_t mcs;
        uint8_t is_40mhz:1;
        uint8_t is_short_gi:1;
+       uint8_t is_ht:1;
+       uint8_t is_vht:1;
+       uint8_t mhz;
+       uint8_t nss;
 };
 
 struct iwinfo_assoclist_entry {
        uint8_t mac[6];
        int8_t signal;
+       int8_t signal_avg;
        int8_t noise;
        uint32_t inactive;
+       uint32_t connected_time;
        uint32_t rx_packets;
        uint32_t tx_packets;
+       uint64_t rx_drop_misc;
        struct iwinfo_rate_entry rx_rate;
        struct iwinfo_rate_entry tx_rate;
        uint32_t rx_bytes;
@@ -111,6 +131,23 @@ struct iwinfo_assoclist_entry {
        uint8_t is_wme:1;
        uint8_t is_mfp:1;
        uint8_t is_tdls:1;
+       uint32_t thr;
+       uint16_t llid;
+       uint16_t plid;
+       char plink_state[16];
+       char local_ps[16];
+       char peer_ps[16];
+       char nonpeer_ps[16];
+};
+
+struct iwinfo_survey_entry {
+       uint64_t active_time;
+       uint64_t busy_time;
+       uint64_t busy_time_ext;
+       uint64_t rxtime;
+       uint64_t txtime;
+       uint32_t mhz;
+       uint8_t noise;
 };
 
 struct iwinfo_txpwrlist_entry {
@@ -122,17 +159,50 @@ struct iwinfo_freqlist_entry {
        uint8_t channel;
        uint32_t mhz;
        uint8_t restricted;
+       uint32_t flags;
 };
 
 struct iwinfo_crypto_entry {
        uint8_t enabled;
        uint8_t wpa_version;
-       uint8_t group_ciphers;
-       uint8_t pair_ciphers;
+       uint16_t group_ciphers;
+       uint16_t pair_ciphers;
        uint8_t auth_suites;
        uint8_t auth_algs;
 };
 
+struct iwinfo_scanlist_ht_chan_entry {
+       uint8_t primary_chan;
+       uint8_t secondary_chan_off;
+       uint8_t chan_width;
+};
+
+struct iwinfo_scanlist_vht_chan_entry {
+       uint8_t chan_width;
+       uint8_t center_chan_1;
+       uint8_t center_chan_2;
+};
+
+static const char *ht_secondary_offset[4] = {
+       "no secondary",
+       "above",
+       "[reserved!]",
+       "below",
+};
+
+
+static uint16_t ht_chan_width[2] = {
+       20, /* 20 MHz */
+       2040, /* 40 MHz or higher (refer to vht if supported) */
+};
+
+static uint16_t vht_chan_width[] = {
+       [0] = 40, /* 40 MHz or lower (refer to ht to a more precise width) */
+       [1] = 80, /* 80 MHz */
+       [3] = 8080, /* 80+80 MHz */
+       [2] = 160, /* 160 MHz */
+};
+
 struct iwinfo_scanlist_entry {
        uint8_t mac[6];
        char ssid[IWINFO_ESSID_MAX_SIZE+1];
@@ -142,6 +212,8 @@ struct iwinfo_scanlist_entry {
        uint8_t quality;
        uint8_t quality_max;
        struct iwinfo_crypto_entry crypto;
+       struct iwinfo_scanlist_ht_chan_entry ht_chan_info;
+       struct iwinfo_scanlist_vht_chan_entry vht_chan_info;
 };
 
 struct iwinfo_country_entry {
@@ -183,6 +255,8 @@ struct iwinfo_ops {
        int (*probe)(const char *ifname);
        int (*mode)(const char *, int *);
        int (*channel)(const char *, int *);
+       int (*center_chan1)(const char *, int *);
+       int (*center_chan2)(const char *, int *);
        int (*frequency)(const char *, int *);
        int (*frequency_offset)(const char *, int *);
        int (*txpower)(const char *, int *);
@@ -195,6 +269,7 @@ struct iwinfo_ops {
        int (*mbssid_support)(const char *, int *);
        int (*hwmodelist)(const char *, int *);
        int (*htmodelist)(const char *, int *);
+       int (*htmode)(const char *, int *);
        int (*ssid)(const char *, char *);
        int (*bssid)(const char *, char *);
        int (*country)(const char *, char *);
@@ -207,6 +282,7 @@ struct iwinfo_ops {
        int (*scanlist)(const char *, char *, int *);
        int (*freqlist)(const char *, char *, int *);
        int (*countrylist)(const char *, char *, int *);
+       int (*survey)(const char *, char *, int *);
        int (*lookup_phy)(const char *, char *);
        void (*close)(void);
 };