hostapd.h 4.8 KB

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