2 * IEEE 802.11 Common routines
3 * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #ifndef IEEE802_11_COMMON_H
10 #define IEEE802_11_COMMON_H
14 struct hostapd_hw_modes
;
16 #define MAX_NOF_MB_IES_SUPPORTED 5
22 } ies
[MAX_NOF_MB_IES_SUPPORTED
];
26 /* Parsed Information Elements */
27 struct ieee802_11_elems
{
33 const u8
*ext_supp_rates
;
36 const u8
*wmm
; /* WMM Information or Parameter Element */
39 const u8
*supp_channels
;
42 const u8
*timeout_int
;
43 const u8
*ht_capabilities
;
44 const u8
*ht_operation
;
45 const u8
*mesh_config
;
48 const u8
*vht_capabilities
;
49 const u8
*vht_operation
;
50 const u8
*vht_opmode_notif
;
51 const u8
*vendor_ht_cap
;
56 const u8
*interworking
;
57 const u8
*qos_map_set
;
60 const u8
*bss_max_idle_period
;
66 const u8
*pref_freq_list
;
67 const u8
*supp_op_classes
;
68 const u8
*rrm_enabled
;
73 const u8
*assoc_delay_info
;
74 const u8
*fils_req_params
;
75 const u8
*fils_key_confirm
;
76 const u8
*fils_session
;
78 const u8
*fils_ip_addr_assign
;
79 const u8
*key_delivery
;
80 const u8
*fils_wrapped_data
;
84 const u8
*power_capab
;
85 const u8
*roaming_cons_sel
;
86 const u8
*password_id
;
91 u8 ext_supp_rates_len
;
94 u8 wmm_len
; /* 7 = WMM Information; 24 = WMM Parameter */
103 u8 vendor_ht_cap_len
;
116 u8 pref_freq_list_len
;
117 u8 supp_op_classes_len
;
122 u8 fils_req_params_len
;
123 u8 fils_key_confirm_len
;
125 u8 fils_ip_addr_assign_len
;
127 u8 fils_wrapped_data_len
;
131 u8 roaming_cons_sel_len
;
134 struct mb_ies_info mb_ies
;
137 typedef enum { ParseOK
= 0, ParseUnknown
= 1, ParseFailed
= -1 } ParseRes
;
139 ParseRes
ieee802_11_parse_elems(const u8
*start
, size_t len
,
140 struct ieee802_11_elems
*elems
,
142 int ieee802_11_ie_count(const u8
*ies
, size_t ies_len
);
143 struct wpabuf
* ieee802_11_vendor_ie_concat(const u8
*ies
, size_t ies_len
,
145 struct ieee80211_hdr
;
146 const u8
* get_hdr_bssid(const struct ieee80211_hdr
*hdr
, size_t len
);
148 struct hostapd_wmm_ac_params
{
152 int txop_limit
; /* in units of 32us */
153 int admission_control_mandatory
;
156 int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params
[],
157 const char *name
, const char *val
);
158 enum hostapd_hw_mode
ieee80211_freq_to_chan(int freq
, u8
*channel
);
159 int ieee80211_chan_to_freq(const char *country
, u8 op_class
, u8 chan
);
160 enum hostapd_hw_mode
ieee80211_freq_to_channel_ext(unsigned int freq
,
161 int sec_channel
, int vht
,
162 u8
*op_class
, u8
*channel
);
163 int ieee80211_is_dfs(int freq
, const struct hostapd_hw_modes
*modes
,
165 enum phy_type
ieee80211_get_phy_type(int freq
, int ht
, int vht
);
167 int supp_rates_11b_only(struct ieee802_11_elems
*elems
);
168 int mb_ies_info_by_ies(struct mb_ies_info
*info
, const u8
*ies_buf
,
170 struct wpabuf
* mb_ies_by_info(struct mb_ies_info
*info
);
172 const char * fc2str(u16 fc
);
174 struct oper_class_map
{
175 enum hostapd_hw_mode mode
;
180 enum { BW20
, BW40PLUS
, BW40MINUS
, BW80
, BW2160
, BW160
, BW80P80
} bw
;
181 enum { P2P_SUPP
, NO_P2P_SUPP
} p2p
;
184 extern const struct oper_class_map global_op_class
[];
185 extern size_t global_op_class_size
;
187 const u8
* get_ie(const u8
*ies
, size_t len
, u8 eid
);
188 const u8
* get_ie_ext(const u8
*ies
, size_t len
, u8 ext
);
190 size_t mbo_add_ie(u8
*buf
, size_t len
, const u8
*attr
, size_t attr_len
);
192 struct country_op_class
{
197 u8
country_to_global_op_class(const char *country
, u8 op_class
);
199 const struct oper_class_map
* get_oper_class(const char *country
, u8 op_class
);
201 int ieee802_11_parse_candidate_list(const char *pos
, u8
*nei_rep
,
204 #endif /* IEEE802_11_COMMON_H */