]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - contrib/wpa/hostapd/wme.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / contrib / wpa / 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 #ifdef __linux__
20 #include <endian.h>
21 #endif /* __linux__ */
22
23 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
24 #include <sys/types.h>
25 #include <sys/endian.h>
26 #endif /* defined(__FreeBSD__) || defined(__NetBSD__) ||
27         * defined(__DragonFly__) */
28
29
30 static inline u16 tsinfo(int tag1d, int contention_based, int direction)
31 {
32         return (tag1d << 11) | (contention_based << 7) | (direction << 5) |
33           (tag1d << 1);
34 }
35
36
37 struct wme_information_element {
38         /* required fields for WME version 1 */
39         u8 oui[3];
40         u8 oui_type;
41         u8 oui_subtype;
42         u8 version;
43         u8 acInfo;
44
45 } __attribute__ ((packed));
46
47 struct wme_ac_parameter {
48 #if __BYTE_ORDER == __LITTLE_ENDIAN
49         /* byte 1 */
50         u8      aifsn:4,
51                 acm:1,
52                 aci:2,
53                 reserved:1;
54
55         /* byte 2 */
56         u8      eCWmin:4,
57                 eCWmax:4;
58 #elif __BYTE_ORDER == __BIG_ENDIAN
59         /* byte 1 */
60         u8      reserved:1,
61                 aci:2,
62                 acm:1,
63                 aifsn:4;
64
65         /* byte 2 */
66         u8      eCWmax:4,
67                 eCWmin:4;
68 #else
69 #error  "Please fix <endian.h>"
70 #endif
71
72         /* bytes 3 & 4 */
73         le16 txopLimit;
74 } __attribute__ ((packed));
75
76 struct wme_parameter_element {
77         /* required fields for WME version 1 */
78         u8 oui[3];
79         u8 oui_type;
80         u8 oui_subtype;
81         u8 version;
82         u8 acInfo;
83         u8 reserved;
84         struct wme_ac_parameter ac[4];
85
86 } __attribute__ ((packed));
87
88 struct wme_tspec_info_element {
89         u8 eid;
90         u8 length;
91         u8 oui[3];
92         u8 oui_type;
93         u8 oui_subtype;
94         u8 version;
95         u16 ts_info;
96         u16 nominal_msdu_size;
97         u16 maximum_msdu_size;
98         u32 minimum_service_interval;
99         u32 maximum_service_interval;
100         u32 inactivity_interval;
101         u32 start_time;
102         u32 minimum_data_rate;
103         u32 mean_data_rate;
104         u32 maximum_burst_size;
105         u32 minimum_phy_rate;
106         u32 peak_data_rate;
107         u32 delay_bound;
108         u16 surplus_bandwidth_allowance;
109         u16 medium_time;
110 } __attribute__ ((packed));
111
112
113 /* Access Categories */
114 enum {
115         WME_AC_BK = 1,
116         WME_AC_BE = 0,
117         WME_AC_VI = 2,
118         WME_AC_VO = 3
119 };
120
121 struct ieee80211_mgmt;
122
123 u8 * hostapd_eid_wme(struct hostapd_data *hapd, u8 *eid);
124 int hostapd_eid_wme_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
125 int hostapd_wme_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
126 void hostapd_wme_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
127                         size_t len);
128
129 #endif /* WME_H */