WPS: Add support for external Registrars using UPnP transport
[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 "ap.h"
22 #include "hostapd_defs.h"
23 #include "config.h"
24
25 struct wpa_driver_ops;
26 struct wpa_ctrl_dst;
27 struct radius_server_data;
28 struct upnp_wps_device_sm;
29
30 #ifdef CONFIG_FULL_DYNAMIC_VLAN
31 struct full_dynamic_vlan;
32 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
33
34 /**
35  * struct hostapd_data - hostapd per-BSS data structure
36  */
37 struct hostapd_data {
38         struct hostapd_iface *iface;
39         struct hostapd_config *iconf;
40         struct hostapd_bss_config *conf;
41         int interface_added; /* virtual interface added for this BSS */
42
43         u8 own_addr[ETH_ALEN];
44
45         int num_sta; /* number of entries in sta_list */
46         struct sta_info *sta_list; /* STA info list head */
47         struct sta_info *sta_hash[STA_HASH_SIZE];
48
49         /* pointers to STA info; based on allocated AID or NULL if AID free
50          * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
51          * and so on
52          */
53         struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
54
55         const struct wpa_driver_ops *driver;
56         void *drv_priv;
57
58         u8 *default_wep_key;
59         u8 default_wep_key_idx;
60
61         struct radius_client_data *radius;
62         int radius_client_reconfigured;
63         u32 acct_session_id_hi, acct_session_id_lo;
64
65         struct iapp_data *iapp;
66
67         struct hostapd_cached_radius_acl *acl_cache;
68         struct hostapd_acl_query_data *acl_queries;
69
70         struct wpa_authenticator *wpa_auth;
71         struct eapol_authenticator *eapol_auth;
72
73         struct rsn_preauth_interface *preauth_iface;
74         time_t michael_mic_failure;
75         int michael_mic_failures;
76         int tkip_countermeasures;
77
78         int ctrl_sock;
79         struct wpa_ctrl_dst *ctrl_dst;
80
81         void *ssl_ctx;
82         void *eap_sim_db_priv;
83         struct radius_server_data *radius_srv;
84
85         int parameter_set_count;
86
87 #ifdef CONFIG_FULL_DYNAMIC_VLAN
88         struct full_dynamic_vlan *full_dynamic_vlan;
89 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
90
91         struct l2_packet_data *l2;
92         struct wps_context *wps;
93
94 #ifdef CONFIG_WPS
95         u8 *wps_beacon_ie;
96         size_t wps_beacon_ie_len;
97         u8 *wps_probe_resp_ie;
98         size_t wps_probe_resp_ie_len;
99         unsigned int ap_pin_failures;
100         struct upnp_wps_device_sm *wps_upnp;
101 #endif /* CONFIG_WPS */
102 };
103
104
105 /**
106  * struct hostapd_iface - hostapd per-interface data structure
107  */
108 struct hostapd_iface {
109         char *config_fname;
110         struct hostapd_config *conf;
111
112         size_t num_bss;
113         struct hostapd_data **bss;
114
115         int num_ap; /* number of entries in ap_list */
116         struct ap_info *ap_list; /* AP info list head */
117         struct ap_info *ap_hash[STA_HASH_SIZE];
118         struct ap_info *ap_iter_list;
119
120         struct hostapd_hw_modes *hw_features;
121         int num_hw_features;
122         struct hostapd_hw_modes *current_mode;
123         /* Rates that are currently used (i.e., filtered copy of
124          * current_mode->channels */
125         int num_rates;
126         struct hostapd_rate_data *current_rates;
127
128         u16 hw_flags;
129
130         /* Number of associated Non-ERP stations (i.e., stations using 802.11b
131          * in 802.11g BSS) */
132         int num_sta_non_erp;
133
134         /* Number of associated stations that do not support Short Slot Time */
135         int num_sta_no_short_slot_time;
136
137         /* Number of associated stations that do not support Short Preamble */
138         int num_sta_no_short_preamble;
139
140         int olbc; /* Overlapping Legacy BSS Condition */
141
142         /* Number of HT associated stations that do not support greenfield */
143         int num_sta_ht_no_gf;
144
145         /* Number of associated non-HT stations */
146         int num_sta_no_ht;
147
148         /* Number of HT associated stations 20 MHz */
149         int num_sta_ht_20mhz;
150
151         /* Overlapping BSS information */
152         int olbc_ht;
153
154 #ifdef CONFIG_IEEE80211N
155         u16 ht_op_mode;
156 #endif /* CONFIG_IEEE80211N */
157 };
158
159 int hostapd_reload_config(struct hostapd_iface *iface);
160 int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
161                                          void *ctx), void *ctx);
162
163 #endif /* HOSTAPD_H */