Remove unused/unneeded IEEE 802.11n definitions
[libeap.git] / hostapd / hostapd.h
1 /*
2  * hostapd / Initialization and configuration
3  * Host AP kernel driver
4  * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
5  * Copyright (c) 2007-2008, Intel Corporation
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * Alternatively, this software may be distributed under the terms of BSD
12  * license.
13  *
14  * See README and COPYING for more details.
15  */
16
17 #ifndef HOSTAPD_H
18 #define HOSTAPD_H
19
20 #include "common.h"
21
22 #define MAX_VLAN_ID 4094
23
24 struct wpa_driver_ops;
25 struct wpa_ctrl_dst;
26 struct radius_server_data;
27 struct upnp_wps_device_sm;
28
29 #ifdef CONFIG_FULL_DYNAMIC_VLAN
30 struct full_dynamic_vlan;
31 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
32
33 struct hostapd_probereq_cb {
34         void (*cb)(void *ctx, const u8 *sa, const u8 *ie, size_t ie_len);
35         void *ctx;
36 };
37
38 /**
39  * struct hostapd_data - hostapd per-BSS data structure
40  */
41 struct hostapd_data {
42         struct hostapd_iface *iface;
43         struct hostapd_config *iconf;
44         struct hostapd_bss_config *conf;
45         int interface_added; /* virtual interface added for this BSS */
46
47         u8 own_addr[ETH_ALEN];
48
49         int num_sta; /* number of entries in sta_list */
50         struct sta_info *sta_list; /* STA info list head */
51 #define STA_HASH_SIZE 256
52 #define STA_HASH(sta) (sta[5])
53         struct sta_info *sta_hash[STA_HASH_SIZE];
54
55         /*
56          * Bitfield for indicating which AIDs are allocated. Only AID values
57          * 1-2007 are used and as such, the bit at index 0 corresponds to AID
58          * 1.
59          */
60 #define AID_WORDS ((2008 + 31) / 32)
61         u32 sta_aid[AID_WORDS];
62
63         const struct wpa_driver_ops *driver;
64         void *drv_priv;
65
66         void *msg_ctx; /* ctx for wpa_msg() calls */
67
68         struct radius_client_data *radius;
69         int radius_client_reconfigured;
70         u32 acct_session_id_hi, acct_session_id_lo;
71
72         struct iapp_data *iapp;
73
74         struct hostapd_cached_radius_acl *acl_cache;
75         struct hostapd_acl_query_data *acl_queries;
76
77         struct wpa_authenticator *wpa_auth;
78         struct eapol_authenticator *eapol_auth;
79
80         struct rsn_preauth_interface *preauth_iface;
81         time_t michael_mic_failure;
82         int michael_mic_failures;
83         int tkip_countermeasures;
84
85         int ctrl_sock;
86         struct wpa_ctrl_dst *ctrl_dst;
87
88         void *ssl_ctx;
89         void *eap_sim_db_priv;
90         struct radius_server_data *radius_srv;
91
92         int parameter_set_count;
93
94 #ifdef CONFIG_FULL_DYNAMIC_VLAN
95         struct full_dynamic_vlan *full_dynamic_vlan;
96 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
97
98         struct l2_packet_data *l2;
99         struct wps_context *wps;
100
101 #ifdef CONFIG_WPS
102         u8 *wps_beacon_ie;
103         size_t wps_beacon_ie_len;
104         u8 *wps_probe_resp_ie;
105         size_t wps_probe_resp_ie_len;
106         unsigned int ap_pin_failures;
107         struct upnp_wps_device_sm *wps_upnp;
108 #endif /* CONFIG_WPS */
109
110         struct hostapd_probereq_cb *probereq_cb;
111         size_t num_probereq_cb;
112 };
113
114
115 /**
116  * struct hostapd_iface - hostapd per-interface data structure
117  */
118 struct hostapd_iface {
119         void *owner;
120         char *config_fname;
121         struct hostapd_config *conf;
122
123         size_t num_bss;
124         struct hostapd_data **bss;
125
126         int num_ap; /* number of entries in ap_list */
127         struct ap_info *ap_list; /* AP info list head */
128         struct ap_info *ap_hash[STA_HASH_SIZE];
129         struct ap_info *ap_iter_list;
130
131         struct hostapd_hw_modes *hw_features;
132         int num_hw_features;
133         struct hostapd_hw_modes *current_mode;
134         /* Rates that are currently used (i.e., filtered copy of
135          * current_mode->channels */
136         int num_rates;
137         struct hostapd_rate_data *current_rates;
138
139         u16 hw_flags;
140
141         /* Number of associated Non-ERP stations (i.e., stations using 802.11b
142          * in 802.11g BSS) */
143         int num_sta_non_erp;
144
145         /* Number of associated stations that do not support Short Slot Time */
146         int num_sta_no_short_slot_time;
147
148         /* Number of associated stations that do not support Short Preamble */
149         int num_sta_no_short_preamble;
150
151         int olbc; /* Overlapping Legacy BSS Condition */
152
153         /* Number of HT associated stations that do not support greenfield */
154         int num_sta_ht_no_gf;
155
156         /* Number of associated non-HT stations */
157         int num_sta_no_ht;
158
159         /* Number of HT associated stations 20 MHz */
160         int num_sta_ht_20mhz;
161
162         /* Overlapping BSS information */
163         int olbc_ht;
164
165         u16 ht_op_mode;
166         void (*scan_cb)(struct hostapd_iface *iface);
167 };
168
169 int hostapd_reload_config(struct hostapd_iface *iface);
170 struct hostapd_data *
171 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
172                        struct hostapd_config *conf,
173                        struct hostapd_bss_config *bss);
174 int hostapd_setup_interface(struct hostapd_iface *iface);
175 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
176 void hostapd_interface_deinit(struct hostapd_iface *iface);
177 int handle_reload_iface(struct hostapd_iface *iface, void *ctx);
178 int handle_dump_state_iface(struct hostapd_iface *iface, void *ctx);
179
180 int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
181                                          void *ctx), void *ctx);
182
183 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
184                                  void (*cb)(void *ctx, const u8 *sa,
185                                             const u8 *ie, size_t ie_len),
186                                  void *ctx);
187
188 #endif /* HOSTAPD_H */