2 * hostapd / Initialization and configuration
3 * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #define MAX_VLAN_ID 4094
20 struct wpa_driver_ops;
22 struct radius_server_data;
23 struct upnp_wps_device_sm;
24 struct hapd_interfaces;
26 #ifdef CONFIG_FULL_DYNAMIC_VLAN
27 struct full_dynamic_vlan;
28 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
30 struct hostapd_probereq_cb {
31 void (*cb)(void *ctx, const u8 *sa, const u8 *ie, size_t ie_len);
35 #define HOSTAPD_RATE_BASIC 0x00000001
37 struct hostapd_rate_data {
38 int rate; /* rate in 100 kbps */
39 int flags; /* HOSTAPD_RATE_ flags */
44 * struct hostapd_data - hostapd per-BSS data structure
47 struct hostapd_iface *iface;
48 struct hostapd_config *iconf;
49 struct hostapd_bss_config *conf;
50 int interface_added; /* virtual interface added for this BSS */
52 u8 own_addr[ETH_ALEN];
54 int num_sta; /* number of entries in sta_list */
55 struct sta_info *sta_list; /* STA info list head */
56 #define STA_HASH_SIZE 256
57 #define STA_HASH(sta) (sta[5])
58 struct sta_info *sta_hash[STA_HASH_SIZE];
61 * Bitfield for indicating which AIDs are allocated. Only AID values
62 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
65 #define AID_WORDS ((2008 + 31) / 32)
66 u32 sta_aid[AID_WORDS];
68 const struct wpa_driver_ops *driver;
71 void *msg_ctx; /* ctx for wpa_msg() calls */
73 struct radius_client_data *radius;
74 u32 acct_session_id_hi, acct_session_id_lo;
76 struct iapp_data *iapp;
78 struct hostapd_cached_radius_acl *acl_cache;
79 struct hostapd_acl_query_data *acl_queries;
81 struct wpa_authenticator *wpa_auth;
82 struct eapol_authenticator *eapol_auth;
84 struct rsn_preauth_interface *preauth_iface;
85 time_t michael_mic_failure;
86 int michael_mic_failures;
87 int tkip_countermeasures;
90 struct wpa_ctrl_dst *ctrl_dst;
93 void *eap_sim_db_priv;
94 struct radius_server_data *radius_srv;
96 int parameter_set_count;
98 #ifdef CONFIG_FULL_DYNAMIC_VLAN
99 struct full_dynamic_vlan *full_dynamic_vlan;
100 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
102 struct l2_packet_data *l2;
103 struct wps_context *wps;
107 size_t wps_beacon_ie_len;
108 u8 *wps_probe_resp_ie;
109 size_t wps_probe_resp_ie_len;
110 unsigned int ap_pin_failures;
111 struct upnp_wps_device_sm *wps_upnp;
112 #endif /* CONFIG_WPS */
114 struct hostapd_probereq_cb *probereq_cb;
115 size_t num_probereq_cb;
120 * struct hostapd_iface - hostapd per-interface data structure
122 struct hostapd_iface {
123 struct hapd_interfaces *interfaces;
126 struct hostapd_config *conf;
129 struct hostapd_data **bss;
131 int num_ap; /* number of entries in ap_list */
132 struct ap_info *ap_list; /* AP info list head */
133 struct ap_info *ap_hash[STA_HASH_SIZE];
134 struct ap_info *ap_iter_list;
136 struct hostapd_hw_modes *hw_features;
138 struct hostapd_hw_modes *current_mode;
139 /* Rates that are currently used (i.e., filtered copy of
140 * current_mode->channels */
142 struct hostapd_rate_data *current_rates;
146 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
150 /* Number of associated stations that do not support Short Slot Time */
151 int num_sta_no_short_slot_time;
153 /* Number of associated stations that do not support Short Preamble */
154 int num_sta_no_short_preamble;
156 int olbc; /* Overlapping Legacy BSS Condition */
158 /* Number of HT associated stations that do not support greenfield */
159 int num_sta_ht_no_gf;
161 /* Number of associated non-HT stations */
164 /* Number of HT associated stations 20 MHz */
165 int num_sta_ht_20mhz;
167 /* Overlapping BSS information */
171 void (*scan_cb)(struct hostapd_iface *iface);
174 int hostapd_reload_config(struct hostapd_iface *iface);
175 struct hostapd_data *
176 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
177 struct hostapd_config *conf,
178 struct hostapd_bss_config *bss);
179 int hostapd_setup_interface(struct hostapd_iface *iface);
180 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
181 void hostapd_interface_deinit(struct hostapd_iface *iface);
182 int handle_reload_iface(struct hostapd_iface *iface, void *ctx);
183 int handle_dump_state_iface(struct hostapd_iface *iface, void *ctx);
185 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
186 int (*cb)(struct hostapd_iface *iface,
187 void *ctx), void *ctx);
189 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
190 void (*cb)(void *ctx, const u8 *sa,
191 const u8 *ie, size_t ie_len),
193 int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
195 int hostapd_sta_flags_to_drv(int flags);
197 int eap_server_register_methods(void);
199 #endif /* HOSTAPD_H */