Merge branch 'vendor/MDOCML'
[dragonfly.git] / contrib / hostapd / hostapd / wme.h
1 /*
2  * hostapd / WMM (Wi-Fi Multimedia)
3  * Copyright 2002-2003, Instant802 Networks, Inc.
4  * Copyright 2005-2006, Devicescape Software, Inc.
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 WME_H
17 #define WME_H
18
19 /*
20  * WMM Information Element (used in (Re)Association Request frames; may also be
21  * used in Beacon frames)
22  */
23 struct wmm_information_element {
24         /* Element ID: 221 (0xdd); Length: 7 */
25         /* required fields for WMM version 1 */
26         u8 oui[3]; /* 00:50:f2 */
27         u8 oui_type; /* 2 */
28         u8 oui_subtype; /* 0 */
29         u8 version; /* 1 for WMM version 1.0 */
30         u8 qos_info; /* AP/STA specific QoS info */
31
32 } __attribute__ ((packed));
33
34 #define WMM_AC_AIFSN_MASK 0x0f
35 #define WMM_AC_AIFNS_SHIFT 0
36 #define WMM_AC_ACM 0x10
37 #define WMM_AC_ACI_MASK 0x60
38 #define WMM_AC_ACI_SHIFT 5
39
40 #define WMM_AC_ECWMIN_MASK 0x0f
41 #define WMM_AC_ECWMIN_SHIFT 0
42 #define WMM_AC_ECWMAX_MASK 0xf0
43 #define WMM_AC_ECWMAX_SHIFT 4
44
45 struct wmm_ac_parameter {
46         u8 aci_aifsn; /* AIFSN, ACM, ACI */
47         u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
48         le16 txop_limit;
49 } __attribute__ ((packed));
50
51 /*
52  * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
53  * Response frmaes)
54  */
55 struct wmm_parameter_element {
56         /* Element ID: 221 (0xdd); Length: 24 */
57         /* required fields for WMM version 1 */
58         u8 oui[3]; /* 00:50:f2 */
59         u8 oui_type; /* 2 */
60         u8 oui_subtype; /* 1 */
61         u8 version; /* 1 for WMM version 1.0 */
62         u8 qos_info; /* AP/STA specif QoS info */
63         u8 reserved; /* 0 */
64         struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
65
66 } __attribute__ ((packed));
67
68 /* WMM TSPEC Element */
69 struct wmm_tspec_element {
70         u8 eid; /* 221 = 0xdd */
71         u8 length; /* 6 + 55 = 61 */
72         u8 oui[3]; /* 00:50:f2 */
73         u8 oui_type; /* 2 */
74         u8 oui_subtype; /* 2 */
75         u8 version; /* 1 */
76         /* WMM TSPEC body (55 octets): */
77         u8 ts_info[3];
78         le16 nominal_msdu_size;
79         le16 maximum_msdu_size;
80         le32 minimum_service_interval;
81         le32 maximum_service_interval;
82         le32 inactivity_interval;
83         le32 suspension_interval;
84         le32 service_start_time;
85         le32 minimum_data_rate;
86         le32 mean_data_rate;
87         le32 peak_data_rate;
88         le32 maximum_burst_size;
89         le32 delay_bound;
90         le32 minimum_phy_rate;
91         le16 surplus_bandwidth_allowance;
92         le16 medium_time;
93 } __attribute__ ((packed));
94
95
96 /* Access Categories / ACI to AC coding */
97 enum {
98         WMM_AC_BE = 0 /* Best Effort */,
99         WMM_AC_BK = 1 /* Background */,
100         WMM_AC_VI = 2 /* Video */,
101         WMM_AC_VO = 3 /* Voice */
102 };
103
104 struct ieee80211_mgmt;
105
106 u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
107 int hostapd_eid_wmm_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
108 int hostapd_wmm_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
109 void hostapd_wmm_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
110                         size_t len);
111
112 #endif /* WME_H */