Merge branch 'vendor/MDOCML'
[dragonfly.git] / contrib / hostapd / hostapd / ap.h
1 /*
2  * hostapd / Station table data structures
3  * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2007-2008, Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * Alternatively, this software may be distributed under the terms of BSD
11  * license.
12  *
13  * See README and COPYING for more details.
14  */
15
16 #ifndef AP_H
17 #define AP_H
18
19 #ifdef CONFIG_IEEE80211N
20 #include "ieee802_11_defs.h"
21 #endif /* CONFIG_IEEE80211N */
22
23 /* STA flags */
24 #define WLAN_STA_AUTH BIT(0)
25 #define WLAN_STA_ASSOC BIT(1)
26 #define WLAN_STA_PS BIT(2)
27 #define WLAN_STA_TIM BIT(3)
28 #define WLAN_STA_PERM BIT(4)
29 #define WLAN_STA_AUTHORIZED BIT(5)
30 #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
31 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
32 #define WLAN_STA_PREAUTH BIT(8)
33 #define WLAN_STA_WMM BIT(9)
34 #define WLAN_STA_MFP BIT(10)
35 #define WLAN_STA_HT BIT(11)
36 #define WLAN_STA_WPS BIT(12)
37 #define WLAN_STA_MAYBE_WPS BIT(13)
38 #define WLAN_STA_NONERP BIT(31)
39
40 /* Maximum number of supported rates (from both Supported Rates and Extended
41  * Supported Rates IEs). */
42 #define WLAN_SUPP_RATES_MAX 32
43
44
45 struct sta_info {
46         struct sta_info *next; /* next entry in sta list */
47         struct sta_info *hnext; /* next entry in hash table list */
48         u8 addr[6];
49         u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
50         u32 flags;
51         u16 capability;
52         u16 listen_interval; /* or beacon_int for APs */
53         u8 supported_rates[WLAN_SUPP_RATES_MAX];
54         int supported_rates_len;
55
56         unsigned int nonerp_set:1;
57         unsigned int no_short_slot_time_set:1;
58         unsigned int no_short_preamble_set:1;
59         unsigned int no_ht_gf_set:1;
60         unsigned int no_ht_set:1;
61         unsigned int ht_20mhz_set:1;
62
63         u16 auth_alg;
64         u8 previous_ap[6];
65
66         enum {
67                 STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE
68         } timeout_next;
69
70         /* IEEE 802.1X related data */
71         struct eapol_state_machine *eapol_sm;
72
73         /* IEEE 802.11f (IAPP) related data */
74         struct ieee80211_mgmt *last_assoc_req;
75
76         u32 acct_session_id_hi;
77         u32 acct_session_id_lo;
78         time_t acct_session_start;
79         int acct_session_started;
80         int acct_terminate_cause; /* Acct-Terminate-Cause */
81         int acct_interim_interval; /* Acct-Interim-Interval */
82
83         unsigned long last_rx_bytes;
84         unsigned long last_tx_bytes;
85         u32 acct_input_gigawords; /* Acct-Input-Gigawords */
86         u32 acct_output_gigawords; /* Acct-Output-Gigawords */
87
88         u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
89
90         struct wpa_state_machine *wpa_sm;
91         struct rsn_preauth_interface *preauth_iface;
92
93         struct hostapd_ssid *ssid; /* SSID selection based on (Re)AssocReq */
94         struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */
95
96         int vlan_id;
97
98 #ifdef CONFIG_IEEE80211N
99         struct ht_cap_ie ht_capabilities; /* IEEE 802.11n capabilities */
100 #endif /* CONFIG_IEEE80211N */
101
102 #ifdef CONFIG_IEEE80211W
103         int sa_query_count; /* number of pending SA Query requests;
104                              * 0 = no SA Query in progress */
105         int sa_query_timed_out;
106         u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
107                                 * sa_query_count octets of pending SA Query
108                                 * transaction identifiers */
109         struct os_time sa_query_start;
110 #endif /* CONFIG_IEEE80211W */
111
112         struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
113 };
114
115
116 /* Maximum number of AIDs to use for STAs; must be 2007 or lower
117  * (8802.11 limitation) */
118 #define MAX_AID_TABLE_SIZE 128
119
120 #define STA_HASH_SIZE 256
121 #define STA_HASH(sta) (sta[5])
122
123
124 /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
125  * passed since last received frame from the station, a nullfunc data frame is
126  * sent to the station. If this frame is not acknowledged and no other frames
127  * have been received, the station will be disassociated after
128  * AP_DISASSOC_DELAY seconds. Similarily, the station will be deauthenticated
129  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
130 #define AP_MAX_INACTIVITY (5 * 60)
131 #define AP_DISASSOC_DELAY (1)
132 #define AP_DEAUTH_DELAY (1)
133 /* Number of seconds to keep STA entry with Authenticated flag after it has
134  * been disassociated. */
135 #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
136 /* Number of seconds to keep STA entry after it has been deauthenticated. */
137 #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
138
139 #endif /* AP_H */