Move STA entry structure into sta_info.h and remove ap.h
[wpasupplicant] / hostapd / hostapd.h
1 /*
2  * hostapd / Initialization and configuration
3  * Host AP kernel driver
4  * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
5  * Copyright (c) 2007-2008, Intel Corporation
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * Alternatively, this software may be distributed under the terms of BSD
12  * license.
13  *
14  * See README and COPYING for more details.
15  */
16
17 #ifndef HOSTAPD_H
18 #define HOSTAPD_H
19
20 #include "common.h"
21 #include "hostapd_defs.h"
22 #include "config.h"
23
24 struct wpa_driver_ops;
25 struct wpa_ctrl_dst;
26 struct radius_server_data;
27 struct upnp_wps_device_sm;
28
29 #ifdef CONFIG_FULL_DYNAMIC_VLAN
30 struct full_dynamic_vlan;
31 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
32
33 /**
34  * struct hostapd_data - hostapd per-BSS data structure
35  */
36 struct hostapd_data {
37         struct hostapd_iface *iface;
38         struct hostapd_config *iconf;
39         struct hostapd_bss_config *conf;
40         int interface_added; /* virtual interface added for this BSS */
41
42         u8 own_addr[ETH_ALEN];
43
44         int num_sta; /* number of entries in sta_list */
45         struct sta_info *sta_list; /* STA info list head */
46 #define STA_HASH_SIZE 256
47 #define STA_HASH(sta) (sta[5])
48         struct sta_info *sta_hash[STA_HASH_SIZE];
49
50         /*
51          * Bitfield for indicating which AIDs are allocated. Only AID values
52          * 1-2007 are used and as such, the bit at index 0 corresponds to AID
53          * 1.
54          */
55 #define AID_WORDS ((2008 + 31) / 32)
56         u32 sta_aid[AID_WORDS];
57
58         const struct wpa_driver_ops *driver;
59         void *drv_priv;
60
61         u8 *default_wep_key;
62         u8 default_wep_key_idx;
63
64         struct radius_client_data *radius;
65         int radius_client_reconfigured;
66         u32 acct_session_id_hi, acct_session_id_lo;
67
68         struct iapp_data *iapp;
69
70         struct hostapd_cached_radius_acl *acl_cache;
71         struct hostapd_acl_query_data *acl_queries;
72
73         struct wpa_authenticator *wpa_auth;
74         struct eapol_authenticator *eapol_auth;
75
76         struct rsn_preauth_interface *preauth_iface;
77         time_t michael_mic_failure;
78         int michael_mic_failures;
79         int tkip_countermeasures;
80
81         int ctrl_sock;
82         struct wpa_ctrl_dst *ctrl_dst;
83
84         void *ssl_ctx;
85         void *eap_sim_db_priv;
86         struct radius_server_data *radius_srv;
87
88         int parameter_set_count;
89
90 #ifdef CONFIG_FULL_DYNAMIC_VLAN
91         struct full_dynamic_vlan *full_dynamic_vlan;
92 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
93
94         struct l2_packet_data *l2;
95         struct wps_context *wps;
96
97 #ifdef CONFIG_WPS
98         u8 *wps_beacon_ie;
99         size_t wps_beacon_ie_len;
100         u8 *wps_probe_resp_ie;
101         size_t wps_probe_resp_ie_len;
102         unsigned int ap_pin_failures;
103         struct upnp_wps_device_sm *wps_upnp;
104 #endif /* CONFIG_WPS */
105 };
106
107
108 /**
109  * struct hostapd_iface - hostapd per-interface data structure
110  */
111 struct hostapd_iface {
112         char *config_fname;
113         struct hostapd_config *conf;
114
115         size_t num_bss;
116         struct hostapd_data **bss;
117
118         int num_ap; /* number of entries in ap_list */
119         struct ap_info *ap_list; /* AP info list head */
120         struct ap_info *ap_hash[STA_HASH_SIZE];
121         struct ap_info *ap_iter_list;
122
123         struct hostapd_hw_modes *hw_features;
124         int num_hw_features;
125         struct hostapd_hw_modes *current_mode;
126         /* Rates that are currently used (i.e., filtered copy of
127          * current_mode->channels */
128         int num_rates;
129         struct hostapd_rate_data *current_rates;
130
131         u16 hw_flags;
132
133         /* Number of associated Non-ERP stations (i.e., stations using 802.11b
134          * in 802.11g BSS) */
135         int num_sta_non_erp;
136
137         /* Number of associated stations that do not support Short Slot Time */
138         int num_sta_no_short_slot_time;
139
140         /* Number of associated stations that do not support Short Preamble */
141         int num_sta_no_short_preamble;
142
143         int olbc; /* Overlapping Legacy BSS Condition */
144
145         /* Number of HT associated stations that do not support greenfield */
146         int num_sta_ht_no_gf;
147
148         /* Number of associated non-HT stations */
149         int num_sta_no_ht;
150
151         /* Number of HT associated stations 20 MHz */
152         int num_sta_ht_20mhz;
153
154         /* Overlapping BSS information */
155         int olbc_ht;
156
157 #ifdef CONFIG_IEEE80211N
158         u16 ht_op_mode;
159 #endif /* CONFIG_IEEE80211N */
160 };
161
162 int hostapd_reload_config(struct hostapd_iface *iface);
163 int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
164                                          void *ctx), void *ctx);
165
166 #endif /* HOSTAPD_H */