123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- #ifndef HOSTAPD_H
- #define HOSTAPD_H
- #include "common/defs.h"
- #include "ap_config.h"
- struct wpa_driver_ops;
- struct wpa_ctrl_dst;
- struct radius_server_data;
- struct upnp_wps_device_sm;
- struct hostapd_data;
- struct sta_info;
- struct hostap_sta_driver_data;
- struct ieee80211_ht_capabilities;
- struct full_dynamic_vlan;
- enum wps_event;
- union wps_event_data;
- struct hostapd_iface;
- struct hostapd_dynamic_iface;
- struct hapd_interfaces {
- int (*reload_config)(struct hostapd_iface *iface);
- struct hostapd_config * (*config_read_cb)(const char *config_fname);
- int (*ctrl_iface_init)(struct hostapd_data *hapd);
- void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
- int (*for_each_interface)(struct hapd_interfaces *interfaces,
- int (*cb)(struct hostapd_iface *iface,
- void *ctx), void *ctx);
- int (*driver_init)(struct hostapd_iface *iface);
- size_t count;
- size_t count_dynamic;
- int global_ctrl_sock;
- char *global_iface_path;
- char *global_iface_name;
- gid_t ctrl_iface_group;
- struct hostapd_iface **iface;
- struct hostapd_dynamic_iface **dynamic_iface;
- };
- enum hostapd_chan_status {
- HOSTAPD_CHAN_VALID = 0,
- HOSTAPD_CHAN_INVALID = 1,
- HOSTAPD_CHAN_ACS = 2,
- };
- struct hostapd_probereq_cb {
- int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
- const u8 *ie, size_t ie_len, int ssi_signal);
- void *ctx;
- };
- #define HOSTAPD_RATE_BASIC 0x00000001
- struct hostapd_rate_data {
- int rate;
- int flags;
- };
- struct hostapd_frame_info {
- u32 channel;
- u32 datarate;
- int ssi_signal;
- };
- enum wps_status {
- WPS_STATUS_SUCCESS = 1,
- WPS_STATUS_FAILURE
- };
- enum pbc_status {
- WPS_PBC_STATUS_DISABLE,
- WPS_PBC_STATUS_ACTIVE,
- WPS_PBC_STATUS_TIMEOUT,
- WPS_PBC_STATUS_OVERLAP
- };
- struct wps_stat {
- enum wps_status status;
- enum wps_error_indication failure_reason;
- enum pbc_status pbc_status;
- u8 peer_addr[ETH_ALEN];
- };
- struct hostapd_data {
- struct hostapd_iface *iface;
- struct hostapd_config *iconf;
- struct hostapd_bss_config *conf;
- u8 own_addr[ETH_ALEN];
- int num_sta;
- struct sta_info *sta_list;
- #define STA_HASH_SIZE 256
- #define STA_HASH(sta) (sta[5])
- struct sta_info *sta_hash[STA_HASH_SIZE];
-
- #define AID_WORDS ((2008 + 31) / 32)
- u32 sta_aid[AID_WORDS];
- const struct wpa_driver_ops *driver;
- void *drv_priv;
- void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
- struct sta_info *sta, int reassoc);
- void *msg_ctx;
- void *msg_ctx_parent;
- struct radius_client_data *radius;
- u32 acct_session_id_hi, acct_session_id_lo;
- struct radius_das_data *radius_das;
- struct iapp_data *iapp;
- struct hostapd_cached_radius_acl *acl_cache;
- struct hostapd_acl_query_data *acl_queries;
- struct wpa_authenticator *wpa_auth;
- struct eapol_authenticator *eapol_auth;
- struct rsn_preauth_interface *preauth_iface;
- time_t michael_mic_failure;
- int michael_mic_failures;
- int tkip_countermeasures;
- int ctrl_sock;
- struct wpa_ctrl_dst *ctrl_dst;
- void *ssl_ctx;
- void *eap_sim_db_priv;
- struct radius_server_data *radius_srv;
- int parameter_set_count;
-
- u8 time_update_counter;
- struct wpabuf *time_adv;
- #ifdef CONFIG_FULL_DYNAMIC_VLAN
- struct full_dynamic_vlan *full_dynamic_vlan;
- #endif
- struct l2_packet_data *l2;
- struct wps_context *wps;
- int beacon_set_done;
- struct wpabuf *wps_beacon_ie;
- struct wpabuf *wps_probe_resp_ie;
- #ifdef CONFIG_WPS
- unsigned int ap_pin_failures;
- unsigned int ap_pin_failures_consecutive;
- struct upnp_wps_device_sm *wps_upnp;
- unsigned int ap_pin_lockout_time;
- struct wps_stat wps_stats;
- #endif
- struct hostapd_probereq_cb *probereq_cb;
- size_t num_probereq_cb;
- void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
- int freq);
- void *public_action_cb_ctx;
- void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
- int freq);
- void *public_action_cb2_ctx;
- int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
- int freq);
- void *vendor_action_cb_ctx;
- void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
- const u8 *uuid_e);
- void *wps_reg_success_cb_ctx;
- void (*wps_event_cb)(void *ctx, enum wps_event event,
- union wps_event_data *data);
- void *wps_event_cb_ctx;
- void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
- int authorized, const u8 *p2p_dev_addr);
- void *sta_authorized_cb_ctx;
- void (*setup_complete_cb)(void *ctx);
- void *setup_complete_cb_ctx;
- void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
- const u8 *p2p_dev_addr, const u8 *psk,
- size_t psk_len);
- void *new_psk_cb_ctx;
- #ifdef CONFIG_P2P
- struct p2p_data *p2p;
- struct p2p_group *p2p_group;
- struct wpabuf *p2p_beacon_ie;
- struct wpabuf *p2p_probe_resp_ie;
-
- int num_sta_no_p2p;
-
- int noa_enabled;
- int noa_start;
- int noa_duration;
- #endif
- #ifdef CONFIG_INTERWORKING
- size_t gas_frag_limit;
- #endif
- #ifdef CONFIG_SQLITE
- struct hostapd_eap_user tmp_eap_user;
- #endif
- #ifdef CONFIG_SAE
-
- u8 sae_token_key[8];
- os_time_t last_sae_token_key_update;
- #endif
- };
- struct hostapd_iface {
- struct hapd_interfaces *interfaces;
- void *owner;
- char *config_fname;
- struct hostapd_config *conf;
- char phy[16];
- enum hostapd_iface_state {
- HAPD_IFACE_UNINITIALIZED,
- HAPD_IFACE_DISABLED,
- HAPD_IFACE_COUNTRY_UPDATE,
- HAPD_IFACE_ACS,
- HAPD_IFACE_HT_SCAN,
- HAPD_IFACE_DFS,
- HAPD_IFACE_ENABLED
- } state;
- size_t num_bss;
- struct hostapd_data **bss;
- unsigned int wait_channel_update:1;
- unsigned int cac_started:1;
- int num_ap;
- struct ap_info *ap_list;
- struct ap_info *ap_hash[STA_HASH_SIZE];
- unsigned int drv_flags;
-
- unsigned int probe_resp_offloads;
-
- const u8 *extended_capa, *extended_capa_mask;
- unsigned int extended_capa_len;
- unsigned int drv_max_acl_mac_addrs;
- struct hostapd_hw_modes *hw_features;
- int num_hw_features;
- struct hostapd_hw_modes *current_mode;
-
- int num_rates;
- struct hostapd_rate_data *current_rates;
- int *basic_rates;
- int freq;
- u16 hw_flags;
-
- int num_sta_non_erp;
-
- int num_sta_no_short_slot_time;
-
- int num_sta_no_short_preamble;
- int olbc;
-
- int num_sta_ht_no_gf;
-
- int num_sta_no_ht;
-
- int num_sta_ht_20mhz;
-
- int olbc_ht;
- u16 ht_op_mode;
-
-
- unsigned int chans_surveyed;
-
- s8 lowest_nf;
- #ifdef CONFIG_ACS
- unsigned int acs_num_completed_scans;
- #endif
- void (*scan_cb)(struct hostapd_iface *iface);
- };
- struct hostapd_dynamic_iface {
- char parent[IFNAMSIZ + 1];
- char iface[IFNAMSIZ + 1];
- unsigned int usage;
- };
- int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
- int (*cb)(struct hostapd_iface *iface,
- void *ctx), void *ctx);
- int hostapd_reload_config(struct hostapd_iface *iface);
- struct hostapd_data *
- hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
- struct hostapd_config *conf,
- struct hostapd_bss_config *bss);
- int hostapd_setup_interface(struct hostapd_iface *iface);
- int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
- void hostapd_interface_deinit(struct hostapd_iface *iface);
- void hostapd_interface_free(struct hostapd_iface *iface);
- struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
- const char *config_file);
- struct hostapd_iface *
- hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
- const char *config_fname, int debug);
- void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
- int reassoc);
- void hostapd_interface_deinit_free(struct hostapd_iface *iface);
- int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
- int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
- int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
- int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
- int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
- void hostapd_channel_list_updated(struct hostapd_iface *iface);
- void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
- const char * hostapd_state_text(enum hostapd_iface_state s);
- int hostapd_register_probereq_cb(struct hostapd_data *hapd,
- int (*cb)(void *ctx, const u8 *sa,
- const u8 *da, const u8 *bssid,
- const u8 *ie, size_t ie_len,
- int ssi_signal),
- void *ctx);
- void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
- int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
- const u8 *ie, size_t ielen, int reassoc);
- void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
- void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
- void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
- const u8 *addr, int reason_code);
- int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
- const u8 *bssid, const u8 *ie, size_t ie_len,
- int ssi_signal);
- void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
- int offset);
- const struct hostapd_eap_user *
- hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
- size_t identity_len, int phase2);
- #endif
|