hostapd.h 4.9 KB

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