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