2 * hostapd / Initialization and configuration
3 * Copyright (c) 2002-2009, 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 #include "common/defs.h"
20 struct wpa_driver_ops
;
22 struct radius_server_data
;
23 struct upnp_wps_device_sm
;
24 struct hapd_interfaces
;
27 struct hostap_sta_driver_data
;
29 #ifdef CONFIG_FULL_DYNAMIC_VLAN
30 struct full_dynamic_vlan
;
31 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
33 struct hostapd_probereq_cb
{
34 void (*cb
)(void *ctx
, const u8
*sa
, const u8
*ie
, size_t ie_len
);
38 #define HOSTAPD_RATE_BASIC 0x00000001
40 struct hostapd_rate_data
{
41 int rate
; /* rate in 100 kbps */
42 int flags
; /* HOSTAPD_RATE_ flags */
46 struct hostapd_driver_ops
{
47 int (*set_ap_wps_ie
)(struct hostapd_data
*hapd
,
48 const struct wpabuf
*beacon
,
49 const struct wpabuf
*probe
);
50 int (*send_mgmt_frame
)(struct hostapd_data
*hapd
, const void *msg
,
52 int (*send_eapol
)(struct hostapd_data
*hapd
, const u8
*addr
,
53 const u8
*data
, size_t data_len
, int encrypt
);
54 int (*set_authorized
)(struct hostapd_data
*hapd
, struct sta_info
*sta
,
56 int (*set_key
)(const char *ifname
, struct hostapd_data
*hapd
,
57 wpa_alg alg
, const u8
*addr
, int key_idx
,
58 int set_tx
, const u8
*seq
, size_t seq_len
,
59 const u8
*key
, size_t key_len
);
60 int (*read_sta_data
)(struct hostapd_data
*hapd
,
61 struct hostap_sta_driver_data
*data
,
63 int (*sta_clear_stats
)(struct hostapd_data
*hapd
, const u8
*addr
);
64 int (*set_sta_flags
)(struct hostapd_data
*hapd
, struct sta_info
*sta
);
68 * struct hostapd_data - hostapd per-BSS data structure
71 struct hostapd_iface
*iface
;
72 struct hostapd_config
*iconf
;
73 struct hostapd_bss_config
*conf
;
74 int interface_added
; /* virtual interface added for this BSS */
76 u8 own_addr
[ETH_ALEN
];
78 int num_sta
; /* number of entries in sta_list */
79 struct sta_info
*sta_list
; /* STA info list head */
80 #define STA_HASH_SIZE 256
81 #define STA_HASH(sta) (sta[5])
82 struct sta_info
*sta_hash
[STA_HASH_SIZE
];
85 * Bitfield for indicating which AIDs are allocated. Only AID values
86 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
89 #define AID_WORDS ((2008 + 31) / 32)
90 u32 sta_aid
[AID_WORDS
];
92 const struct wpa_driver_ops
*driver
;
94 struct hostapd_driver_ops drv
;
96 void *msg_ctx
; /* ctx for wpa_msg() calls */
98 struct radius_client_data
*radius
;
99 u32 acct_session_id_hi
, acct_session_id_lo
;
101 struct iapp_data
*iapp
;
103 struct hostapd_cached_radius_acl
*acl_cache
;
104 struct hostapd_acl_query_data
*acl_queries
;
106 struct wpa_authenticator
*wpa_auth
;
107 struct eapol_authenticator
*eapol_auth
;
109 struct rsn_preauth_interface
*preauth_iface
;
110 time_t michael_mic_failure
;
111 int michael_mic_failures
;
112 int tkip_countermeasures
;
115 struct wpa_ctrl_dst
*ctrl_dst
;
118 void *eap_sim_db_priv
;
119 struct radius_server_data
*radius_srv
;
121 int parameter_set_count
;
123 #ifdef CONFIG_FULL_DYNAMIC_VLAN
124 struct full_dynamic_vlan
*full_dynamic_vlan
;
125 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
127 struct l2_packet_data
*l2
;
128 struct wps_context
*wps
;
131 struct wpabuf
*wps_beacon_ie
;
132 struct wpabuf
*wps_probe_resp_ie
;
133 unsigned int ap_pin_failures
;
134 struct upnp_wps_device_sm
*wps_upnp
;
135 #endif /* CONFIG_WPS */
137 struct hostapd_probereq_cb
*probereq_cb
;
138 size_t num_probereq_cb
;
143 * struct hostapd_iface - hostapd per-interface data structure
145 struct hostapd_iface
{
146 struct hapd_interfaces
*interfaces
;
148 struct hostapd_config
* (*config_read_cb
)(const char *config_fname
);
150 struct hostapd_config
*conf
;
153 struct hostapd_data
**bss
;
155 int num_ap
; /* number of entries in ap_list */
156 struct ap_info
*ap_list
; /* AP info list head */
157 struct ap_info
*ap_hash
[STA_HASH_SIZE
];
158 struct ap_info
*ap_iter_list
;
160 struct hostapd_hw_modes
*hw_features
;
162 struct hostapd_hw_modes
*current_mode
;
163 /* Rates that are currently used (i.e., filtered copy of
164 * current_mode->channels */
166 struct hostapd_rate_data
*current_rates
;
170 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
174 /* Number of associated stations that do not support Short Slot Time */
175 int num_sta_no_short_slot_time
;
177 /* Number of associated stations that do not support Short Preamble */
178 int num_sta_no_short_preamble
;
180 int olbc
; /* Overlapping Legacy BSS Condition */
182 /* Number of HT associated stations that do not support greenfield */
183 int num_sta_ht_no_gf
;
185 /* Number of associated non-HT stations */
188 /* Number of HT associated stations 20 MHz */
189 int num_sta_ht_20mhz
;
191 /* Overlapping BSS information */
195 void (*scan_cb
)(struct hostapd_iface
*iface
);
198 int hostapd_reload_config(struct hostapd_iface
*iface
);
199 struct hostapd_data
*
200 hostapd_alloc_bss_data(struct hostapd_iface
*hapd_iface
,
201 struct hostapd_config
*conf
,
202 struct hostapd_bss_config
*bss
);
203 int hostapd_setup_interface(struct hostapd_iface
*iface
);
204 int hostapd_setup_interface_complete(struct hostapd_iface
*iface
, int err
);
205 void hostapd_interface_deinit(struct hostapd_iface
*iface
);
206 int handle_reload_iface(struct hostapd_iface
*iface
, void *ctx
);
207 int handle_dump_state_iface(struct hostapd_iface
*iface
, void *ctx
);
209 int hostapd_for_each_interface(struct hapd_interfaces
*interfaces
,
210 int (*cb
)(struct hostapd_iface
*iface
,
211 void *ctx
), void *ctx
);
213 int hostapd_register_probereq_cb(struct hostapd_data
*hapd
,
214 void (*cb
)(void *ctx
, const u8
*sa
,
215 const u8
*ie
, size_t ie_len
),
217 int hostapd_set_drv_ieee8021x(struct hostapd_data
*hapd
, const char *ifname
,
220 int eap_server_register_methods(void);
221 void hostapd_set_driver_ops(struct hostapd_driver_ops
*ops
);
223 #endif /* HOSTAPD_H */