2 * hostapd / Station table
3 * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "sta_flags.h"
20 #ifdef CONFIG_IEEE80211N
21 #include "ieee802_11_defs.h"
22 #endif /* CONFIG_IEEE80211N */
24 /* Maximum number of supported rates (from both Supported Rates and Extended
25 * Supported Rates IEs). */
26 #define WLAN_SUPP_RATES_MAX 32
30 struct sta_info *next; /* next entry in sta list */
31 struct sta_info *hnext; /* next entry in hash table list */
33 u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
36 u16 listen_interval; /* or beacon_int for APs */
37 u8 supported_rates[WLAN_SUPP_RATES_MAX];
38 int supported_rates_len;
40 unsigned int nonerp_set:1;
41 unsigned int no_short_slot_time_set:1;
42 unsigned int no_short_preamble_set:1;
43 unsigned int no_ht_gf_set:1;
44 unsigned int no_ht_set:1;
45 unsigned int ht_20mhz_set:1;
51 STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE
54 /* IEEE 802.1X related data */
55 struct eapol_state_machine *eapol_sm;
57 /* IEEE 802.11f (IAPP) related data */
58 struct ieee80211_mgmt *last_assoc_req;
60 u32 acct_session_id_hi;
61 u32 acct_session_id_lo;
62 time_t acct_session_start;
63 int acct_session_started;
64 int acct_terminate_cause; /* Acct-Terminate-Cause */
65 int acct_interim_interval; /* Acct-Interim-Interval */
67 unsigned long last_rx_bytes;
68 unsigned long last_tx_bytes;
69 u32 acct_input_gigawords; /* Acct-Input-Gigawords */
70 u32 acct_output_gigawords; /* Acct-Output-Gigawords */
72 u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
74 struct wpa_state_machine *wpa_sm;
75 struct rsn_preauth_interface *preauth_iface;
77 struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */
78 struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */
82 #ifdef CONFIG_IEEE80211N
83 struct ht_cap_ie ht_capabilities; /* IEEE 802.11n capabilities */
84 #endif /* CONFIG_IEEE80211N */
86 #ifdef CONFIG_IEEE80211W
87 int sa_query_count; /* number of pending SA Query requests;
88 * 0 = no SA Query in progress */
89 int sa_query_timed_out;
90 u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
91 * sa_query_count octets of pending SA Query
92 * transaction identifiers */
93 struct os_time sa_query_start;
94 #endif /* CONFIG_IEEE80211W */
96 struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
100 /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
101 * passed since last received frame from the station, a nullfunc data frame is
102 * sent to the station. If this frame is not acknowledged and no other frames
103 * have been received, the station will be disassociated after
104 * AP_DISASSOC_DELAY seconds. Similarily, the station will be deauthenticated
105 * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
106 #define AP_MAX_INACTIVITY (5 * 60)
107 #define AP_DISASSOC_DELAY (1)
108 #define AP_DEAUTH_DELAY (1)
109 /* Number of seconds to keep STA entry with Authenticated flag after it has
110 * been disassociated. */
111 #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
112 /* Number of seconds to keep STA entry after it has been deauthenticated. */
113 #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
118 int ap_for_each_sta(struct hostapd_data *hapd,
119 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
122 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
123 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
124 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
125 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
126 void hostapd_free_stas(struct hostapd_data *hapd);
127 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
128 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
129 u32 session_timeout);
130 void ap_sta_no_session_timeout(struct hostapd_data *hapd,
131 struct sta_info *sta);
132 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
133 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
135 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
137 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
139 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
140 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
141 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
143 #endif /* STA_INFO_H */