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