wpa_supplicant / hostapd 2.0

hostapd.h

Go to the documentation of this file.
00001 
00010 #ifndef HOSTAPD_H
00011 #define HOSTAPD_H
00012 
00013 #include "common/defs.h"
00014 
00015 struct wpa_driver_ops;
00016 struct wpa_ctrl_dst;
00017 struct radius_server_data;
00018 struct upnp_wps_device_sm;
00019 struct hostapd_data;
00020 struct sta_info;
00021 struct hostap_sta_driver_data;
00022 struct ieee80211_ht_capabilities;
00023 struct full_dynamic_vlan;
00024 enum wps_event;
00025 union wps_event_data;
00026 
00027 struct hapd_interfaces {
00028         size_t count;
00029         struct hostapd_iface **iface;
00030 };
00031 
00032 
00033 struct hostapd_probereq_cb {
00034         int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
00035                   const u8 *ie, size_t ie_len, int ssi_signal);
00036         void *ctx;
00037 };
00038 
00039 #define HOSTAPD_RATE_BASIC 0x00000001
00040 
00041 struct hostapd_rate_data {
00042         int rate; /* rate in 100 kbps */
00043         int flags; /* HOSTAPD_RATE_ flags */
00044 };
00045 
00046 struct hostapd_frame_info {
00047         u32 channel;
00048         u32 datarate;
00049         int ssi_signal; /* dBm */
00050 };
00051 
00052 
00057 struct hostapd_data {
00058         struct hostapd_iface *iface;
00059         struct hostapd_config *iconf;
00060         struct hostapd_bss_config *conf;
00061         int interface_added; /* virtual interface added for this BSS */
00062 
00063         u8 own_addr[ETH_ALEN];
00064 
00065         int num_sta; /* number of entries in sta_list */
00066         struct sta_info *sta_list; /* STA info list head */
00067 #define STA_HASH_SIZE 256
00068 #define STA_HASH(sta) (sta[5])
00069         struct sta_info *sta_hash[STA_HASH_SIZE];
00070 
00071         /*
00072          * Bitfield for indicating which AIDs are allocated. Only AID values
00073          * 1-2007 are used and as such, the bit at index 0 corresponds to AID
00074          * 1.
00075          */
00076 #define AID_WORDS ((2008 + 31) / 32)
00077         u32 sta_aid[AID_WORDS];
00078 
00079         const struct wpa_driver_ops *driver;
00080         void *drv_priv;
00081 
00082         void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
00083                                  struct sta_info *sta, int reassoc);
00084 
00085         void *msg_ctx; /* ctx for wpa_msg() calls */
00086         void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
00087 
00088         struct radius_client_data *radius;
00089         u32 acct_session_id_hi, acct_session_id_lo;
00090 
00091         struct iapp_data *iapp;
00092 
00093         struct hostapd_cached_radius_acl *acl_cache;
00094         struct hostapd_acl_query_data *acl_queries;
00095 
00096         struct wpa_authenticator *wpa_auth;
00097         struct eapol_authenticator *eapol_auth;
00098 
00099         struct rsn_preauth_interface *preauth_iface;
00100         time_t michael_mic_failure;
00101         int michael_mic_failures;
00102         int tkip_countermeasures;
00103 
00104         int ctrl_sock;
00105         struct wpa_ctrl_dst *ctrl_dst;
00106 
00107         void *ssl_ctx;
00108         void *eap_sim_db_priv;
00109         struct radius_server_data *radius_srv;
00110 
00111         int parameter_set_count;
00112 
00113         /* Time Advertisement */
00114         u8 time_update_counter;
00115         struct wpabuf *time_adv;
00116 
00117 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00118         struct full_dynamic_vlan *full_dynamic_vlan;
00119 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
00120 
00121         struct l2_packet_data *l2;
00122         struct wps_context *wps;
00123 
00124         int beacon_set_done;
00125         struct wpabuf *wps_beacon_ie;
00126         struct wpabuf *wps_probe_resp_ie;
00127 #ifdef CONFIG_WPS
00128         unsigned int ap_pin_failures;
00129         unsigned int ap_pin_failures_consecutive;
00130         struct upnp_wps_device_sm *wps_upnp;
00131         unsigned int ap_pin_lockout_time;
00132 #endif /* CONFIG_WPS */
00133 
00134         struct hostapd_probereq_cb *probereq_cb;
00135         size_t num_probereq_cb;
00136 
00137         void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
00138                                  int freq);
00139         void *public_action_cb_ctx;
00140 
00141         int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
00142                                 int freq);
00143         void *vendor_action_cb_ctx;
00144 
00145         void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
00146                                    const u8 *uuid_e);
00147         void *wps_reg_success_cb_ctx;
00148 
00149         void (*wps_event_cb)(void *ctx, enum wps_event event,
00150                              union wps_event_data *data);
00151         void *wps_event_cb_ctx;
00152 
00153         void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
00154                                   int authorized, const u8 *p2p_dev_addr);
00155         void *sta_authorized_cb_ctx;
00156 
00157         void (*setup_complete_cb)(void *ctx);
00158         void *setup_complete_cb_ctx;
00159 
00160 #ifdef CONFIG_P2P
00161         struct p2p_data *p2p;
00162         struct p2p_group *p2p_group;
00163         struct wpabuf *p2p_beacon_ie;
00164         struct wpabuf *p2p_probe_resp_ie;
00165 
00166         /* Number of non-P2P association stations */
00167         int num_sta_no_p2p;
00168 
00169         /* Periodic NoA (used only when no non-P2P clients in the group) */
00170         int noa_enabled;
00171         int noa_start;
00172         int noa_duration;
00173 #endif /* CONFIG_P2P */
00174 #ifdef CONFIG_INTERWORKING
00175         size_t gas_frag_limit;
00176 #endif /* CONFIG_INTERWORKING */
00177 };
00178 
00179 
00184 struct hostapd_iface {
00185         struct hapd_interfaces *interfaces;
00186         void *owner;
00187         int (*reload_config)(struct hostapd_iface *iface);
00188         struct hostapd_config * (*config_read_cb)(const char *config_fname);
00189         char *config_fname;
00190         struct hostapd_config *conf;
00191 
00192         size_t num_bss;
00193         struct hostapd_data **bss;
00194 
00195         int num_ap; /* number of entries in ap_list */
00196         struct ap_info *ap_list; /* AP info list head */
00197         struct ap_info *ap_hash[STA_HASH_SIZE];
00198         struct ap_info *ap_iter_list;
00199 
00200         unsigned int drv_flags;
00201 
00202         /*
00203          * A bitmap of supported protocols for probe response offload. See
00204          * struct wpa_driver_capa in driver.h
00205          */
00206         unsigned int probe_resp_offloads;
00207 
00208         struct hostapd_hw_modes *hw_features;
00209         int num_hw_features;
00210         struct hostapd_hw_modes *current_mode;
00211         /* Rates that are currently used (i.e., filtered copy of
00212          * current_mode->channels */
00213         int num_rates;
00214         struct hostapd_rate_data *current_rates;
00215         int *basic_rates;
00216         int freq;
00217 
00218         u16 hw_flags;
00219 
00220         /* Number of associated Non-ERP stations (i.e., stations using 802.11b
00221          * in 802.11g BSS) */
00222         int num_sta_non_erp;
00223 
00224         /* Number of associated stations that do not support Short Slot Time */
00225         int num_sta_no_short_slot_time;
00226 
00227         /* Number of associated stations that do not support Short Preamble */
00228         int num_sta_no_short_preamble;
00229 
00230         int olbc; /* Overlapping Legacy BSS Condition */
00231 
00232         /* Number of HT associated stations that do not support greenfield */
00233         int num_sta_ht_no_gf;
00234 
00235         /* Number of associated non-HT stations */
00236         int num_sta_no_ht;
00237 
00238         /* Number of HT associated stations 20 MHz */
00239         int num_sta_ht_20mhz;
00240 
00241         /* Overlapping BSS information */
00242         int olbc_ht;
00243 
00244         u16 ht_op_mode;
00245         void (*scan_cb)(struct hostapd_iface *iface);
00246 
00247         int (*ctrl_iface_init)(struct hostapd_data *hapd);
00248         void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
00249 
00250         int (*for_each_interface)(struct hapd_interfaces *interfaces,
00251                                   int (*cb)(struct hostapd_iface *iface,
00252                                             void *ctx), void *ctx);
00253 };
00254 
00255 /* hostapd.c */
00256 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
00257                                int (*cb)(struct hostapd_iface *iface,
00258                                          void *ctx), void *ctx);
00259 int hostapd_reload_config(struct hostapd_iface *iface);
00260 struct hostapd_data *
00261 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
00262                        struct hostapd_config *conf,
00263                        struct hostapd_bss_config *bss);
00264 int hostapd_setup_interface(struct hostapd_iface *iface);
00265 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
00266 void hostapd_interface_deinit(struct hostapd_iface *iface);
00267 void hostapd_interface_free(struct hostapd_iface *iface);
00268 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
00269                            int reassoc);
00270 
00271 /* utils.c */
00272 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
00273                                  int (*cb)(void *ctx, const u8 *sa,
00274                                            const u8 *da, const u8 *bssid,
00275                                            const u8 *ie, size_t ie_len,
00276                                            int ssi_signal),
00277                                  void *ctx);
00278 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
00279 
00280 /* drv_callbacks.c (TODO: move to somewhere else?) */
00281 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
00282                         const u8 *ie, size_t ielen, int reassoc);
00283 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
00284 void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
00285 int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
00286                          const u8 *bssid, const u8 *ie, size_t ie_len,
00287                          int ssi_signal);
00288 
00289 #endif /* HOSTAPD_H */
00290 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines