hostapd.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 "hostapd_defs.h"
  20. #include "config.h"
  21. struct wpa_driver_ops;
  22. struct wpa_ctrl_dst;
  23. struct radius_server_data;
  24. struct upnp_wps_device_sm;
  25. #ifdef CONFIG_FULL_DYNAMIC_VLAN
  26. struct full_dynamic_vlan;
  27. #endif /* CONFIG_FULL_DYNAMIC_VLAN */
  28. /**
  29. * struct hostapd_data - hostapd per-BSS data structure
  30. */
  31. struct hostapd_data {
  32. struct hostapd_iface *iface;
  33. struct hostapd_config *iconf;
  34. struct hostapd_bss_config *conf;
  35. int interface_added; /* virtual interface added for this BSS */
  36. u8 own_addr[ETH_ALEN];
  37. int num_sta; /* number of entries in sta_list */
  38. struct sta_info *sta_list; /* STA info list head */
  39. #define STA_HASH_SIZE 256
  40. #define STA_HASH(sta) (sta[5])
  41. struct sta_info *sta_hash[STA_HASH_SIZE];
  42. /*
  43. * Bitfield for indicating which AIDs are allocated. Only AID values
  44. * 1-2007 are used and as such, the bit at index 0 corresponds to AID
  45. * 1.
  46. */
  47. #define AID_WORDS ((2008 + 31) / 32)
  48. u32 sta_aid[AID_WORDS];
  49. const struct wpa_driver_ops *driver;
  50. void *drv_priv;
  51. u8 *default_wep_key;
  52. u8 default_wep_key_idx;
  53. struct radius_client_data *radius;
  54. int radius_client_reconfigured;
  55. u32 acct_session_id_hi, acct_session_id_lo;
  56. struct iapp_data *iapp;
  57. struct hostapd_cached_radius_acl *acl_cache;
  58. struct hostapd_acl_query_data *acl_queries;
  59. struct wpa_authenticator *wpa_auth;
  60. struct eapol_authenticator *eapol_auth;
  61. struct rsn_preauth_interface *preauth_iface;
  62. time_t michael_mic_failure;
  63. int michael_mic_failures;
  64. int tkip_countermeasures;
  65. int ctrl_sock;
  66. struct wpa_ctrl_dst *ctrl_dst;
  67. void *ssl_ctx;
  68. void *eap_sim_db_priv;
  69. struct radius_server_data *radius_srv;
  70. int parameter_set_count;
  71. #ifdef CONFIG_FULL_DYNAMIC_VLAN
  72. struct full_dynamic_vlan *full_dynamic_vlan;
  73. #endif /* CONFIG_FULL_DYNAMIC_VLAN */
  74. struct l2_packet_data *l2;
  75. struct wps_context *wps;
  76. #ifdef CONFIG_WPS
  77. u8 *wps_beacon_ie;
  78. size_t wps_beacon_ie_len;
  79. u8 *wps_probe_resp_ie;
  80. size_t wps_probe_resp_ie_len;
  81. unsigned int ap_pin_failures;
  82. struct upnp_wps_device_sm *wps_upnp;
  83. #endif /* CONFIG_WPS */
  84. };
  85. /**
  86. * struct hostapd_iface - hostapd per-interface data structure
  87. */
  88. struct hostapd_iface {
  89. char *config_fname;
  90. struct hostapd_config *conf;
  91. size_t num_bss;
  92. struct hostapd_data **bss;
  93. int num_ap; /* number of entries in ap_list */
  94. struct ap_info *ap_list; /* AP info list head */
  95. struct ap_info *ap_hash[STA_HASH_SIZE];
  96. struct ap_info *ap_iter_list;
  97. struct hostapd_hw_modes *hw_features;
  98. int num_hw_features;
  99. struct hostapd_hw_modes *current_mode;
  100. /* Rates that are currently used (i.e., filtered copy of
  101. * current_mode->channels */
  102. int num_rates;
  103. struct hostapd_rate_data *current_rates;
  104. u16 hw_flags;
  105. /* Number of associated Non-ERP stations (i.e., stations using 802.11b
  106. * in 802.11g BSS) */
  107. int num_sta_non_erp;
  108. /* Number of associated stations that do not support Short Slot Time */
  109. int num_sta_no_short_slot_time;
  110. /* Number of associated stations that do not support Short Preamble */
  111. int num_sta_no_short_preamble;
  112. int olbc; /* Overlapping Legacy BSS Condition */
  113. /* Number of HT associated stations that do not support greenfield */
  114. int num_sta_ht_no_gf;
  115. /* Number of associated non-HT stations */
  116. int num_sta_no_ht;
  117. /* Number of HT associated stations 20 MHz */
  118. int num_sta_ht_20mhz;
  119. /* Overlapping BSS information */
  120. int olbc_ht;
  121. #ifdef CONFIG_IEEE80211N
  122. u16 ht_op_mode;
  123. #endif /* CONFIG_IEEE80211N */
  124. };
  125. int hostapd_reload_config(struct hostapd_iface *iface);
  126. int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
  127. void *ctx), void *ctx);
  128. #endif /* HOSTAPD_H */