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