hostapd.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. #ifndef HOSTAPD_H
  17. #define HOSTAPD_H
  18. #include "common.h"
  19. #include "ap.h"
  20. #ifndef ETH_ALEN
  21. #define ETH_ALEN 6
  22. #endif
  23. #ifndef IFNAMSIZ
  24. #define IFNAMSIZ 16
  25. #endif
  26. #ifndef ETH_P_ALL
  27. #define ETH_P_ALL 0x0003
  28. #endif
  29. #ifndef ETH_P_PAE
  30. #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
  31. #endif /* ETH_P_PAE */
  32. #ifndef ETH_P_EAPOL
  33. #define ETH_P_EAPOL ETH_P_PAE
  34. #endif /* ETH_P_EAPOL */
  35. #ifndef ETH_P_RRB
  36. #define ETH_P_RRB 0x890D
  37. #endif /* ETH_P_RRB */
  38. #include "config.h"
  39. #ifdef _MSC_VER
  40. #pragma pack(push, 1)
  41. #endif /* _MSC_VER */
  42. #define MAX_VLAN_ID 4094
  43. struct ieee8023_hdr {
  44. u8 dest[6];
  45. u8 src[6];
  46. u16 ethertype;
  47. } STRUCT_PACKED;
  48. struct ieee80211_hdr {
  49. le16 frame_control;
  50. le16 duration_id;
  51. u8 addr1[6];
  52. u8 addr2[6];
  53. u8 addr3[6];
  54. le16 seq_ctrl;
  55. /* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
  56. */
  57. } STRUCT_PACKED;
  58. #ifdef _MSC_VER
  59. #pragma pack(pop)
  60. #endif /* _MSC_VER */
  61. #define IEEE80211_DA_FROMDS addr1
  62. #define IEEE80211_BSSID_FROMDS addr2
  63. #define IEEE80211_SA_FROMDS addr3
  64. #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
  65. #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
  66. /* MTU to be set for the wlan#ap device; this is mainly needed for IEEE 802.1X
  67. * frames that might be longer than normal default MTU and they are not
  68. * fragmented */
  69. #define HOSTAPD_MTU 2290
  70. extern unsigned char rfc1042_header[6];
  71. struct hostap_sta_driver_data {
  72. unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
  73. unsigned long current_tx_rate;
  74. unsigned long inactive_msec;
  75. unsigned long flags;
  76. unsigned long num_ps_buf_frames;
  77. unsigned long tx_retry_failed;
  78. unsigned long tx_retry_count;
  79. int last_rssi;
  80. int last_ack_rssi;
  81. };
  82. struct wpa_driver_ops;
  83. struct wpa_ctrl_dst;
  84. struct radius_server_data;
  85. #ifdef CONFIG_FULL_DYNAMIC_VLAN
  86. struct full_dynamic_vlan;
  87. #endif /* CONFIG_FULL_DYNAMIC_VLAN */
  88. /**
  89. * struct hostapd_data - hostapd per-BSS data structure
  90. */
  91. struct hostapd_data {
  92. struct hostapd_iface *iface;
  93. struct hostapd_config *iconf;
  94. struct hostapd_bss_config *conf;
  95. int interface_added; /* virtual interface added for this BSS */
  96. u8 own_addr[ETH_ALEN];
  97. int num_sta; /* number of entries in sta_list */
  98. struct sta_info *sta_list; /* STA info list head */
  99. struct sta_info *sta_hash[STA_HASH_SIZE];
  100. /* pointers to STA info; based on allocated AID or NULL if AID free
  101. * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
  102. * and so on
  103. */
  104. struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
  105. const struct wpa_driver_ops *driver;
  106. void *drv_priv;
  107. u8 *default_wep_key;
  108. u8 default_wep_key_idx;
  109. struct radius_client_data *radius;
  110. int radius_client_reconfigured;
  111. u32 acct_session_id_hi, acct_session_id_lo;
  112. struct iapp_data *iapp;
  113. struct hostapd_cached_radius_acl *acl_cache;
  114. struct hostapd_acl_query_data *acl_queries;
  115. struct wpa_authenticator *wpa_auth;
  116. struct eapol_authenticator *eapol_auth;
  117. struct rsn_preauth_interface *preauth_iface;
  118. time_t michael_mic_failure;
  119. int michael_mic_failures;
  120. int tkip_countermeasures;
  121. int ctrl_sock;
  122. struct wpa_ctrl_dst *ctrl_dst;
  123. void *ssl_ctx;
  124. void *eap_sim_db_priv;
  125. struct radius_server_data *radius_srv;
  126. int parameter_set_count;
  127. #ifdef CONFIG_FULL_DYNAMIC_VLAN
  128. struct full_dynamic_vlan *full_dynamic_vlan;
  129. #endif /* CONFIG_FULL_DYNAMIC_VLAN */
  130. struct l2_packet_data *l2;
  131. struct wps_context *wps;
  132. #ifdef CONFIG_WPS
  133. u8 *wps_beacon_ie;
  134. size_t wps_beacon_ie_len;
  135. u8 *wps_probe_resp_ie;
  136. size_t wps_probe_resp_ie_len;
  137. #endif /* CONFIG_WPS */
  138. };
  139. /**
  140. * struct hostapd_iface - hostapd per-interface data structure
  141. */
  142. struct hostapd_iface {
  143. char *config_fname;
  144. struct hostapd_config *conf;
  145. size_t num_bss;
  146. struct hostapd_data **bss;
  147. int num_ap; /* number of entries in ap_list */
  148. struct ap_info *ap_list; /* AP info list head */
  149. struct ap_info *ap_hash[STA_HASH_SIZE];
  150. struct ap_info *ap_iter_list;
  151. struct hostapd_hw_modes *hw_features;
  152. int num_hw_features;
  153. struct hostapd_hw_modes *current_mode;
  154. /* Rates that are currently used (i.e., filtered copy of
  155. * current_mode->channels */
  156. int num_rates;
  157. struct hostapd_rate_data *current_rates;
  158. u16 hw_flags;
  159. /* Number of associated Non-ERP stations (i.e., stations using 802.11b
  160. * in 802.11g BSS) */
  161. int num_sta_non_erp;
  162. /* Number of associated stations that do not support Short Slot Time */
  163. int num_sta_no_short_slot_time;
  164. /* Number of associated stations that do not support Short Preamble */
  165. int num_sta_no_short_preamble;
  166. int olbc; /* Overlapping Legacy BSS Condition */
  167. /* Number of HT associated stations that do not support greenfield */
  168. int num_sta_ht_no_gf;
  169. /* Number of associated non-HT stations */
  170. int num_sta_no_ht;
  171. /* Number of HT associated stations 20 MHz */
  172. int num_sta_ht_20mhz;
  173. /* Overlapping BSS information */
  174. int olbc_ht;
  175. #ifdef CONFIG_IEEE80211N
  176. u16 ht_op_mode;
  177. #endif /* CONFIG_IEEE80211N */
  178. };
  179. void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
  180. int reassoc);
  181. int hostapd_reload_config(struct hostapd_iface *iface);
  182. #endif /* HOSTAPD_H */