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