wpa_supplicant / hostapd 2.0

sta_info.h

Go to the documentation of this file.
00001 
00010 #ifndef STA_INFO_H
00011 #define STA_INFO_H
00012 
00013 /* STA flags */
00014 #define WLAN_STA_AUTH BIT(0)
00015 #define WLAN_STA_ASSOC BIT(1)
00016 #define WLAN_STA_PS BIT(2)
00017 #define WLAN_STA_TIM BIT(3)
00018 #define WLAN_STA_PERM BIT(4)
00019 #define WLAN_STA_AUTHORIZED BIT(5)
00020 #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
00021 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
00022 #define WLAN_STA_PREAUTH BIT(8)
00023 #define WLAN_STA_WMM BIT(9)
00024 #define WLAN_STA_MFP BIT(10)
00025 #define WLAN_STA_HT BIT(11)
00026 #define WLAN_STA_WPS BIT(12)
00027 #define WLAN_STA_MAYBE_WPS BIT(13)
00028 #define WLAN_STA_WDS BIT(14)
00029 #define WLAN_STA_ASSOC_REQ_OK BIT(15)
00030 #define WLAN_STA_WPS2 BIT(16)
00031 #define WLAN_STA_GAS BIT(17)
00032 #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
00033 #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
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         u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
00052 
00053         unsigned int nonerp_set:1;
00054         unsigned int no_short_slot_time_set:1;
00055         unsigned int no_short_preamble_set:1;
00056         unsigned int no_ht_gf_set:1;
00057         unsigned int no_ht_set:1;
00058         unsigned int ht_20mhz_set:1;
00059         unsigned int no_p2p_set:1;
00060 
00061         u16 auth_alg;
00062         u8 previous_ap[6];
00063 
00064         enum {
00065                 STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE
00066         } timeout_next;
00067 
00068         u16 deauth_reason;
00069         u16 disassoc_reason;
00070 
00071         /* IEEE 802.1X related data */
00072         struct eapol_state_machine *eapol_sm;
00073 
00074         /* IEEE 802.11f (IAPP) related data */
00075         struct ieee80211_mgmt *last_assoc_req;
00076 
00077         u32 acct_session_id_hi;
00078         u32 acct_session_id_lo;
00079         time_t acct_session_start;
00080         int acct_session_started;
00081         int acct_terminate_cause; /* Acct-Terminate-Cause */
00082         int acct_interim_interval; /* Acct-Interim-Interval */
00083 
00084         unsigned long last_rx_bytes;
00085         unsigned long last_tx_bytes;
00086         u32 acct_input_gigawords; /* Acct-Input-Gigawords */
00087         u32 acct_output_gigawords; /* Acct-Output-Gigawords */
00088 
00089         u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
00090 
00091         struct wpa_state_machine *wpa_sm;
00092         struct rsn_preauth_interface *preauth_iface;
00093 
00094         struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */
00095         struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */
00096 
00097         int vlan_id;
00098         u8 *psk; /* PSK from RADIUS authentication server */
00099 
00100         struct ieee80211_ht_capabilities *ht_capabilities;
00101 
00102 #ifdef CONFIG_IEEE80211W
00103         int sa_query_count; /* number of pending SA Query requests;
00104                              * 0 = no SA Query in progress */
00105         int sa_query_timed_out;
00106         u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
00107                                 * sa_query_count octets of pending SA Query
00108                                 * transaction identifiers */
00109         struct os_time sa_query_start;
00110 #endif /* CONFIG_IEEE80211W */
00111 
00112 #ifdef CONFIG_INTERWORKING
00113 #define GAS_DIALOG_MAX 8 /* Max concurrent dialog number */
00114         struct gas_dialog_info *gas_dialog;
00115         u8 gas_dialog_next;
00116 #endif /* CONFIG_INTERWORKING */
00117 
00118         struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
00119         struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
00120 };
00121 
00122 
00123 /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
00124  * passed since last received frame from the station, a nullfunc data frame is
00125  * sent to the station. If this frame is not acknowledged and no other frames
00126  * have been received, the station will be disassociated after
00127  * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
00128  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
00129 #define AP_MAX_INACTIVITY (5 * 60)
00130 #define AP_DISASSOC_DELAY (1)
00131 #define AP_DEAUTH_DELAY (1)
00132 /* Number of seconds to keep STA entry with Authenticated flag after it has
00133  * been disassociated. */
00134 #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
00135 /* Number of seconds to keep STA entry after it has been deauthenticated. */
00136 #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
00137 
00138 
00139 struct hostapd_data;
00140 
00141 int ap_for_each_sta(struct hostapd_data *hapd,
00142                     int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
00143                               void *ctx),
00144                     void *ctx);
00145 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
00146 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
00147 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
00148 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
00149 void hostapd_free_stas(struct hostapd_data *hapd);
00150 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
00151 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
00152                             u32 session_timeout);
00153 void ap_sta_no_session_timeout(struct hostapd_data *hapd,
00154                                struct sta_info *sta);
00155 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
00156 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
00157                          u16 reason);
00158 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
00159                            u16 reason);
00160 #ifdef CONFIG_WPS
00161 int ap_sta_wps_cancel(struct hostapd_data *hapd,
00162                       struct sta_info *sta, void *ctx);
00163 #endif /* CONFIG_WPS */
00164 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
00165                      int old_vlanid);
00166 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
00167 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
00168 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
00169 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
00170                        const u8 *addr, u16 reason);
00171 
00172 void ap_sta_set_authorized(struct hostapd_data *hapd,
00173                            struct sta_info *sta, int authorized);
00174 static inline int ap_sta_is_authorized(struct sta_info *sta)
00175 {
00176         return sta->flags & WLAN_STA_AUTHORIZED;
00177 }
00178 
00179 void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta);
00180 void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta);
00181 
00182 #endif /* STA_INFO_H */
00183 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines