Change set_ieee8021x driver op to use parameters structure
[libeap.git] / hostapd / sta_info.h
1 /*
2  * hostapd / Station table
3  * Copyright (c) 2002-2008, 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
15 #ifndef STA_INFO_H
16 #define STA_INFO_H
17
18 /* Maximum number of supported rates (from both Supported Rates and Extended
19  * Supported Rates IEs). */
20 #define WLAN_SUPP_RATES_MAX 32
21
22
23 struct sta_info {
24         struct sta_info *next; /* next entry in sta list */
25         struct sta_info *hnext; /* next entry in hash table list */
26         u8 addr[6];
27         u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
28         u32 flags;
29         u16 capability;
30         u16 listen_interval; /* or beacon_int for APs */
31         u8 supported_rates[WLAN_SUPP_RATES_MAX];
32         int supported_rates_len;
33
34         unsigned int nonerp_set:1;
35         unsigned int no_short_slot_time_set:1;
36         unsigned int no_short_preamble_set:1;
37         unsigned int no_ht_gf_set:1;
38         unsigned int no_ht_set:1;
39         unsigned int ht_20mhz_set:1;
40
41         u16 auth_alg;
42         u8 previous_ap[6];
43
44         enum {
45                 STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE
46         } timeout_next;
47
48         /* IEEE 802.1X related data */
49         struct eapol_state_machine *eapol_sm;
50
51         /* IEEE 802.11f (IAPP) related data */
52         struct ieee80211_mgmt *last_assoc_req;
53
54         u32 acct_session_id_hi;
55         u32 acct_session_id_lo;
56         time_t acct_session_start;
57         int acct_session_started;
58         int acct_terminate_cause; /* Acct-Terminate-Cause */
59         int acct_interim_interval; /* Acct-Interim-Interval */
60
61         unsigned long last_rx_bytes;
62         unsigned long last_tx_bytes;
63         u32 acct_input_gigawords; /* Acct-Input-Gigawords */
64         u32 acct_output_gigawords; /* Acct-Output-Gigawords */
65
66         u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
67
68         struct wpa_state_machine *wpa_sm;
69         struct rsn_preauth_interface *preauth_iface;
70
71         struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */
72         struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */
73
74         int vlan_id;
75
76         struct ieee80211_ht_capabilities *ht_capabilities;
77
78 #ifdef CONFIG_IEEE80211W
79         int sa_query_count; /* number of pending SA Query requests;
80                              * 0 = no SA Query in progress */
81         int sa_query_timed_out;
82         u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
83                                 * sa_query_count octets of pending SA Query
84                                 * transaction identifiers */
85         struct os_time sa_query_start;
86 #endif /* CONFIG_IEEE80211W */
87
88         struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
89 };
90
91
92 /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
93  * passed since last received frame from the station, a nullfunc data frame is
94  * sent to the station. If this frame is not acknowledged and no other frames
95  * have been received, the station will be disassociated after
96  * AP_DISASSOC_DELAY seconds. Similarily, the station will be deauthenticated
97  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
98 #define AP_MAX_INACTIVITY (5 * 60)
99 #define AP_DISASSOC_DELAY (1)
100 #define AP_DEAUTH_DELAY (1)
101 /* Number of seconds to keep STA entry with Authenticated flag after it has
102  * been disassociated. */
103 #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
104 /* Number of seconds to keep STA entry after it has been deauthenticated. */
105 #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
106
107
108 struct hostapd_data;
109
110 int ap_for_each_sta(struct hostapd_data *hapd,
111                     int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
112                               void *ctx),
113                     void *ctx);
114 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
115 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
116 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
117 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
118 void hostapd_free_stas(struct hostapd_data *hapd);
119 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
120 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
121                             u32 session_timeout);
122 void ap_sta_no_session_timeout(struct hostapd_data *hapd,
123                                struct sta_info *sta);
124 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
125 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
126                          u16 reason);
127 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
128                            u16 reason);
129 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
130                      int old_vlanid);
131 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
132 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
133 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
134
135 #endif /* STA_INFO_H */