ap.h 3.4 KB

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