5454812fa18d31113b6496fdeba6579377d5b108
[libeap.git] / hostapd / ieee802_11.h
1 /*
2  * hostapd / IEEE 802.11 Management
3  * Copyright (c) 2002-2006, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2007-2008, Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * Alternatively, this software may be distributed under the terms of BSD
11  * license.
12  *
13  * See README and COPYING for more details.
14  */
15
16 #ifndef IEEE802_11_H
17 #define IEEE802_11_H
18
19 #include "ieee802_11_defs.h"
20
21 /* Parsed Information Elements */
22 struct ieee802_11_elems {
23         u8 *ssid;
24         u8 ssid_len;
25         u8 *supp_rates;
26         u8 supp_rates_len;
27         u8 *fh_params;
28         u8 fh_params_len;
29         u8 *ds_params;
30         u8 ds_params_len;
31         u8 *cf_params;
32         u8 cf_params_len;
33         u8 *tim;
34         u8 tim_len;
35         u8 *ibss_params;
36         u8 ibss_params_len;
37         u8 *challenge;
38         u8 challenge_len;
39         u8 *erp_info;
40         u8 erp_info_len;
41         u8 *ext_supp_rates;
42         u8 ext_supp_rates_len;
43         u8 *wpa_ie;
44         u8 wpa_ie_len;
45         u8 *rsn_ie;
46         u8 rsn_ie_len;
47         u8 *wme;
48         u8 wme_len;
49         u8 *wme_tspec;
50         u8 wme_tspec_len;
51         u8 *power_cap;
52         u8 power_cap_len;
53         u8 *supp_channels;
54         u8 supp_channels_len;
55         u8 *mdie;
56         u8 mdie_len;
57         u8 *ftie;
58         u8 ftie_len;
59         u8 *ht_capabilities;
60         u8 ht_capabilities_len;
61         u8 *ht_operation;
62         u8 ht_operation_len;
63 };
64
65 typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
66
67
68 struct hostapd_frame_info {
69         u32 phytype;
70         u32 channel;
71         u32 datarate;
72         u32 ssi_signal;
73
74         unsigned int passive_scan:1;
75 };
76
77 struct hostapd_iface;
78 struct hostapd_data;
79 struct sta_info;
80
81 void ieee802_11_send_deauth(struct hostapd_data *hapd, u8 *addr, u16 reason);
82 void ieee802_11_mgmt(struct hostapd_data *hapd, u8 *buf, size_t len,
83                      u16 stype, struct hostapd_frame_info *fi);
84 void ieee802_11_mgmt_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
85                         u16 stype, int ok);
86 ParseRes ieee802_11_parse_elems(u8 *start, size_t len,
87                                 struct ieee802_11_elems *elems,
88                                 int show_errors);
89 void ieee802_11_print_ssid(char *buf, const u8 *ssid, u8 len);
90 void ieee80211_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr,
91                                    int local);
92 int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
93 int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
94                            char *buf, size_t buflen);
95 u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
96                            int probe);
97 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
98 u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid);
99 u8 * hostapd_eid_ht_capabilities_info(struct hostapd_data *hapd, u8 *eid);
100 u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid);
101 int hostapd_ht_operation_update(struct hostapd_iface *iface);
102
103 #endif /* IEEE802_11_H */