$search
00001 /* 00002 * hostapd / Station table 00003 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef STA_INFO_H 00016 #define STA_INFO_H 00017 00018 /* STA flags */ 00019 #define WLAN_STA_AUTH BIT(0) 00020 #define WLAN_STA_ASSOC BIT(1) 00021 #define WLAN_STA_PS BIT(2) 00022 #define WLAN_STA_TIM BIT(3) 00023 #define WLAN_STA_PERM BIT(4) 00024 #define WLAN_STA_AUTHORIZED BIT(5) 00025 #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */ 00026 #define WLAN_STA_SHORT_PREAMBLE BIT(7) 00027 #define WLAN_STA_PREAUTH BIT(8) 00028 #define WLAN_STA_WMM BIT(9) 00029 #define WLAN_STA_MFP BIT(10) 00030 #define WLAN_STA_HT BIT(11) 00031 #define WLAN_STA_WPS BIT(12) 00032 #define WLAN_STA_MAYBE_WPS BIT(13) 00033 #define WLAN_STA_WDS BIT(14) 00034 #define WLAN_STA_NONERP BIT(31) 00035 00036 /* Maximum number of supported rates (from both Supported Rates and Extended 00037 * Supported Rates IEs). */ 00038 #define WLAN_SUPP_RATES_MAX 32 00039 00040 00041 struct sta_info { 00042 struct sta_info *next; /* next entry in sta list */ 00043 struct sta_info *hnext; /* next entry in hash table list */ 00044 u8 addr[6]; 00045 u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */ 00046 u32 flags; /* Bitfield of WLAN_STA_* */ 00047 u16 capability; 00048 u16 listen_interval; /* or beacon_int for APs */ 00049 u8 supported_rates[WLAN_SUPP_RATES_MAX]; 00050 int supported_rates_len; 00051 00052 unsigned int nonerp_set:1; 00053 unsigned int no_short_slot_time_set:1; 00054 unsigned int no_short_preamble_set:1; 00055 unsigned int no_ht_gf_set:1; 00056 unsigned int no_ht_set:1; 00057 unsigned int ht_20mhz_set:1; 00058 00059 u16 auth_alg; 00060 u8 previous_ap[6]; 00061 00062 enum { 00063 STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE 00064 } timeout_next; 00065 00066 /* IEEE 802.1X related data */ 00067 struct eapol_state_machine *eapol_sm; 00068 00069 /* IEEE 802.11f (IAPP) related data */ 00070 struct ieee80211_mgmt *last_assoc_req; 00071 00072 u32 acct_session_id_hi; 00073 u32 acct_session_id_lo; 00074 time_t acct_session_start; 00075 int acct_session_started; 00076 int acct_terminate_cause; /* Acct-Terminate-Cause */ 00077 int acct_interim_interval; /* Acct-Interim-Interval */ 00078 00079 unsigned long last_rx_bytes; 00080 unsigned long last_tx_bytes; 00081 u32 acct_input_gigawords; /* Acct-Input-Gigawords */ 00082 u32 acct_output_gigawords; /* Acct-Output-Gigawords */ 00083 00084 u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */ 00085 00086 struct wpa_state_machine *wpa_sm; 00087 struct rsn_preauth_interface *preauth_iface; 00088 00089 struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */ 00090 struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */ 00091 00092 int vlan_id; 00093 00094 struct ieee80211_ht_capabilities *ht_capabilities; 00095 00096 #ifdef CONFIG_IEEE80211W 00097 int sa_query_count; /* number of pending SA Query requests; 00098 * 0 = no SA Query in progress */ 00099 int sa_query_timed_out; 00100 u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN * 00101 * sa_query_count octets of pending SA Query 00102 * transaction identifiers */ 00103 struct os_time sa_query_start; 00104 #endif /* CONFIG_IEEE80211W */ 00105 00106 struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */ 00107 }; 00108 00109 00110 /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has 00111 * passed since last received frame from the station, a nullfunc data frame is 00112 * sent to the station. If this frame is not acknowledged and no other frames 00113 * have been received, the station will be disassociated after 00114 * AP_DISASSOC_DELAY seconds. Similarily, the station will be deauthenticated 00115 * after AP_DEAUTH_DELAY seconds has passed after disassociation. */ 00116 #define AP_MAX_INACTIVITY (5 * 60) 00117 #define AP_DISASSOC_DELAY (1) 00118 #define AP_DEAUTH_DELAY (1) 00119 /* Number of seconds to keep STA entry with Authenticated flag after it has 00120 * been disassociated. */ 00121 #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30) 00122 /* Number of seconds to keep STA entry after it has been deauthenticated. */ 00123 #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5) 00124 00125 00126 struct hostapd_data; 00127 00128 int ap_for_each_sta(struct hostapd_data *hapd, 00129 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta, 00130 void *ctx), 00131 void *ctx); 00132 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta); 00133 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta); 00134 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta); 00135 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta); 00136 void hostapd_free_stas(struct hostapd_data *hapd); 00137 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx); 00138 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta, 00139 u32 session_timeout); 00140 void ap_sta_no_session_timeout(struct hostapd_data *hapd, 00141 struct sta_info *sta); 00142 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr); 00143 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta, 00144 u16 reason); 00145 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta, 00146 u16 reason); 00147 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta, 00148 int old_vlanid); 00149 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta); 00150 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta); 00151 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta); 00152 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta, 00153 const u8 *addr, u16 reason); 00154 00155 #endif /* STA_INFO_H */