sta_info.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * hostapd / Station table
  3. * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #ifndef STA_INFO_H
  15. #define STA_INFO_H
  16. #include "sta_flags.h"
  17. #ifdef CONFIG_IEEE80211N
  18. #include "ieee802_11_defs.h"
  19. #endif /* CONFIG_IEEE80211N */
  20. /* Maximum number of supported rates (from both Supported Rates and Extended
  21. * Supported Rates IEs). */
  22. #define WLAN_SUPP_RATES_MAX 32
  23. struct sta_info {
  24. struct sta_info *next; /* next entry in sta list */
  25. struct sta_info *hnext; /* next entry in hash table list */
  26. u8 addr[6];
  27. u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
  28. u32 flags;
  29. u16 capability;
  30. u16 listen_interval; /* or beacon_int for APs */
  31. u8 supported_rates[WLAN_SUPP_RATES_MAX];
  32. int supported_rates_len;
  33. unsigned int nonerp_set:1;
  34. unsigned int no_short_slot_time_set:1;
  35. unsigned int no_short_preamble_set:1;
  36. unsigned int no_ht_gf_set:1;
  37. unsigned int no_ht_set:1;
  38. unsigned int ht_20mhz_set:1;
  39. u16 auth_alg;
  40. u8 previous_ap[6];
  41. enum {
  42. STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE
  43. } timeout_next;
  44. /* IEEE 802.1X related data */
  45. struct eapol_state_machine *eapol_sm;
  46. /* IEEE 802.11f (IAPP) related data */
  47. struct ieee80211_mgmt *last_assoc_req;
  48. u32 acct_session_id_hi;
  49. u32 acct_session_id_lo;
  50. time_t acct_session_start;
  51. int acct_session_started;
  52. int acct_terminate_cause; /* Acct-Terminate-Cause */
  53. int acct_interim_interval; /* Acct-Interim-Interval */
  54. unsigned long last_rx_bytes;
  55. unsigned long last_tx_bytes;
  56. u32 acct_input_gigawords; /* Acct-Input-Gigawords */
  57. u32 acct_output_gigawords; /* Acct-Output-Gigawords */
  58. u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
  59. struct wpa_state_machine *wpa_sm;
  60. struct rsn_preauth_interface *preauth_iface;
  61. struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */
  62. struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */
  63. int vlan_id;
  64. #ifdef CONFIG_IEEE80211N
  65. struct ht_cap_ie ht_capabilities; /* IEEE 802.11n capabilities */
  66. #endif /* CONFIG_IEEE80211N */
  67. #ifdef CONFIG_IEEE80211W
  68. int sa_query_count; /* number of pending SA Query requests;
  69. * 0 = no SA Query in progress */
  70. int sa_query_timed_out;
  71. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  72. * sa_query_count octets of pending SA Query
  73. * transaction identifiers */
  74. struct os_time sa_query_start;
  75. #endif /* CONFIG_IEEE80211W */
  76. struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
  77. };
  78. /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
  79. * passed since last received frame from the station, a nullfunc data frame is
  80. * sent to the station. If this frame is not acknowledged and no other frames
  81. * have been received, the station will be disassociated after
  82. * AP_DISASSOC_DELAY seconds. Similarily, the station will be deauthenticated
  83. * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  84. #define AP_MAX_INACTIVITY (5 * 60)
  85. #define AP_DISASSOC_DELAY (1)
  86. #define AP_DEAUTH_DELAY (1)
  87. /* Number of seconds to keep STA entry with Authenticated flag after it has
  88. * been disassociated. */
  89. #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
  90. /* Number of seconds to keep STA entry after it has been deauthenticated. */
  91. #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
  92. struct hostapd_data;
  93. int ap_for_each_sta(struct hostapd_data *hapd,
  94. int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
  95. void *ctx),
  96. void *ctx);
  97. struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
  98. void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
  99. void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
  100. void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
  101. void hostapd_free_stas(struct hostapd_data *hapd);
  102. void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
  103. void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
  104. u32 session_timeout);
  105. void ap_sta_no_session_timeout(struct hostapd_data *hapd,
  106. struct sta_info *sta);
  107. struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
  108. void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
  109. u16 reason);
  110. void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
  111. u16 reason);
  112. int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
  113. int old_vlanid);
  114. void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
  115. void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
  116. int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
  117. #endif /* STA_INFO_H */