]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/hostapd.h
hostapd: Allow addition of arbitrary RADIUS attributes
[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 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
6fc6879b
JM
7 */
8
9#ifndef HOSTAPD_H
10#define HOSTAPD_H
11
45cefa0b
JM
12#include "common/defs.h"
13
c5121837 14struct wpa_driver_ops;
6fc6879b
JM
15struct wpa_ctrl_dst;
16struct radius_server_data;
f620268f 17struct upnp_wps_device_sm;
bf65bc63 18struct hostapd_data;
45cefa0b 19struct sta_info;
a3d4fafa 20struct hostap_sta_driver_data;
2ce86d9d 21struct ieee80211_ht_capabilities;
6fc6879b 22struct full_dynamic_vlan;
a0dee797
AGS
23enum wps_event;
24union wps_event_data;
6fc6879b 25
07bcdbb1
JM
26struct hapd_interfaces {
27 size_t count;
28 struct hostapd_iface **iface;
29};
30
31
fa16028d 32struct hostapd_probereq_cb {
04a85e44 33 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
baf513d6 34 const u8 *ie, size_t ie_len, int ssi_signal);
fa16028d
JM
35 void *ctx;
36};
37
fb7842aa
JM
38#define HOSTAPD_RATE_BASIC 0x00000001
39
40struct hostapd_rate_data {
41 int rate; /* rate in 100 kbps */
42 int flags; /* HOSTAPD_RATE_ flags */
43};
44
2a8b7416
JM
45struct hostapd_frame_info {
46 u32 channel;
47 u32 datarate;
baf513d6 48 int ssi_signal; /* dBm */
2a8b7416
JM
49};
50
fb7842aa 51
6fc6879b
JM
52/**
53 * struct hostapd_data - hostapd per-BSS data structure
54 */
55struct hostapd_data {
56 struct hostapd_iface *iface;
57 struct hostapd_config *iconf;
58 struct hostapd_bss_config *conf;
59 int interface_added; /* virtual interface added for this BSS */
60
61 u8 own_addr[ETH_ALEN];
62
63 int num_sta; /* number of entries in sta_list */
64 struct sta_info *sta_list; /* STA info list head */
2991469c
JM
65#define STA_HASH_SIZE 256
66#define STA_HASH(sta) (sta[5])
6fc6879b
JM
67 struct sta_info *sta_hash[STA_HASH_SIZE];
68
2991469c
JM
69 /*
70 * Bitfield for indicating which AIDs are allocated. Only AID values
71 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
72 * 1.
6fc6879b 73 */
2991469c
JM
74#define AID_WORDS ((2008 + 31) / 32)
75 u32 sta_aid[AID_WORDS];
6fc6879b 76
c5121837 77 const struct wpa_driver_ops *driver;
6fc6879b
JM
78 void *drv_priv;
79
d24df7c3
JM
80 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
81 struct sta_info *sta, int reassoc);
82
4f760fcc 83 void *msg_ctx; /* ctx for wpa_msg() calls */
8a5e75f6 84 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
4f760fcc 85
6fc6879b 86 struct radius_client_data *radius;
6fc6879b
JM
87 u32 acct_session_id_hi, acct_session_id_lo;
88
89 struct iapp_data *iapp;
90
6fc6879b
JM
91 struct hostapd_cached_radius_acl *acl_cache;
92 struct hostapd_acl_query_data *acl_queries;
93
94 struct wpa_authenticator *wpa_auth;
95 struct eapol_authenticator *eapol_auth;
96
97 struct rsn_preauth_interface *preauth_iface;
98 time_t michael_mic_failure;
99 int michael_mic_failures;
100 int tkip_countermeasures;
101
102 int ctrl_sock;
103 struct wpa_ctrl_dst *ctrl_dst;
104
105 void *ssl_ctx;
106 void *eap_sim_db_priv;
107 struct radius_server_data *radius_srv;
108
109 int parameter_set_count;
110
39b97072
JM
111 /* Time Advertisement */
112 u8 time_update_counter;
113 struct wpabuf *time_adv;
114
6fc6879b
JM
115#ifdef CONFIG_FULL_DYNAMIC_VLAN
116 struct full_dynamic_vlan *full_dynamic_vlan;
117#endif /* CONFIG_FULL_DYNAMIC_VLAN */
118
119 struct l2_packet_data *l2;
ad08c363
JM
120 struct wps_context *wps;
121
bc45d427 122 int beacon_set_done;
14f79386
JM
123 struct wpabuf *wps_beacon_ie;
124 struct wpabuf *wps_probe_resp_ie;
84312359 125#ifdef CONFIG_WPS
3b2cf800 126 unsigned int ap_pin_failures;
32cdcf15 127 unsigned int ap_pin_failures_consecutive;
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 */
dca30c3f
JK
172#ifdef CONFIG_INTERWORKING
173 size_t gas_frag_limit;
174#endif /* CONFIG_INTERWORKING */
6fc6879b
JM
175};
176
177
6fc6879b
JM
178/**
179 * struct hostapd_iface - hostapd per-interface data structure
180 */
181struct hostapd_iface {
9969e5a4 182 struct hapd_interfaces *interfaces;
0f2b2c19 183 void *owner;
32da61d9 184 int (*reload_config)(struct hostapd_iface *iface);
41d719d6 185 struct hostapd_config * (*config_read_cb)(const char *config_fname);
6fc6879b
JM
186 char *config_fname;
187 struct hostapd_config *conf;
188
6fc6879b
JM
189 size_t num_bss;
190 struct hostapd_data **bss;
191
192 int num_ap; /* number of entries in ap_list */
193 struct ap_info *ap_list; /* AP info list head */
194 struct ap_info *ap_hash[STA_HASH_SIZE];
195 struct ap_info *ap_iter_list;
196
2fee890a 197 unsigned int drv_flags;
4f73d88a
AN
198
199 /*
200 * A bitmap of supported protocols for probe response offload. See
201 * struct wpa_driver_capa in driver.h
202 */
203 unsigned int probe_resp_offloads;
204
6fc6879b
JM
205 struct hostapd_hw_modes *hw_features;
206 int num_hw_features;
207 struct hostapd_hw_modes *current_mode;
208 /* Rates that are currently used (i.e., filtered copy of
209 * current_mode->channels */
210 int num_rates;
211 struct hostapd_rate_data *current_rates;
e5693c47 212 int *basic_rates;
c706d5aa 213 int freq;
6fc6879b
JM
214
215 u16 hw_flags;
216
217 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
218 * in 802.11g BSS) */
219 int num_sta_non_erp;
220
221 /* Number of associated stations that do not support Short Slot Time */
222 int num_sta_no_short_slot_time;
223
224 /* Number of associated stations that do not support Short Preamble */
225 int num_sta_no_short_preamble;
226
227 int olbc; /* Overlapping Legacy BSS Condition */
228
de9289c8
JM
229 /* Number of HT associated stations that do not support greenfield */
230 int num_sta_ht_no_gf;
231
232 /* Number of associated non-HT stations */
233 int num_sta_no_ht;
234
235 /* Number of HT associated stations 20 MHz */
236 int num_sta_ht_20mhz;
237
238 /* Overlapping BSS information */
239 int olbc_ht;
240
edd360e1 241 u16 ht_op_mode;
ad1e68e6 242 void (*scan_cb)(struct hostapd_iface *iface);
70db2ab3
JM
243
244 int (*ctrl_iface_init)(struct hostapd_data *hapd);
245 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
1b56c26c
JM
246
247 int (*for_each_interface)(struct hapd_interfaces *interfaces,
248 int (*cb)(struct hostapd_iface *iface,
249 void *ctx), void *ctx);
6fc6879b
JM
250};
251
a4f21109 252/* hostapd.c */
07bcdbb1
JM
253int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
254 int (*cb)(struct hostapd_iface *iface,
255 void *ctx), void *ctx);
ad08c363 256int hostapd_reload_config(struct hostapd_iface *iface);
b6a7859d
JM
257struct hostapd_data *
258hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
259 struct hostapd_config *conf,
260 struct hostapd_bss_config *bss);
5c333467 261int hostapd_setup_interface(struct hostapd_iface *iface);
ad1e68e6 262int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
5c333467 263void hostapd_interface_deinit(struct hostapd_iface *iface);
f7c47833 264void hostapd_interface_free(struct hostapd_iface *iface);
a4f21109
JM
265void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
266 int reassoc);
5c333467 267
a4f21109 268/* utils.c */
fa16028d 269int hostapd_register_probereq_cb(struct hostapd_data *hapd,
cd7d80f3 270 int (*cb)(void *ctx, const u8 *sa,
04a85e44 271 const u8 *da, const u8 *bssid,
baf513d6
JB
272 const u8 *ie, size_t ie_len,
273 int ssi_signal),
fa16028d 274 void *ctx);
0aef3ec8 275void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
fa16028d 276
1d041bec
JM
277/* drv_callbacks.c (TODO: move to somewhere else?) */
278int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
39b08b5f 279 const u8 *ie, size_t ielen, int reassoc);
1d041bec 280void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
0d7e5a3a 281void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
04a85e44 282int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
baf513d6
JB
283 const u8 *bssid, const u8 *ie, size_t ie_len,
284 int ssi_signal);
1d041bec 285
6fc6879b 286#endif /* HOSTAPD_H */