1 /* 2 * hostapd / Initialization and configuration 3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef HOSTAPD_H 10 #define HOSTAPD_H 11 12 #include "common/defs.h" 13 #include "ap/ap_config.h" 14 15 struct wpa_driver_ops; 16 struct wpa_ctrl_dst; 17 struct radius_server_data; 18 struct upnp_wps_device_sm; 19 struct hostapd_data; 20 struct sta_info; 21 struct hostap_sta_driver_data; 22 struct ieee80211_ht_capabilities; 23 struct full_dynamic_vlan; 24 enum wps_event; 25 union wps_event_data; 26 27 struct hostapd_iface; 28 29 struct hapd_interfaces { 30 int (*reload_config)(struct hostapd_iface *iface); 31 struct hostapd_config * (*config_read_cb)(const char *config_fname); 32 int (*ctrl_iface_init)(struct hostapd_data *hapd); 33 void (*ctrl_iface_deinit)(struct hostapd_data *hapd); 34 int (*for_each_interface)(struct hapd_interfaces *interfaces, 35 int (*cb)(struct hostapd_iface *iface, 36 void *ctx), void *ctx); 37 int (*driver_init)(struct hostapd_iface *iface); 38 39 size_t count; 40 int global_ctrl_sock; 41 char *global_iface_path; 42 char *global_iface_name; 43 struct hostapd_iface **iface; 44 }; 45 46 47 struct hostapd_probereq_cb { 48 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid, 49 const u8 *ie, size_t ie_len, int ssi_signal); 50 void *ctx; 51 }; 52 53 #define HOSTAPD_RATE_BASIC 0x00000001 54 55 struct hostapd_rate_data { 56 int rate; /* rate in 100 kbps */ 57 int flags; /* HOSTAPD_RATE_ flags */ 58 }; 59 60 struct hostapd_frame_info { 61 u32 channel; 62 u32 datarate; 63 int ssi_signal; /* dBm */ 64 }; 65 66 struct hostapd_sae_commit_queue { 67 struct dl_list list; 68 size_t len; 69 u8 bssid[ETH_ALEN]; 70 u32 auth_transaction; 71 u16 status; 72 u8 msg[]; 73 }; 74 75 #ifdef CONFIG_WPS 76 enum hapd_wps_status { 77 WPS_SUCCESS_STATUS = 1, 78 WPS_FAILURE_STATUS 79 }; 80 81 enum pbc_status { 82 WPS_PBC_STATUS_DISABLE, 83 WPS_PBC_STATUS_ACTIVE, 84 WPS_PBC_STATUS_TIMEOUT, 85 WPS_PBC_STATUS_OVERLAP 86 }; 87 88 struct wps_stat { 89 enum hapd_wps_status status; 90 enum pbc_status pbc_status; 91 u8 peer_addr[ETH_ALEN]; 92 }; 93 #endif 94 95 /** 96 * struct hostapd_data - hostapd per-BSS data structure 97 */ 98 struct hostapd_data { 99 struct hostapd_config *iconf; 100 struct hostapd_bss_config *conf; 101 int interface_added; /* virtual interface added for this BSS */ 102 103 u8 own_addr[ETH_ALEN]; 104 struct sta_info *sta_list; /* STA info list head */ 105 #define STA_HASH_SIZE 16 106 #define STA_HASH(sta) (sta[5] & 0xf) 107 struct sta_info *sta_hash[STA_HASH_SIZE]; 108 int num_sta; /* number of entries in sta_list */ 109 110 struct eapol_authenticator *eapol_auth; 111 struct wpa_authenticator *wpa_auth; 112 113 #ifdef CONFIG_FULL_DYNAMIC_VLAN 114 struct full_dynamic_vlan *full_dynamic_vlan; 115 #endif /* CONFIG_FULL_DYNAMIC_VLAN */ 116 117 #ifdef CONFIG_WPS 118 struct wps_context *wps; 119 unsigned int ap_pin_failures; 120 unsigned int ap_pin_failures_consecutive; 121 struct upnp_wps_device_sm *wps_upnp; 122 unsigned int ap_pin_lockout_time; 123 124 struct wps_stat wps_stats; 125 void (*wps_event_cb)(void *ctx, enum wps_event event, 126 union wps_event_data *data); 127 #endif /* CONFIG_WPS */ 128 129 #ifdef CONFIG_P2P 130 struct p2p_data *p2p; 131 struct p2p_group *p2p_group; 132 struct wpabuf *p2p_beacon_ie; 133 struct wpabuf *p2p_probe_resp_ie; 134 135 /* Number of non-P2P association stations */ 136 int num_sta_no_p2p; 137 138 /* Periodic NoA (used only when no non-P2P clients in the group) */ 139 int noa_enabled; 140 int noa_start; 141 int noa_duration; 142 #endif /* CONFIG_P2P */ 143 #ifdef CONFIG_SAE 144 145 #define COMEBACK_KEY_SIZE 8 146 #define COMEBACK_PENDING_IDX_SIZE 256 147 148 /** Key used for generating SAE anti-clogging tokens */ 149 u8 comeback_key[COMEBACK_KEY_SIZE]; 150 struct os_reltime last_comeback_key_update; 151 u16 comeback_idx; 152 u16 comeback_pending_idx[COMEBACK_PENDING_IDX_SIZE]; 153 int dot11RSNASAERetransPeriod; 154 struct dl_list sae_commit_queue; /* struct hostapd_sae_commit_queue */ 155 #endif /* CONFIG_SAE */ 156 157 #ifdef CONFIG_INTERWORKING 158 size_t gas_frag_limit; 159 #endif /* CONFIG_INTERWORKING */ 160 161 #ifdef CONFIG_SQLITE 162 struct hostapd_eap_user tmp_eap_user; 163 #endif /* CONFIG_SQLITE */ 164 }; 165 166 struct hostapd_data *hostapd_get_hapd_data(void); 167 168 const struct hostapd_eap_user * 169 hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity, 170 size_t identity_len, int phase2); 171 172 #endif /* HOSTAPD_H */ 173