Merge pull request #2874 from elfiesmelfie/feat_virt_block_info
[collectd.git] / src / madwifi.h
1 /**
2  * This file is compiled from several Madwifi header files.
3  * Original copyright is:
4  *
5  * Copyright (c) 2001 Atsushi Onoe
6  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * Alternatively, this software may be distributed under the terms of the
21  * GNU General Public License ("GPL") version 2 as published by the Free
22  * Software Foundation.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ifndef MADWIFI_H
37 #define MADWIFI_H
38
39 #define IEEE80211_ADDR_LEN              6               /* size of 802.11 address */
40 #define IEEE80211_RATE_VAL              0x7f
41 #define IEEE80211_RATE_SIZE             8               /* 802.11 standard */
42 #define IEEE80211_RATE_MAXSIZE          15              /* max rates we'll handle */
43
44
45 /*
46  * Per/node (station) statistics available when operating as an AP.
47  */
48 struct ieee80211_nodestats {
49         u_int32_t ns_rx_data;           /* rx data frames */
50         u_int32_t ns_rx_mgmt;           /* rx management frames */
51         u_int32_t ns_rx_ctrl;           /* rx control frames */
52         u_int32_t ns_rx_ucast;          /* rx unicast frames */
53         u_int32_t ns_rx_mcast;          /* rx multi/broadcast frames */
54         u_int64_t ns_rx_bytes;          /* rx data count (bytes) */
55         u_int64_t ns_rx_beacons;        /* rx beacon frames */
56         u_int32_t ns_rx_proberesp;      /* rx probe response frames */
57
58         u_int32_t ns_rx_dup;            /* rx discard because it's a dup */
59         u_int32_t ns_rx_noprivacy;      /* rx w/ wep but privacy off */
60         u_int32_t ns_rx_wepfail;        /* rx wep processing failed */
61         u_int32_t ns_rx_demicfail;      /* rx demic failed */
62         u_int32_t ns_rx_decap;          /* rx decapsulation failed */
63         u_int32_t ns_rx_defrag;         /* rx defragmentation failed */
64         u_int32_t ns_rx_disassoc;       /* rx disassociation */
65         u_int32_t ns_rx_deauth;         /* rx deauthentication */
66         u_int32_t ns_rx_decryptcrc;     /* rx decrypt failed on crc */
67         u_int32_t ns_rx_unauth;         /* rx on unauthorized port */
68         u_int32_t ns_rx_unencrypted;    /* rx unecrypted w/ privacy */
69
70         u_int32_t ns_tx_data;           /* tx data frames */
71         u_int32_t ns_tx_mgmt;           /* tx management frames */
72         u_int32_t ns_tx_ucast;          /* tx unicast frames */
73         u_int32_t ns_tx_mcast;          /* tx multi/broadcast frames */
74         u_int64_t ns_tx_bytes;          /* tx data count (bytes) */
75         u_int32_t ns_tx_probereq;       /* tx probe request frames */
76         u_int32_t ns_tx_uapsd;          /* tx on uapsd queue */
77
78         u_int32_t ns_tx_novlantag;      /* tx discard due to no tag */
79         u_int32_t ns_tx_vlanmismatch;   /* tx discard due to of bad tag */
80
81         u_int32_t ns_tx_eosplost;       /* uapsd EOSP retried out */
82
83         u_int32_t ns_ps_discard;        /* ps discard due to of age */
84
85         u_int32_t ns_uapsd_triggers;    /* uapsd triggers */
86
87         /* MIB-related state */
88         u_int32_t ns_tx_assoc;          /* [re]associations */
89         u_int32_t ns_tx_assoc_fail;     /* [re]association failures */
90         u_int32_t ns_tx_auth;           /* [re]authentications */
91         u_int32_t ns_tx_auth_fail;      /* [re]authentication failures*/
92         u_int32_t ns_tx_deauth;         /* deauthentications */
93         u_int32_t ns_tx_deauth_code;    /* last deauth reason */
94         u_int32_t ns_tx_disassoc;       /* disassociations */
95         u_int32_t ns_tx_disassoc_code;  /* last disassociation reason */
96         u_int32_t ns_psq_drops;         /* power save queue drops */
97 };
98
99 /*
100  * Summary statistics.
101  */
102 struct ieee80211_stats {
103         u_int32_t is_rx_badversion;     /* rx frame with bad version */
104         u_int32_t is_rx_tooshort;       /* rx frame too short */
105         u_int32_t is_rx_wrongbss;       /* rx from wrong bssid */
106         u_int32_t is_rx_dup;            /* rx discard due to it's a dup */
107         u_int32_t is_rx_wrongdir;       /* rx w/ wrong direction */
108         u_int32_t is_rx_mcastecho;      /* rx discard due to of mcast echo */
109         u_int32_t is_rx_notassoc;       /* rx discard due to sta !assoc */
110         u_int32_t is_rx_noprivacy;      /* rx w/ wep but privacy off */
111         u_int32_t is_rx_unencrypted;    /* rx w/o wep and privacy on */
112         u_int32_t is_rx_wepfail;        /* rx wep processing failed */
113         u_int32_t is_rx_decap;          /* rx decapsulation failed */
114         u_int32_t is_rx_mgtdiscard;     /* rx discard mgt frames */
115         u_int32_t is_rx_ctl;            /* rx discard ctrl frames */
116         u_int32_t is_rx_beacon;         /* rx beacon frames */
117         u_int32_t is_rx_rstoobig;       /* rx rate set truncated */
118         u_int32_t is_rx_elem_missing;   /* rx required element missing*/
119         u_int32_t is_rx_elem_toobig;    /* rx element too big */
120         u_int32_t is_rx_elem_toosmall;  /* rx element too small */
121         u_int32_t is_rx_elem_unknown;   /* rx element unknown */
122         u_int32_t is_rx_badchan;        /* rx frame w/ invalid chan */
123         u_int32_t is_rx_chanmismatch;   /* rx frame chan mismatch */
124         u_int32_t is_rx_nodealloc;      /* rx frame dropped */
125         u_int32_t is_rx_ssidmismatch;   /* rx frame ssid mismatch  */
126         u_int32_t is_rx_auth_unsupported;/* rx w/ unsupported auth alg */
127         u_int32_t is_rx_auth_fail;      /* rx sta auth failure */
128         u_int32_t is_rx_auth_countermeasures;/* rx auth discard due to CM */
129         u_int32_t is_rx_assoc_bss;      /* rx assoc from wrong bssid */
130         u_int32_t is_rx_assoc_notauth;  /* rx assoc w/o auth */
131         u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
132         u_int32_t is_rx_assoc_norate;   /* rx assoc w/ no rate match */
133         u_int32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */
134         u_int32_t is_rx_deauth;         /* rx deauthentication */
135         u_int32_t is_rx_disassoc;       /* rx disassociation */
136         u_int32_t is_rx_badsubtype;     /* rx frame w/ unknown subtype*/
137         u_int32_t is_rx_nobuf;          /* rx failed for lack of buf */
138         u_int32_t is_rx_decryptcrc;     /* rx decrypt failed on crc */
139         u_int32_t is_rx_ahdemo_mgt;     /* rx discard ahdemo mgt frame*/
140         u_int32_t is_rx_bad_auth;       /* rx bad auth request */
141         u_int32_t is_rx_unauth;         /* rx on unauthorized port */
142         u_int32_t is_rx_badkeyid;       /* rx w/ incorrect keyid */
143         u_int32_t is_rx_ccmpreplay;     /* rx seq# violation (CCMP) */
144         u_int32_t is_rx_ccmpformat;     /* rx format bad (CCMP) */
145         u_int32_t is_rx_ccmpmic;        /* rx MIC check failed (CCMP) */
146         u_int32_t is_rx_tkipreplay;     /* rx seq# violation (TKIP) */
147         u_int32_t is_rx_tkipformat;     /* rx format bad (TKIP) */
148         u_int32_t is_rx_tkipmic;        /* rx MIC check failed (TKIP) */
149         u_int32_t is_rx_tkipicv;        /* rx ICV check failed (TKIP) */
150         u_int32_t is_rx_badcipher;      /* rx failed due to of key type */
151         u_int32_t is_rx_nocipherctx;    /* rx failed due to key !setup */
152         u_int32_t is_rx_acl;            /* rx discard due to of acl policy */
153         u_int32_t is_rx_ffcnt;          /* rx fast frames */
154         u_int32_t is_rx_badathtnl;      /* driver key alloc failed */
155         u_int32_t is_tx_nobuf;          /* tx failed for lack of buf */
156         u_int32_t is_tx_nonode;         /* tx failed for no node */
157         u_int32_t is_tx_unknownmgt;     /* tx of unknown mgt frame */
158         u_int32_t is_tx_badcipher;      /* tx failed due to of key type */
159         u_int32_t is_tx_nodefkey;       /* tx failed due to no defkey */
160         u_int32_t is_tx_noheadroom;     /* tx failed due to no space */
161         u_int32_t is_tx_ffokcnt;        /* tx fast frames sent success */
162         u_int32_t is_tx_fferrcnt;       /* tx fast frames sent success */
163         u_int32_t is_scan_active;       /* active scans started */
164         u_int32_t is_scan_passive;      /* passive scans started */
165         u_int32_t is_node_timeout;      /* nodes timed out inactivity */
166         u_int32_t is_crypto_nomem;      /* no memory for crypto ctx */
167         u_int32_t is_crypto_tkip;       /* tkip crypto done in s/w */
168         u_int32_t is_crypto_tkipenmic;  /* tkip en-MIC done in s/w */
169         u_int32_t is_crypto_tkipdemic;  /* tkip de-MIC done in s/w */
170         u_int32_t is_crypto_tkipcm;     /* tkip counter measures */
171         u_int32_t is_crypto_ccmp;       /* ccmp crypto done in s/w */
172         u_int32_t is_crypto_wep;        /* wep crypto done in s/w */
173         u_int32_t is_crypto_setkey_cipher;/* cipher rejected key */
174         u_int32_t is_crypto_setkey_nokey;/* no key index for setkey */
175         u_int32_t is_crypto_delkey;     /* driver key delete failed */
176         u_int32_t is_crypto_badcipher;  /* unknown cipher */
177         u_int32_t is_crypto_nocipher;   /* cipher not available */
178         u_int32_t is_crypto_attachfail; /* cipher attach failed */
179         u_int32_t is_crypto_swfallback; /* cipher fallback to s/w */
180         u_int32_t is_crypto_keyfail;    /* driver key alloc failed */
181         u_int32_t is_crypto_enmicfail;  /* en-MIC failed */
182         u_int32_t is_ibss_capmismatch;  /* merge failed-cap mismatch */
183         u_int32_t is_ibss_norate;       /* merge failed-rate mismatch */
184         u_int32_t is_ps_unassoc;        /* ps-poll for unassoc. sta */
185         u_int32_t is_ps_badaid;         /* ps-poll w/ incorrect aid */
186         u_int32_t is_ps_qempty;         /* ps-poll w/ nothing to send */
187 };
188
189 /*
190  * Retrieve per-node statistics.
191  */
192 struct ieee80211req_sta_stats {
193         union {
194                 /* NB: explicitly force 64-bit alignment */
195                 u_int8_t macaddr[IEEE80211_ADDR_LEN];
196                 u_int64_t pad;
197         } is_u;
198         struct ieee80211_nodestats is_stats;
199 };
200
201 /*
202  * Station information block; the mac address is used
203  * to retrieve other data like stats, unicast key, etc.
204  */
205 struct ieee80211req_sta_info {
206         u_int16_t isi_len;              /* length (mult of 4) */
207         u_int16_t isi_freq;             /* MHz */
208         u_int16_t isi_flags;            /* channel flags */
209         u_int16_t isi_state;            /* state flags */
210         u_int8_t isi_authmode;          /* authentication algorithm */
211         u_int8_t isi_rssi;
212         u_int16_t isi_capinfo;          /* capabilities */
213         u_int8_t isi_athflags;          /* Atheros capabilities */
214         u_int8_t isi_erp;               /* ERP element */
215         u_int8_t isi_macaddr[IEEE80211_ADDR_LEN];
216         u_int8_t isi_nrates;            /* negotiated rates */
217         u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE];
218         u_int8_t isi_txrate;            /* index to isi_rates[] */
219         u_int16_t isi_ie_len;           /* IE length */
220         u_int16_t isi_associd;          /* assoc response */
221         u_int16_t isi_txpower;          /* current tx power */
222         u_int16_t isi_vlan;             /* vlan tag */
223         u_int16_t isi_txseqs[17];       /* seq to be transmitted */
224         u_int16_t isi_rxseqs[17];       /* seq previous for qos frames*/
225         u_int16_t isi_inact;            /* inactivity timer */
226         u_int8_t isi_uapsd;             /* UAPSD queues */
227         u_int8_t isi_opmode;            /* sta operating mode */
228
229         /* XXX frag state? */
230         /* variable length IE data */
231 };
232
233
234 struct ath_stats {
235         u_int32_t ast_watchdog;         /* device reset by watchdog */
236         u_int32_t ast_hardware;         /* fatal hardware error interrupts */
237         u_int32_t ast_bmiss;            /* beacon miss interrupts */
238         u_int32_t ast_rxorn;            /* rx overrun interrupts */
239         u_int32_t ast_rxeol;            /* rx eol interrupts */
240         u_int32_t ast_txurn;            /* tx underrun interrupts */
241         u_int32_t ast_mib;              /* mib interrupts */
242         u_int32_t ast_tx_packets;       /* packet sent on the interface */
243         u_int32_t ast_tx_mgmt;          /* management frames transmitted */
244         u_int32_t ast_tx_discard;       /* frames discarded prior to assoc */
245         u_int32_t ast_tx_invalid;       /* frames discarded due to is device gone */
246         u_int32_t ast_tx_qstop;         /* tx queue stopped because it's full */
247         u_int32_t ast_tx_encap;         /* tx encapsulation failed */
248         u_int32_t ast_tx_nonode;        /* tx failed due to of no node */
249         u_int32_t ast_tx_nobuf;         /* tx failed due to of no tx buffer (data) */
250         u_int32_t ast_tx_nobufmgt;      /* tx failed due to of no tx buffer (mgmt)*/
251         u_int32_t ast_tx_xretries;      /* tx failed due to of too many retries */
252         u_int32_t ast_tx_fifoerr;       /* tx failed due to of FIFO underrun */
253         u_int32_t ast_tx_filtered;      /* tx failed due to xmit filtered */
254         u_int32_t ast_tx_shortretry;    /* tx on-chip retries (short) */
255         u_int32_t ast_tx_longretry;     /* tx on-chip retries (long) */
256         u_int32_t ast_tx_badrate;       /* tx failed due to of bogus xmit rate */
257         u_int32_t ast_tx_noack;         /* tx frames with no ack marked */
258         u_int32_t ast_tx_rts;           /* tx frames with rts enabled */
259         u_int32_t ast_tx_cts;           /* tx frames with cts enabled */
260         u_int32_t ast_tx_shortpre;      /* tx frames with short preamble */
261         u_int32_t ast_tx_altrate;       /* tx frames with alternate rate */
262         u_int32_t ast_tx_protect;       /* tx frames with protection */
263         u_int32_t ast_rx_orn;           /* rx failed due to of desc overrun */
264         u_int32_t ast_rx_crcerr;        /* rx failed due to of bad CRC */
265         u_int32_t ast_rx_fifoerr;       /* rx failed due to of FIFO overrun */
266         u_int32_t ast_rx_badcrypt;      /* rx failed due to of decryption */
267         u_int32_t ast_rx_badmic;        /* rx failed due to of MIC failure */
268         u_int32_t ast_rx_phyerr;        /* rx PHY error summary count */
269         u_int32_t ast_rx_phy[32];       /* rx PHY error per-code counts */
270         u_int32_t ast_rx_tooshort;      /* rx discarded due to frame too short */
271         u_int32_t ast_rx_toobig;        /* rx discarded due to frame too large */
272         u_int32_t ast_rx_nobuf;         /* rx setup failed due to of no skbuff */
273         u_int32_t ast_rx_packets;       /* packet recv on the interface */
274         u_int32_t ast_rx_mgt;           /* management frames received */
275         u_int32_t ast_rx_ctl;           /* control frames received */
276         int8_t ast_tx_rssi;             /* tx rssi of last ack */
277         int8_t ast_rx_rssi;             /* rx rssi from histogram */
278         u_int32_t ast_be_xmit;          /* beacons transmitted */
279         u_int32_t ast_be_nobuf;         /* no skbuff available for beacon */
280         u_int32_t ast_per_cal;          /* periodic calibration calls */
281         u_int32_t ast_per_calfail;      /* periodic calibration failed */
282         u_int32_t ast_per_rfgain;       /* periodic calibration rfgain reset */
283         u_int32_t ast_rate_calls;       /* rate control checks */
284         u_int32_t ast_rate_raise;       /* rate control raised xmit rate */
285         u_int32_t ast_rate_drop;        /* rate control dropped xmit rate */
286         u_int32_t ast_ant_defswitch;    /* rx/default antenna switches */
287         u_int32_t ast_ant_txswitch;     /* tx antenna switches */
288         u_int32_t ast_ant_rx[8];        /* rx frames with antenna */
289         u_int32_t ast_ant_tx[8];        /* tx frames with antenna */
290 };
291
292 #define SIOCGATHSTATS                   (SIOCDEVPRIVATE+0)
293 #define SIOCGATHDIAG                    (SIOCDEVPRIVATE+1)
294 #define SIOCGATHRADARSIG                (SIOCDEVPRIVATE+2)
295 #define SIOCGATHHALDIAG                 (SIOCDEVPRIVATE+3)
296 #define SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
297 /* NB: require in+out parameters so cannot use wireless extensions, yech */
298 #define IEEE80211_IOCTL_GETKEY          (SIOCDEVPRIVATE+3)
299 #define IEEE80211_IOCTL_GETWPAIE        (SIOCDEVPRIVATE+4)
300 #define IEEE80211_IOCTL_STA_STATS       (SIOCDEVPRIVATE+5)
301 #define IEEE80211_IOCTL_STA_INFO        (SIOCDEVPRIVATE+6)
302 #define SIOC80211IFCREATE               (SIOCDEVPRIVATE+7)
303 #define SIOC80211IFDESTROY              (SIOCDEVPRIVATE+8)
304 #define IEEE80211_IOCTL_SCAN_RESULTS    (SIOCDEVPRIVATE+9)
305
306
307 #endif