Sync usage with man page.
[netbsd-mini2440.git] / dist / wpa / hostapd / hostapd.h
blob10afd5ec1f5a5d76c6b8b53a87a07b8d69843cb3
1 /*
2 * hostapd / Initialization and configuration
3 * Host AP kernel driver
4 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
11 * license.
13 * See README and COPYING for more details.
16 #ifndef HOSTAPD_H
17 #define HOSTAPD_H
19 #include "common.h"
20 #include "ap.h"
22 #ifndef ETH_ALEN
23 #define ETH_ALEN 6
24 #endif
25 #ifndef IFNAMSIZ
26 #define IFNAMSIZ 16
27 #endif
28 #ifndef ETH_P_ALL
29 #define ETH_P_ALL 0x0003
30 #endif
31 #ifndef ETH_P_PAE
32 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
33 #endif /* ETH_P_PAE */
34 #ifndef ETH_P_EAPOL
35 #define ETH_P_EAPOL ETH_P_PAE
36 #endif /* ETH_P_EAPOL */
38 #ifndef ETH_P_RRB
39 #define ETH_P_RRB 0x890D
40 #endif /* ETH_P_RRB */
42 #include "config.h"
44 #ifdef _MSC_VER
45 #pragma pack(push, 1)
46 #endif /* _MSC_VER */
48 #define MAX_VLAN_ID 4094
50 struct ieee8023_hdr {
51 u8 dest[6];
52 u8 src[6];
53 u16 ethertype;
54 } STRUCT_PACKED;
57 struct ieee80211_hdr {
58 le16 frame_control;
59 le16 duration_id;
60 u8 addr1[6];
61 u8 addr2[6];
62 u8 addr3[6];
63 le16 seq_ctrl;
64 /* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
66 } STRUCT_PACKED;
68 #ifdef _MSC_VER
69 #pragma pack(pop)
70 #endif /* _MSC_VER */
72 #define IEEE80211_DA_FROMDS addr1
73 #define IEEE80211_BSSID_FROMDS addr2
74 #define IEEE80211_SA_FROMDS addr3
76 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
78 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
80 /* MTU to be set for the wlan#ap device; this is mainly needed for IEEE 802.1X
81 * frames that might be longer than normal default MTU and they are not
82 * fragmented */
83 #define HOSTAPD_MTU 2290
85 extern unsigned char rfc1042_header[6];
87 struct hostap_sta_driver_data {
88 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
89 unsigned long current_tx_rate;
90 unsigned long inactive_msec;
91 unsigned long flags;
92 unsigned long num_ps_buf_frames;
93 unsigned long tx_retry_failed;
94 unsigned long tx_retry_count;
95 int last_rssi;
96 int last_ack_rssi;
99 struct wpa_driver_ops;
100 struct wpa_ctrl_dst;
101 struct radius_server_data;
103 #ifdef CONFIG_FULL_DYNAMIC_VLAN
104 struct full_dynamic_vlan;
105 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
108 * struct hostapd_data - hostapd per-BSS data structure
110 struct hostapd_data {
111 struct hostapd_iface *iface;
112 struct hostapd_config *iconf;
113 struct hostapd_bss_config *conf;
114 int interface_added; /* virtual interface added for this BSS */
116 u8 own_addr[ETH_ALEN];
118 int num_sta; /* number of entries in sta_list */
119 struct sta_info *sta_list; /* STA info list head */
120 struct sta_info *sta_hash[STA_HASH_SIZE];
122 /* pointers to STA info; based on allocated AID or NULL if AID free
123 * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
124 * and so on
126 struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
128 const struct wpa_driver_ops *driver;
129 void *drv_priv;
131 u8 *default_wep_key;
132 u8 default_wep_key_idx;
134 struct radius_client_data *radius;
135 int radius_client_reconfigured;
136 u32 acct_session_id_hi, acct_session_id_lo;
138 struct iapp_data *iapp;
140 enum { DO_NOT_ASSOC = 0, WAIT_BEACON, AUTHENTICATE, ASSOCIATE,
141 ASSOCIATED } assoc_ap_state;
142 char assoc_ap_ssid[33];
143 int assoc_ap_ssid_len;
144 u16 assoc_ap_aid;
146 struct hostapd_cached_radius_acl *acl_cache;
147 struct hostapd_acl_query_data *acl_queries;
149 struct wpa_authenticator *wpa_auth;
150 struct eapol_authenticator *eapol_auth;
152 struct rsn_preauth_interface *preauth_iface;
153 time_t michael_mic_failure;
154 int michael_mic_failures;
155 int tkip_countermeasures;
157 int ctrl_sock;
158 struct wpa_ctrl_dst *ctrl_dst;
160 void *ssl_ctx;
161 void *eap_sim_db_priv;
162 struct radius_server_data *radius_srv;
164 int parameter_set_count;
166 #ifdef CONFIG_FULL_DYNAMIC_VLAN
167 struct full_dynamic_vlan *full_dynamic_vlan;
168 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
170 struct l2_packet_data *l2;
175 * hostapd_iface_cb - Generic callback type for per-iface asynchronous requests
176 * @iface: the interface the event occured on.
177 * @status: 0 if the request succeeded; -1 if the request failed.
179 typedef void (*hostapd_iface_cb)(struct hostapd_iface *iface, int status);
182 struct hostapd_config_change;
185 * struct hostapd_iface - hostapd per-interface data structure
187 struct hostapd_iface {
188 char *config_fname;
189 struct hostapd_config *conf;
191 hostapd_iface_cb setup_cb;
193 size_t num_bss;
194 struct hostapd_data **bss;
196 int num_ap; /* number of entries in ap_list */
197 struct ap_info *ap_list; /* AP info list head */
198 struct ap_info *ap_hash[STA_HASH_SIZE];
199 struct ap_info *ap_iter_list;
201 struct hostapd_hw_modes *hw_features;
202 int num_hw_features;
203 struct hostapd_hw_modes *current_mode;
204 /* Rates that are currently used (i.e., filtered copy of
205 * current_mode->channels */
206 int num_rates;
207 struct hostapd_rate_data *current_rates;
208 hostapd_iface_cb hw_mode_sel_cb;
210 u16 hw_flags;
212 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
213 * in 802.11g BSS) */
214 int num_sta_non_erp;
216 /* Number of associated stations that do not support Short Slot Time */
217 int num_sta_no_short_slot_time;
219 /* Number of associated stations that do not support Short Preamble */
220 int num_sta_no_short_preamble;
222 int olbc; /* Overlapping Legacy BSS Condition */
224 int dfs_enable;
225 u8 pwr_const;
226 unsigned int tx_power;
227 unsigned int sta_max_power;
229 unsigned int channel_switch;
231 struct hostapd_config_change *change;
232 hostapd_iface_cb reload_iface_cb;
233 hostapd_iface_cb config_reload_cb;
236 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
237 int reassoc);
239 #endif /* HOSTAPD_H */