Merge from vendor branch FILE:
[dragonfly.git] / contrib / hostapd-0.4.9 / ieee802_11.h
1 #ifndef IEEE802_11_H
2 #define IEEE802_11_H
3
4
5 struct ieee80211_mgmt {
6         u16 frame_control;
7         u16 duration;
8         u8 da[6];
9         u8 sa[6];
10         u8 bssid[6];
11         u16 seq_ctrl;
12         union {
13                 struct {
14                         u16 auth_alg;
15                         u16 auth_transaction;
16                         u16 status_code;
17                         /* possibly followed by Challenge text */
18                         u8 variable[0];
19                 } __attribute__ ((packed)) auth;
20                 struct {
21                         u16 reason_code;
22                 } __attribute__ ((packed)) deauth;
23                 struct {
24                         u16 capab_info;
25                         u16 listen_interval;
26                         /* followed by SSID and Supported rates */
27                         u8 variable[0];
28                 } __attribute__ ((packed)) assoc_req;
29                 struct {
30                         u16 capab_info;
31                         u16 status_code;
32                         u16 aid;
33                         /* followed by Supported rates */
34                         u8 variable[0];
35                 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
36                 struct {
37                         u16 capab_info;
38                         u16 listen_interval;
39                         u8 current_ap[6];
40                         /* followed by SSID and Supported rates */
41                         u8 variable[0];
42                 } __attribute__ ((packed)) reassoc_req;
43                 struct {
44                         u16 reason_code;
45                 } __attribute__ ((packed)) disassoc;
46                 struct {
47                         u8 timestamp[8];
48                         u16 beacon_int;
49                         u16 capab_info;
50                         /* followed by some of SSID, Supported rates,
51                          * FH Params, DS Params, CF Params, IBSS Params, TIM */
52                         u8 variable[0];
53                 } __attribute__ ((packed)) beacon;
54         } u;
55 } __attribute__ ((packed));
56
57
58 /* Parsed Information Elements */
59 struct ieee802_11_elems {
60         u8 *ssid;
61         u8 ssid_len;
62         u8 *supp_rates;
63         u8 supp_rates_len;
64         u8 *fh_params;
65         u8 fh_params_len;
66         u8 *ds_params;
67         u8 ds_params_len;
68         u8 *cf_params;
69         u8 cf_params_len;
70         u8 *tim;
71         u8 tim_len;
72         u8 *ibss_params;
73         u8 ibss_params_len;
74         u8 *challenge;
75         u8 challenge_len;
76         u8 *wpa_ie;
77         u8 wpa_ie_len;
78         u8 *rsn_ie;
79         u8 rsn_ie_len;
80 };
81
82 typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
83
84
85 void ieee802_11_mgmt(struct hostapd_data *hapd, u8 *buf, size_t len,
86                      u16 stype);
87 void ieee802_11_mgmt_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
88                         u16 stype, int ok);
89 ParseRes ieee802_11_parse_elems(struct hostapd_data *hapd, u8 *start,
90                                 size_t len,
91                                 struct ieee802_11_elems *elems,
92                                 int show_errors);
93 void ieee80211_michael_mic_failure(struct hostapd_data *hapd, u8 *addr,
94                                    int local);
95 int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
96 int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
97                            char *buf, size_t buflen);
98
99 #endif /* IEEE802_11_H */