hostapd.h
Go to the documentation of this file.
00001 /*
00002  * hostapd / Initialization and configuration
00003  * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef HOSTAPD_H
00016 #define HOSTAPD_H
00017 
00018 #include "common/defs.h"
00019 
00020 struct wpa_driver_ops;
00021 struct wpa_ctrl_dst;
00022 struct radius_server_data;
00023 struct upnp_wps_device_sm;
00024 struct hapd_interfaces;
00025 struct hostapd_data;
00026 struct sta_info;
00027 struct hostap_sta_driver_data;
00028 struct ieee80211_ht_capabilities;
00029 struct full_dynamic_vlan;
00030 
00031 struct hostapd_probereq_cb {
00032         int (*cb)(void *ctx, const u8 *sa, const u8 *ie, size_t ie_len);
00033         void *ctx;
00034 };
00035 
00036 #define HOSTAPD_RATE_BASIC 0x00000001
00037 
00038 struct hostapd_rate_data {
00039         int rate; /* rate in 100 kbps */
00040         int flags; /* HOSTAPD_RATE_ flags */
00041 };
00042 
00043 struct hostapd_frame_info {
00044         u32 channel;
00045         u32 datarate;
00046         u32 ssi_signal;
00047 };
00048 
00049 
00050 struct hostapd_driver_ops {
00051         int (*set_ap_wps_ie)(struct hostapd_data *hapd);
00052         int (*send_mgmt_frame)(struct hostapd_data *hapd, const void *msg,
00053                                size_t len);
00054         int (*send_eapol)(struct hostapd_data *hapd, const u8 *addr,
00055                           const u8 *data, size_t data_len, int encrypt);
00056         int (*set_authorized)(struct hostapd_data *hapd, struct sta_info *sta,
00057                               int authorized);
00058         int (*set_key)(const char *ifname, struct hostapd_data *hapd,
00059                        enum wpa_alg alg, const u8 *addr, int key_idx,
00060                        int set_tx, const u8 *seq, size_t seq_len,
00061                        const u8 *key, size_t key_len);
00062         int (*read_sta_data)(struct hostapd_data *hapd,
00063                              struct hostap_sta_driver_data *data,
00064                              const u8 *addr);
00065         int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr);
00066         int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta);
00067         int (*set_drv_ieee8021x)(struct hostapd_data *hapd, const char *ifname,
00068                                  int enabled);
00069         int (*set_radius_acl_auth)(struct hostapd_data *hapd,
00070                                    const u8 *mac, int accepted,
00071                                    u32 session_timeout);
00072         int (*set_radius_acl_expire)(struct hostapd_data *hapd,
00073                                      const u8 *mac);
00074         int (*set_bss_params)(struct hostapd_data *hapd, int use_protection);
00075         int (*set_beacon)(struct hostapd_data *hapd,
00076                           const u8 *head, size_t head_len,
00077                           const u8 *tail, size_t tail_len, int dtim_period,
00078                           int beacon_int);
00079         int (*vlan_if_add)(struct hostapd_data *hapd, const char *ifname);
00080         int (*vlan_if_remove)(struct hostapd_data *hapd, const char *ifname);
00081         int (*set_wds_sta)(struct hostapd_data *hapd, const u8 *addr, int aid,
00082                            int val);
00083         int (*set_sta_vlan)(const char *ifname, struct hostapd_data *hapd,
00084                             const u8 *addr, int vlan_id);
00085         int (*get_inact_sec)(struct hostapd_data *hapd, const u8 *addr);
00086         int (*sta_deauth)(struct hostapd_data *hapd, const u8 *addr,
00087                           int reason);
00088         int (*sta_disassoc)(struct hostapd_data *hapd, const u8 *addr,
00089                             int reason);
00090         int (*sta_add)(struct hostapd_data *hapd,
00091                        const u8 *addr, u16 aid, u16 capability,
00092                        const u8 *supp_rates, size_t supp_rates_len,
00093                        u16 listen_interval,
00094                        const struct ieee80211_ht_capabilities *ht_capab);
00095         int (*sta_remove)(struct hostapd_data *hapd, const u8 *addr);
00096         int (*set_countermeasures)(struct hostapd_data *hapd, int enabled);
00097 };
00098 
00102 struct hostapd_data {
00103         struct hostapd_iface *iface;
00104         struct hostapd_config *iconf;
00105         struct hostapd_bss_config *conf;
00106         int interface_added; /* virtual interface added for this BSS */
00107 
00108         u8 own_addr[ETH_ALEN];
00109 
00110         int num_sta; /* number of entries in sta_list */
00111         struct sta_info *sta_list; /* STA info list head */
00112 #define STA_HASH_SIZE 256
00113 #define STA_HASH(sta) (sta[5])
00114         struct sta_info *sta_hash[STA_HASH_SIZE];
00115 
00116         /*
00117          * Bitfield for indicating which AIDs are allocated. Only AID values
00118          * 1-2007 are used and as such, the bit at index 0 corresponds to AID
00119          * 1.
00120          */
00121 #define AID_WORDS ((2008 + 31) / 32)
00122         u32 sta_aid[AID_WORDS];
00123 
00124         const struct wpa_driver_ops *driver;
00125         void *drv_priv;
00126         struct hostapd_driver_ops drv;
00127 
00128         void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
00129                                  struct sta_info *sta, int reassoc);
00130 
00131         void *msg_ctx; /* ctx for wpa_msg() calls */
00132 
00133         struct radius_client_data *radius;
00134         u32 acct_session_id_hi, acct_session_id_lo;
00135 
00136         struct iapp_data *iapp;
00137 
00138         struct hostapd_cached_radius_acl *acl_cache;
00139         struct hostapd_acl_query_data *acl_queries;
00140 
00141         struct wpa_authenticator *wpa_auth;
00142         struct eapol_authenticator *eapol_auth;
00143 
00144         struct rsn_preauth_interface *preauth_iface;
00145         time_t michael_mic_failure;
00146         int michael_mic_failures;
00147         int tkip_countermeasures;
00148 
00149         int ctrl_sock;
00150         struct wpa_ctrl_dst *ctrl_dst;
00151 
00152         void *ssl_ctx;
00153         void *eap_sim_db_priv;
00154         struct radius_server_data *radius_srv;
00155 
00156         int parameter_set_count;
00157 
00158 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00159         struct full_dynamic_vlan *full_dynamic_vlan;
00160 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
00161 
00162         struct l2_packet_data *l2;
00163         struct wps_context *wps;
00164 
00165         struct wpabuf *wps_beacon_ie;
00166         struct wpabuf *wps_probe_resp_ie;
00167 #ifdef CONFIG_WPS
00168         unsigned int ap_pin_failures;
00169         struct upnp_wps_device_sm *wps_upnp;
00170 #endif /* CONFIG_WPS */
00171 
00172         struct hostapd_probereq_cb *probereq_cb;
00173         size_t num_probereq_cb;
00174 
00175         void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
00176                                  int freq);
00177         void *public_action_cb_ctx;
00178 
00179         void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
00180                                    const u8 *uuid_e);
00181         void *wps_reg_success_cb_ctx;
00182 };
00183 
00184 
00188 struct hostapd_iface {
00189         struct hapd_interfaces *interfaces;
00190         void *owner;
00191         int (*reload_config)(struct hostapd_iface *iface);
00192         struct hostapd_config * (*config_read_cb)(const char *config_fname);
00193         char *config_fname;
00194         struct hostapd_config *conf;
00195 
00196         size_t num_bss;
00197         struct hostapd_data **bss;
00198 
00199         int num_ap; /* number of entries in ap_list */
00200         struct ap_info *ap_list; /* AP info list head */
00201         struct ap_info *ap_hash[STA_HASH_SIZE];
00202         struct ap_info *ap_iter_list;
00203 
00204         struct hostapd_hw_modes *hw_features;
00205         int num_hw_features;
00206         struct hostapd_hw_modes *current_mode;
00207         /* Rates that are currently used (i.e., filtered copy of
00208          * current_mode->channels */
00209         int num_rates;
00210         struct hostapd_rate_data *current_rates;
00211         int freq;
00212 
00213         u16 hw_flags;
00214 
00215         /* Number of associated Non-ERP stations (i.e., stations using 802.11b
00216          * in 802.11g BSS) */
00217         int num_sta_non_erp;
00218 
00219         /* Number of associated stations that do not support Short Slot Time */
00220         int num_sta_no_short_slot_time;
00221 
00222         /* Number of associated stations that do not support Short Preamble */
00223         int num_sta_no_short_preamble;
00224 
00225         int olbc; /* Overlapping Legacy BSS Condition */
00226 
00227         /* Number of HT associated stations that do not support greenfield */
00228         int num_sta_ht_no_gf;
00229 
00230         /* Number of associated non-HT stations */
00231         int num_sta_no_ht;
00232 
00233         /* Number of HT associated stations 20 MHz */
00234         int num_sta_ht_20mhz;
00235 
00236         /* Overlapping BSS information */
00237         int olbc_ht;
00238 
00239         u16 ht_op_mode;
00240         void (*scan_cb)(struct hostapd_iface *iface);
00241 
00242         int (*ctrl_iface_init)(struct hostapd_data *hapd);
00243         void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
00244 
00245         int (*for_each_interface)(struct hapd_interfaces *interfaces,
00246                                   int (*cb)(struct hostapd_iface *iface,
00247                                             void *ctx), void *ctx);
00248 };
00249 
00250 /* hostapd.c */
00251 int hostapd_reload_config(struct hostapd_iface *iface);
00252 struct hostapd_data *
00253 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
00254                        struct hostapd_config *conf,
00255                        struct hostapd_bss_config *bss);
00256 int hostapd_setup_interface(struct hostapd_iface *iface);
00257 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
00258 void hostapd_interface_deinit(struct hostapd_iface *iface);
00259 void hostapd_interface_free(struct hostapd_iface *iface);
00260 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
00261                            int reassoc);
00262 
00263 /* utils.c */
00264 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
00265                                  int (*cb)(void *ctx, const u8 *sa,
00266                                            const u8 *ie, size_t ie_len),
00267                                  void *ctx);
00268 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
00269 
00270 /* drv_callbacks.c (TODO: move to somewhere else?) */
00271 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
00272                         const u8 *ie, size_t ielen);
00273 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
00274 
00275 #endif /* HOSTAPD_H */


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:35