]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/hostapd.h
Support HT capability overrides
[thirdparty/hostap.git] / src / ap / hostapd.h
CommitLineData
6fc6879b
JM
1/*
2 * hostapd / Initialization and configuration
45cefa0b 3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
6fc6879b
JM
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef HOSTAPD_H
16#define HOSTAPD_H
17
45cefa0b
JM
18#include "common/defs.h"
19
c5121837 20struct wpa_driver_ops;
6fc6879b
JM
21struct wpa_ctrl_dst;
22struct radius_server_data;
f620268f 23struct upnp_wps_device_sm;
9969e5a4 24struct hapd_interfaces;
bf65bc63 25struct hostapd_data;
45cefa0b 26struct sta_info;
a3d4fafa 27struct hostap_sta_driver_data;
2ce86d9d 28struct ieee80211_ht_capabilities;
6fc6879b 29struct full_dynamic_vlan;
a0dee797
AGS
30enum wps_event;
31union wps_event_data;
6fc6879b 32
fa16028d 33struct hostapd_probereq_cb {
04a85e44
JM
34 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
35 const u8 *ie, size_t ie_len);
fa16028d
JM
36 void *ctx;
37};
38
fb7842aa
JM
39#define HOSTAPD_RATE_BASIC 0x00000001
40
41struct hostapd_rate_data {
42 int rate; /* rate in 100 kbps */
43 int flags; /* HOSTAPD_RATE_ flags */
44};
45
2a8b7416
JM
46struct hostapd_frame_info {
47 u32 channel;
48 u32 datarate;
49 u32 ssi_signal;
50};
51
fb7842aa 52
6fc6879b
JM
53/**
54 * struct hostapd_data - hostapd per-BSS data structure
55 */
56struct hostapd_data {
57 struct hostapd_iface *iface;
58 struct hostapd_config *iconf;
59 struct hostapd_bss_config *conf;
60 int interface_added; /* virtual interface added for this BSS */
61
62 u8 own_addr[ETH_ALEN];
63
64 int num_sta; /* number of entries in sta_list */
65 struct sta_info *sta_list; /* STA info list head */
2991469c
JM
66#define STA_HASH_SIZE 256
67#define STA_HASH(sta) (sta[5])
6fc6879b
JM
68 struct sta_info *sta_hash[STA_HASH_SIZE];
69
2991469c
JM
70 /*
71 * Bitfield for indicating which AIDs are allocated. Only AID values
72 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
73 * 1.
6fc6879b 74 */
2991469c
JM
75#define AID_WORDS ((2008 + 31) / 32)
76 u32 sta_aid[AID_WORDS];
6fc6879b 77
c5121837 78 const struct wpa_driver_ops *driver;
6fc6879b
JM
79 void *drv_priv;
80
d24df7c3
JM
81 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
82 struct sta_info *sta, int reassoc);
83
4f760fcc 84 void *msg_ctx; /* ctx for wpa_msg() calls */
8a5e75f6 85 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
4f760fcc 86
6fc6879b 87 struct radius_client_data *radius;
6fc6879b
JM
88 u32 acct_session_id_hi, acct_session_id_lo;
89
90 struct iapp_data *iapp;
91
6fc6879b
JM
92 struct hostapd_cached_radius_acl *acl_cache;
93 struct hostapd_acl_query_data *acl_queries;
94
95 struct wpa_authenticator *wpa_auth;
96 struct eapol_authenticator *eapol_auth;
97
98 struct rsn_preauth_interface *preauth_iface;
99 time_t michael_mic_failure;
100 int michael_mic_failures;
101 int tkip_countermeasures;
102
103 int ctrl_sock;
104 struct wpa_ctrl_dst *ctrl_dst;
105
106 void *ssl_ctx;
107 void *eap_sim_db_priv;
108 struct radius_server_data *radius_srv;
109
110 int parameter_set_count;
111
39b97072
JM
112 /* Time Advertisement */
113 u8 time_update_counter;
114 struct wpabuf *time_adv;
115
6fc6879b
JM
116#ifdef CONFIG_FULL_DYNAMIC_VLAN
117 struct full_dynamic_vlan *full_dynamic_vlan;
118#endif /* CONFIG_FULL_DYNAMIC_VLAN */
119
120 struct l2_packet_data *l2;
ad08c363
JM
121 struct wps_context *wps;
122
bc45d427 123 int beacon_set_done;
14f79386
JM
124 struct wpabuf *wps_beacon_ie;
125 struct wpabuf *wps_probe_resp_ie;
84312359 126#ifdef CONFIG_WPS
3b2cf800 127 unsigned int ap_pin_failures;
f620268f 128 struct upnp_wps_device_sm *wps_upnp;
94481410 129 unsigned int ap_pin_lockout_time;
ad08c363 130#endif /* CONFIG_WPS */
fa16028d
JM
131
132 struct hostapd_probereq_cb *probereq_cb;
133 size_t num_probereq_cb;
195420b8 134
c706d5aa
JM
135 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
136 int freq);
137 void *public_action_cb_ctx;
138
e44f8bf2
JM
139 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
140 int freq);
141 void *vendor_action_cb_ctx;
142
195420b8
JM
143 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
144 const u8 *uuid_e);
145 void *wps_reg_success_cb_ctx;
c2af2afb 146
a0dee797
AGS
147 void (*wps_event_cb)(void *ctx, enum wps_event event,
148 union wps_event_data *data);
149 void *wps_event_cb_ctx;
150
0661eed2 151 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
fbdcfd57 152 int authorized, const u8 *p2p_dev_addr);
0661eed2
JB
153 void *sta_authorized_cb_ctx;
154
c76e5d7f
JB
155 void (*setup_complete_cb)(void *ctx);
156 void *setup_complete_cb_ctx;
157
c2af2afb 158#ifdef CONFIG_P2P
e44f8bf2
JM
159 struct p2p_data *p2p;
160 struct p2p_group *p2p_group;
c2af2afb
JM
161 struct wpabuf *p2p_beacon_ie;
162 struct wpabuf *p2p_probe_resp_ie;
aefb53bd
JM
163
164 /* Number of non-P2P association stations */
165 int num_sta_no_p2p;
166
167 /* Periodic NoA (used only when no non-P2P clients in the group) */
168 int noa_enabled;
169 int noa_start;
170 int noa_duration;
c2af2afb 171#endif /* CONFIG_P2P */
6fc6879b
JM
172};
173
174
6fc6879b
JM
175/**
176 * struct hostapd_iface - hostapd per-interface data structure
177 */
178struct hostapd_iface {
9969e5a4 179 struct hapd_interfaces *interfaces;
0f2b2c19 180 void *owner;
32da61d9 181 int (*reload_config)(struct hostapd_iface *iface);
41d719d6 182 struct hostapd_config * (*config_read_cb)(const char *config_fname);
6fc6879b
JM
183 char *config_fname;
184 struct hostapd_config *conf;
185
6fc6879b
JM
186 size_t num_bss;
187 struct hostapd_data **bss;
188
189 int num_ap; /* number of entries in ap_list */
190 struct ap_info *ap_list; /* AP info list head */
191 struct ap_info *ap_hash[STA_HASH_SIZE];
192 struct ap_info *ap_iter_list;
193
2fee890a 194 unsigned int drv_flags;
4f73d88a
AN
195
196 /*
197 * A bitmap of supported protocols for probe response offload. See
198 * struct wpa_driver_capa in driver.h
199 */
200 unsigned int probe_resp_offloads;
201
6fc6879b
JM
202 struct hostapd_hw_modes *hw_features;
203 int num_hw_features;
204 struct hostapd_hw_modes *current_mode;
205 /* Rates that are currently used (i.e., filtered copy of
206 * current_mode->channels */
207 int num_rates;
208 struct hostapd_rate_data *current_rates;
e5693c47 209 int *basic_rates;
c706d5aa 210 int freq;
6fc6879b
JM
211
212 u16 hw_flags;
213
214 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
215 * in 802.11g BSS) */
216 int num_sta_non_erp;
217
218 /* Number of associated stations that do not support Short Slot Time */
219 int num_sta_no_short_slot_time;
220
221 /* Number of associated stations that do not support Short Preamble */
222 int num_sta_no_short_preamble;
223
224 int olbc; /* Overlapping Legacy BSS Condition */
225
de9289c8
JM
226 /* Number of HT associated stations that do not support greenfield */
227 int num_sta_ht_no_gf;
228
229 /* Number of associated non-HT stations */
230 int num_sta_no_ht;
231
232 /* Number of HT associated stations 20 MHz */
233 int num_sta_ht_20mhz;
234
235 /* Overlapping BSS information */
236 int olbc_ht;
237
edd360e1 238 u16 ht_op_mode;
ad1e68e6 239 void (*scan_cb)(struct hostapd_iface *iface);
70db2ab3
JM
240
241 int (*ctrl_iface_init)(struct hostapd_data *hapd);
242 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
1b56c26c
JM
243
244 int (*for_each_interface)(struct hapd_interfaces *interfaces,
245 int (*cb)(struct hostapd_iface *iface,
246 void *ctx), void *ctx);
6fc6879b
JM
247};
248
a4f21109 249/* hostapd.c */
ad08c363 250int hostapd_reload_config(struct hostapd_iface *iface);
b6a7859d
JM
251struct hostapd_data *
252hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
253 struct hostapd_config *conf,
254 struct hostapd_bss_config *bss);
5c333467 255int hostapd_setup_interface(struct hostapd_iface *iface);
ad1e68e6 256int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
5c333467 257void hostapd_interface_deinit(struct hostapd_iface *iface);
f7c47833 258void hostapd_interface_free(struct hostapd_iface *iface);
a4f21109
JM
259void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
260 int reassoc);
5c333467 261
a4f21109 262/* utils.c */
fa16028d 263int hostapd_register_probereq_cb(struct hostapd_data *hapd,
cd7d80f3 264 int (*cb)(void *ctx, const u8 *sa,
04a85e44 265 const u8 *da, const u8 *bssid,
cd7d80f3 266 const u8 *ie, size_t ie_len),
fa16028d 267 void *ctx);
0aef3ec8 268void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
fa16028d 269
1d041bec
JM
270/* drv_callbacks.c (TODO: move to somewhere else?) */
271int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
39b08b5f 272 const u8 *ie, size_t ielen, int reassoc);
1d041bec 273void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
0d7e5a3a 274void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
04a85e44
JM
275int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
276 const u8 *bssid, const u8 *ie, size_t ie_len);
1d041bec 277
6fc6879b 278#endif /* HOSTAPD_H */