ap.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * hostapd / Station table data structures
  3. * Copyright (c) 2002-2004, 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 AP_H
  15. #define AP_H
  16. #ifdef CONFIG_IEEE80211N
  17. #include "ieee802_11_defs.h"
  18. #endif /* CONFIG_IEEE80211N */
  19. /* STA flags */
  20. #define WLAN_STA_AUTH BIT(0)
  21. #define WLAN_STA_ASSOC BIT(1)
  22. #define WLAN_STA_PS BIT(2)
  23. #define WLAN_STA_TIM BIT(3)
  24. #define WLAN_STA_PERM BIT(4)
  25. #define WLAN_STA_AUTHORIZED BIT(5)
  26. #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
  27. #define WLAN_STA_SHORT_PREAMBLE BIT(7)
  28. #define WLAN_STA_PREAUTH BIT(8)
  29. #define WLAN_STA_WME BIT(9)
  30. #define WLAN_STA_MFP BIT(10)
  31. #define WLAN_STA_HT BIT(11)
  32. #define WLAN_STA_NONERP BIT(31)
  33. /* Maximum number of supported rates (from both Supported Rates and Extended
  34. * Supported Rates IEs). */
  35. #define WLAN_SUPP_RATES_MAX 32
  36. struct sta_info {
  37. struct sta_info *next; /* next entry in sta list */
  38. struct sta_info *hnext; /* next entry in hash table list */
  39. u8 addr[6];
  40. u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
  41. u32 flags;
  42. u16 capability;
  43. u16 listen_interval; /* or beacon_int for APs */
  44. u8 supported_rates[WLAN_SUPP_RATES_MAX];
  45. int supported_rates_len;
  46. unsigned int nonerp_set:1;
  47. unsigned int no_short_slot_time_set:1;
  48. unsigned int no_short_preamble_set:1;
  49. u16 auth_alg;
  50. u8 previous_ap[6];
  51. enum {
  52. STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE
  53. } timeout_next;
  54. /* IEEE 802.1X related data */
  55. struct eapol_state_machine *eapol_sm;
  56. /* IEEE 802.11f (IAPP) related data */
  57. struct ieee80211_mgmt *last_assoc_req;
  58. u32 acct_session_id_hi;
  59. u32 acct_session_id_lo;
  60. time_t acct_session_start;
  61. int acct_session_started;
  62. int acct_terminate_cause; /* Acct-Terminate-Cause */
  63. int acct_interim_interval; /* Acct-Interim-Interval */
  64. unsigned long last_rx_bytes;
  65. unsigned long last_tx_bytes;
  66. u32 acct_input_gigawords; /* Acct-Input-Gigawords */
  67. u32 acct_output_gigawords; /* Acct-Output-Gigawords */
  68. u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
  69. struct wpa_state_machine *wpa_sm;
  70. struct rsn_preauth_interface *preauth_iface;
  71. struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */
  72. struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */
  73. int vlan_id;
  74. #ifdef CONFIG_IEEE80211N
  75. struct ht_cap_ie ht_capabilities; /* IEEE 802.11n capabilities */
  76. #endif /* CONFIG_IEEE80211N */
  77. };
  78. /* Maximum number of AIDs to use for STAs; must be 2007 or lower
  79. * (8802.11 limitation) */
  80. #define MAX_AID_TABLE_SIZE 128
  81. #define STA_HASH_SIZE 256
  82. #define STA_HASH(sta) (sta[5])
  83. /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
  84. * passed since last received frame from the station, a nullfunc data frame is
  85. * sent to the station. If this frame is not acknowledged and no other frames
  86. * have been received, the station will be disassociated after
  87. * AP_DISASSOC_DELAY seconds. Similarily, the station will be deauthenticated
  88. * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  89. #define AP_MAX_INACTIVITY (5 * 60)
  90. #define AP_DISASSOC_DELAY (1)
  91. #define AP_DEAUTH_DELAY (1)
  92. /* Number of seconds to keep STA entry with Authenticated flag after it has
  93. * been disassociated. */
  94. #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
  95. /* Number of seconds to keep STA entry after it has been deauthenticated. */
  96. #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
  97. #endif /* AP_H */