2 * hostapd / WMM (Wi-Fi Multimedia)
3 * Copyright 2002-2003, Instant802 Networks, Inc.
4 * Copyright 2005-2006, Devicescape Software, Inc.
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.
10 * Alternatively, this software may be distributed under the terms of BSD
13 * See README and COPYING for more details.
21 #endif /* __linux__ */
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__) */
31 * WMM Information Element (used in (Re)Association Request frames; may also be
32 * used in Beacon frames)
34 struct wmm_information_element {
35 /* Element ID: 221 (0xdd); Length: 7 */
36 /* required fields for WMM version 1 */
37 u8 oui[3]; /* 00:50:f2 */
39 u8 oui_subtype; /* 0 */
40 u8 version; /* 1 for WMM version 1.0 */
41 u8 qos_info; /* AP/STA specific QoS info */
43 } __attribute__ ((packed));
45 #define WMM_AC_AIFSN_MASK 0x0f
46 #define WMM_AC_AIFNS_SHIFT 0
47 #define WMM_AC_ACM 0x10
48 #define WMM_AC_ACI_MASK 0x60
49 #define WMM_AC_ACI_SHIFT 5
51 #define WMM_AC_ECWMIN_MASK 0x0f
52 #define WMM_AC_ECWMIN_SHIFT 0
53 #define WMM_AC_ECWMAX_MASK 0xf0
54 #define WMM_AC_ECWMAX_SHIFT 4
56 struct wmm_ac_parameter {
57 u8 aci_aifsn; /* AIFSN, ACM, ACI */
58 u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
60 } __attribute__ ((packed));
63 * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
66 struct wmm_parameter_element {
67 /* Element ID: 221 (0xdd); Length: 24 */
68 /* required fields for WMM version 1 */
69 u8 oui[3]; /* 00:50:f2 */
71 u8 oui_subtype; /* 1 */
72 u8 version; /* 1 for WMM version 1.0 */
73 u8 qos_info; /* AP/STA specif QoS info */
75 struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
77 } __attribute__ ((packed));
79 /* WMM TSPEC Element */
80 struct wmm_tspec_element {
81 u8 eid; /* 221 = 0xdd */
82 u8 length; /* 6 + 55 = 61 */
83 u8 oui[3]; /* 00:50:f2 */
85 u8 oui_subtype; /* 2 */
87 /* WMM TSPEC body (55 octets): */
89 le16 nominal_msdu_size;
90 le16 maximum_msdu_size;
91 le32 minimum_service_interval;
92 le32 maximum_service_interval;
93 le32 inactivity_interval;
94 le32 suspension_interval;
95 le32 service_start_time;
96 le32 minimum_data_rate;
99 le32 maximum_burst_size;
101 le32 minimum_phy_rate;
102 le16 surplus_bandwidth_allowance;
104 } __attribute__ ((packed));
107 /* Access Categories / ACI to AC coding */
109 WMM_AC_BE = 0 /* Best Effort */,
110 WMM_AC_BK = 1 /* Background */,
111 WMM_AC_VI = 2 /* Video */,
112 WMM_AC_VO = 3 /* Voice */
115 struct ieee80211_mgmt;
117 u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
118 int hostapd_eid_wmm_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
120 int hostapd_wmm_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
121 #else /* NEED_MLME */
122 static inline int hostapd_wmm_sta_config(struct hostapd_data *hapd,
123 struct sta_info *sta)
127 #endif /* NEED_MLME */
128 void hostapd_wmm_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,