generic: add some missing kernel config symbols spotted on x86
[openwrt.git] / package / network / utils / iwinfo / src / include / iwinfo.h
1 #ifndef __IWINFO_H_
2 #define __IWINFO_H_
3
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <sys/wait.h>
7 #include <unistd.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <fcntl.h>
12 #include <glob.h>
13 #include <ctype.h>
14 #include <dirent.h>
15 #include <stdint.h>
16
17 #include <sys/ioctl.h>
18 #include <sys/mman.h>
19 #include <net/if.h>
20 #include <errno.h>
21
22
23 #define IWINFO_BUFSIZE  24 * 1024
24 #define IWINFO_ESSID_MAX_SIZE   32
25
26 #define IWINFO_80211_A       (1 << 0)
27 #define IWINFO_80211_B       (1 << 1)
28 #define IWINFO_80211_G       (1 << 2)
29 #define IWINFO_80211_N       (1 << 3)
30
31 #define IWINFO_CIPHER_NONE   (1 << 0)
32 #define IWINFO_CIPHER_WEP40  (1 << 1)
33 #define IWINFO_CIPHER_TKIP   (1 << 2)
34 #define IWINFO_CIPHER_WRAP   (1 << 3)
35 #define IWINFO_CIPHER_CCMP   (1 << 4)
36 #define IWINFO_CIPHER_WEP104 (1 << 5)
37 #define IWINFO_CIPHER_AESOCB (1 << 6)
38 #define IWINFO_CIPHER_CKIP   (1 << 7)
39
40 #define IWINFO_KMGMT_NONE    (1 << 0)
41 #define IWINFO_KMGMT_8021x   (1 << 1)
42 #define IWINFO_KMGMT_PSK     (1 << 2)
43
44 #define IWINFO_AUTH_OPEN     (1 << 0)
45 #define IWINFO_AUTH_SHARED   (1 << 1)
46
47 extern const char *IWINFO_CIPHER_NAMES[];
48 extern const char *IWINFO_KMGMT_NAMES[];
49 extern const char *IWINFO_AUTH_NAMES[];
50
51
52 enum iwinfo_opmode {
53         IWINFO_OPMODE_UNKNOWN = 0,
54         IWINFO_OPMODE_MASTER  = 1,
55         IWINFO_OPMODE_ADHOC   = 2,
56         IWINFO_OPMODE_CLIENT  = 3,
57         IWINFO_OPMODE_MONITOR = 4,
58 };
59
60 extern const char *IWINFO_OPMODE_NAMES[];
61
62
63 struct iwinfo_rate_entry {
64         uint32_t rate;
65         int8_t mcs;
66         uint8_t is_40mhz:1;
67         uint8_t is_short_gi:1;
68 };
69
70 struct iwinfo_assoclist_entry {
71         uint8_t mac[6];
72         int8_t signal;
73         int8_t noise;
74         uint32_t inactive;
75         uint32_t rx_packets;
76         uint32_t tx_packets;
77         struct iwinfo_rate_entry rx_rate;
78         struct iwinfo_rate_entry tx_rate;
79 };
80
81 struct iwinfo_txpwrlist_entry {
82         uint8_t  dbm;
83         uint16_t mw;
84 };
85
86 struct iwinfo_freqlist_entry {
87         uint8_t channel;
88         uint32_t mhz;
89         uint8_t restricted;
90 };
91
92 struct iwinfo_crypto_entry {
93         uint8_t enabled;
94         uint8_t wpa_version;
95         uint8_t group_ciphers;
96         uint8_t pair_ciphers;
97         uint8_t auth_suites;
98         uint8_t auth_algs;
99 };
100
101 struct iwinfo_scanlist_entry {
102         uint8_t mac[6];
103         uint8_t ssid[IWINFO_ESSID_MAX_SIZE+1];
104         enum iwinfo_opmode mode;
105         uint8_t channel;
106         uint8_t signal;
107         uint8_t quality;
108         uint8_t quality_max;
109         struct iwinfo_crypto_entry crypto;
110 };
111
112 struct iwinfo_country_entry {
113         uint16_t iso3166;
114         uint8_t ccode[4];
115 };
116
117 struct iwinfo_iso3166_label {
118         uint16_t iso3166;
119         uint8_t  name[28];
120 };
121
122 struct iwinfo_hardware_id {
123         uint16_t vendor_id;
124         uint16_t device_id;
125         uint16_t subsystem_vendor_id;
126         uint16_t subsystem_device_id;
127 };
128
129 struct iwinfo_hardware_entry {
130         const char *vendor_name;
131         const char *device_name;
132         uint16_t vendor_id;
133         uint16_t device_id;
134         uint16_t subsystem_vendor_id;
135         uint16_t subsystem_device_id;
136         int16_t txpower_offset;
137         int16_t frequency_offset;
138 };
139
140 extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES[];
141 extern const struct iwinfo_hardware_entry IWINFO_HARDWARE_ENTRIES[];
142
143
144 struct iwinfo_ops {
145         int (*mode)(const char *, int *);
146         int (*channel)(const char *, int *);
147         int (*frequency)(const char *, int *);
148         int (*frequency_offset)(const char *, int *);
149         int (*txpower)(const char *, int *);
150         int (*txpower_offset)(const char *, int *);
151         int (*bitrate)(const char *, int *);
152         int (*signal)(const char *, int *);
153         int (*noise)(const char *, int *);
154         int (*quality)(const char *, int *);
155         int (*quality_max)(const char *, int *);
156         int (*mbssid_support)(const char *, int *);
157         int (*hwmodelist)(const char *, int *);
158         int (*ssid)(const char *, char *);
159         int (*bssid)(const char *, char *);
160         int (*country)(const char *, char *);
161         int (*hardware_id)(const char *, char *);
162         int (*hardware_name)(const char *, char *);
163         int (*encryption)(const char *, char *);
164         int (*assoclist)(const char *, char *, int *);
165         int (*txpwrlist)(const char *, char *, int *);
166         int (*scanlist)(const char *, char *, int *);
167         int (*freqlist)(const char *, char *, int *);
168         int (*countrylist)(const char *, char *, int *);
169         void (*close)(void);
170 };
171
172 const char * iwinfo_type(const char *ifname);
173 const struct iwinfo_ops * iwinfo_backend(const char *ifname);
174 void iwinfo_finish(void);
175
176 #include "iwinfo/wext.h"
177
178 #ifdef USE_WL
179 #include "iwinfo/wl.h"
180 #endif
181
182 #ifdef USE_MADWIFI
183 #include "iwinfo/madwifi.h"
184 #endif
185
186 #ifdef USE_NL80211
187 #include "iwinfo/nl80211.h"
188 #endif
189
190 #endif