lib: add IWINFO_BAND_COUNT and IWINFO_BAND_NAMES
[project/iwinfo.git] / include / iwinfo.h
index b07820d8e2a39d76a66937647ccd04424dced35b..fee665cc5266baf273c08c6332a9baaae3052621 100644 (file)
 #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_TKIP   (1 << 2)
-#define IWINFO_CIPHER_WRAP   (1 << 3)
-#define IWINFO_CIPHER_CCMP   (1 << 4)
-#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_80211_AX      (1 << 6)
+
+#define IWINFO_BAND_24       (1 << 0)
+#define IWINFO_BAND_5        (1 << 1)
+#define IWINFO_BAND_6        (1 << 2)
+#define IWINFO_BAND_60       (1 << 3)
+#define IWINFO_BAND_COUNT    4
+
+#define IWINFO_CIPHER_NONE    (1 << 0)
+#define IWINFO_CIPHER_WEP40   (1 << 1)
+#define IWINFO_CIPHER_TKIP    (1 << 2)
+#define IWINFO_CIPHER_WRAP    (1 << 3)
+#define IWINFO_CIPHER_CCMP    (1 << 4)
+#define IWINFO_CIPHER_WEP104  (1 << 5)
+#define IWINFO_CIPHER_AESOCB  (1 << 6)
+#define IWINFO_CIPHER_CKIP    (1 << 7)
+#define IWINFO_CIPHER_GCMP    (1 << 8)
+#define IWINFO_CIPHER_CCMP256 (1 << 9)
+#define IWINFO_CIPHER_GCMP256 (1 << 10)
+#define IWINFO_CIPHER_COUNT  11
 
 #define IWINFO_KMGMT_NONE    (1 << 0)
 #define IWINFO_KMGMT_8021x   (1 << 1)
 #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)
+#define IWINFO_FREQ_NO_HE              (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];
+extern const char * const IWINFO_BAND_NAMES[IWINFO_BAND_COUNT];
+extern const char * const IWINFO_CIPHER_NAMES[IWINFO_CIPHER_COUNT];
+extern const char * const IWINFO_KMGMT_NAMES[IWINFO_KMGMT_COUNT];
+extern const char * const IWINFO_AUTH_NAMES[IWINFO_AUTH_COUNT];
 
 
 enum iwinfo_opmode {
@@ -75,9 +86,11 @@ enum iwinfo_opmode {
        IWINFO_OPMODE_MESHPOINT  = 7,
        IWINFO_OPMODE_P2P_CLIENT = 8,
        IWINFO_OPMODE_P2P_GO     = 9,
+
+       IWINFO_OPMODE_COUNT      = 10,
 };
 
-extern const char *IWINFO_OPMODE_NAMES[];
+extern const char * const IWINFO_OPMODE_NAMES[IWINFO_OPMODE_COUNT];
 
 
 enum iwinfo_htmode {
@@ -89,11 +102,16 @@ enum iwinfo_htmode {
        IWINFO_HTMODE_VHT80_80   = (1 << 5),
        IWINFO_HTMODE_VHT160     = (1 << 6),
        IWINFO_HTMODE_NOHT       = (1 << 7),
+       IWINFO_HTMODE_HE20       = (1 << 8),
+       IWINFO_HTMODE_HE40       = (1 << 9),
+       IWINFO_HTMODE_HE80       = (1 << 10),
+       IWINFO_HTMODE_HE80_80    = (1 << 11),
+       IWINFO_HTMODE_HE160      = (1 << 12),
 
-       IWINFO_HTMODE_COUNT      = 8
+       IWINFO_HTMODE_COUNT      = 13
 };
 
-extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
+extern const char * const IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
 
 
 struct iwinfo_rate_entry {
@@ -103,6 +121,9 @@ struct iwinfo_rate_entry {
        uint8_t is_short_gi:1;
        uint8_t is_ht:1;
        uint8_t is_vht:1;
+       uint8_t is_he:1;
+       uint8_t he_gi;
+       uint8_t he_dcm;
        uint8_t mhz;
        uint8_t nss;
 };
@@ -164,12 +185,34 @@ struct iwinfo_freqlist_entry {
 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;
+};
+
+extern const char * const ht_secondary_offset[4];
+/* 0 = 20 MHz
+   1 = 40 MHz or higher (refer to vht if supported) */
+extern const uint16_t ht_chan_width[2];
+/* 0 = 40 MHz or lower (refer to ht to a more precise width)
+   1 = 80 MHz
+   2 = 160 MHz
+   3 = 80+80 MHz */
+extern const uint16_t vht_chan_width[4];
+
 struct iwinfo_scanlist_entry {
        uint8_t mac[6];
        char ssid[IWINFO_ESSID_MAX_SIZE+1];
@@ -179,12 +222,8 @@ struct iwinfo_scanlist_entry {
        uint8_t quality;
        uint8_t quality_max;
        struct iwinfo_crypto_entry crypto;
-
-       /* BSS Load */
-       uint8_t has_bss_load;
-       uint8_t station_count;
-       uint8_t channel_utilization;
-       uint8_t admission_capacity;
+       struct iwinfo_scanlist_ht_chan_entry ht_chan_info;
+       struct iwinfo_scanlist_vht_chan_entry vht_chan_info;
 };
 
 struct iwinfo_country_entry {
@@ -194,7 +233,7 @@ struct iwinfo_country_entry {
 
 struct iwinfo_iso3166_label {
        uint16_t iso3166;
-       char name[28];
+       const char name[28];
 };
 
 struct iwinfo_hardware_id {
@@ -217,7 +256,7 @@ struct iwinfo_hardware_entry {
 
 extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES[];
 
-#define IWINFO_HARDWARE_FILE   "/usr/share/libiwinfo/hardware.txt"
+#define IWINFO_HARDWARE_FILE   "/usr/share/libiwinfo/devices.txt"
 
 
 struct iwinfo_ops {
@@ -226,6 +265,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 *);
@@ -253,6 +294,7 @@ struct iwinfo_ops {
        int (*countrylist)(const char *, char *, int *);
        int (*survey)(const char *, char *, int *);
        int (*lookup_phy)(const char *, char *);
+       int (*phy_path)(const char *phyname, const char **path);
        void (*close)(void);
 };