2008-10-29 15:48:14 -04:00
|
|
|
/*
|
|
|
|
* IEEE 802.11 Common routines
|
2012-12-16 14:22:24 -05:00
|
|
|
* Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
|
2008-10-29 15:48:14 -04:00
|
|
|
*
|
2012-02-11 09:46:35 -05:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-10-29 15:48:14 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef IEEE802_11_COMMON_H
|
|
|
|
#define IEEE802_11_COMMON_H
|
|
|
|
|
2016-02-15 09:53:32 -05:00
|
|
|
#include "defs.h"
|
|
|
|
|
2015-01-21 08:30:48 -05:00
|
|
|
#define MAX_NOF_MB_IES_SUPPORTED 5
|
|
|
|
|
|
|
|
struct mb_ies_info {
|
|
|
|
struct {
|
|
|
|
const u8 *ie;
|
|
|
|
u8 ie_len;
|
|
|
|
} ies[MAX_NOF_MB_IES_SUPPORTED];
|
|
|
|
u8 nof_ies;
|
|
|
|
};
|
|
|
|
|
2008-10-29 15:48:14 -04:00
|
|
|
/* Parsed Information Elements */
|
|
|
|
struct ieee802_11_elems {
|
2009-12-13 16:11:11 -05:00
|
|
|
const u8 *ssid;
|
|
|
|
const u8 *supp_rates;
|
|
|
|
const u8 *ds_params;
|
|
|
|
const u8 *challenge;
|
|
|
|
const u8 *erp_info;
|
|
|
|
const u8 *ext_supp_rates;
|
|
|
|
const u8 *wpa_ie;
|
|
|
|
const u8 *rsn_ie;
|
|
|
|
const u8 *wmm; /* WMM Information or Parameter Element */
|
|
|
|
const u8 *wmm_tspec;
|
|
|
|
const u8 *wps_ie;
|
|
|
|
const u8 *supp_channels;
|
|
|
|
const u8 *mdie;
|
|
|
|
const u8 *ftie;
|
|
|
|
const u8 *timeout_int;
|
|
|
|
const u8 *ht_capabilities;
|
|
|
|
const u8 *ht_operation;
|
2014-09-01 00:23:25 -04:00
|
|
|
const u8 *mesh_config;
|
|
|
|
const u8 *mesh_id;
|
|
|
|
const u8 *peer_mgmt;
|
2012-08-10 12:39:43 -04:00
|
|
|
const u8 *vht_capabilities;
|
|
|
|
const u8 *vht_operation;
|
2014-02-10 07:43:05 -05:00
|
|
|
const u8 *vht_opmode_notif;
|
2009-12-13 16:11:11 -05:00
|
|
|
const u8 *vendor_ht_cap;
|
2014-11-10 10:12:29 -05:00
|
|
|
const u8 *vendor_vht;
|
2010-07-18 17:30:24 -04:00
|
|
|
const u8 *p2p;
|
2012-03-02 10:26:01 -05:00
|
|
|
const u8 *wfd;
|
2010-12-13 04:20:55 -05:00
|
|
|
const u8 *link_id;
|
2011-10-21 05:43:24 -04:00
|
|
|
const u8 *interworking;
|
2013-07-24 06:17:56 -04:00
|
|
|
const u8 *qos_map_set;
|
2011-10-03 11:23:01 -04:00
|
|
|
const u8 *hs20;
|
2012-05-27 20:35:00 -04:00
|
|
|
const u8 *ext_capab;
|
|
|
|
const u8 *bss_max_idle_period;
|
2012-12-16 14:22:24 -05:00
|
|
|
const u8 *ssid_list;
|
2013-07-23 14:23:25 -04:00
|
|
|
const u8 *osen;
|
2014-09-01 00:23:25 -04:00
|
|
|
const u8 *ampe;
|
|
|
|
const u8 *mic;
|
2015-07-23 20:39:45 -04:00
|
|
|
const u8 *pref_freq_list;
|
2009-12-13 16:11:11 -05:00
|
|
|
|
2008-10-29 15:48:14 -04:00
|
|
|
u8 ssid_len;
|
|
|
|
u8 supp_rates_len;
|
|
|
|
u8 challenge_len;
|
|
|
|
u8 ext_supp_rates_len;
|
|
|
|
u8 wpa_ie_len;
|
|
|
|
u8 rsn_ie_len;
|
2009-03-04 05:33:24 -05:00
|
|
|
u8 wmm_len; /* 7 = WMM Information; 24 = WMM Parameter */
|
|
|
|
u8 wmm_tspec_len;
|
2008-11-23 12:34:26 -05:00
|
|
|
u8 wps_ie_len;
|
2008-10-29 15:48:14 -04:00
|
|
|
u8 supp_channels_len;
|
|
|
|
u8 mdie_len;
|
|
|
|
u8 ftie_len;
|
2014-09-01 00:23:25 -04:00
|
|
|
u8 mesh_config_len;
|
|
|
|
u8 mesh_id_len;
|
|
|
|
u8 peer_mgmt_len;
|
2008-12-04 06:42:33 -05:00
|
|
|
u8 vendor_ht_cap_len;
|
2014-11-10 10:12:29 -05:00
|
|
|
u8 vendor_vht_len;
|
2010-07-18 17:30:24 -04:00
|
|
|
u8 p2p_len;
|
2012-03-02 10:26:01 -05:00
|
|
|
u8 wfd_len;
|
2011-10-21 05:43:24 -04:00
|
|
|
u8 interworking_len;
|
2013-07-24 06:17:56 -04:00
|
|
|
u8 qos_map_set_len;
|
2011-10-03 11:23:01 -04:00
|
|
|
u8 hs20_len;
|
2012-05-27 20:35:00 -04:00
|
|
|
u8 ext_capab_len;
|
2012-12-16 14:22:24 -05:00
|
|
|
u8 ssid_list_len;
|
2013-07-23 14:23:25 -04:00
|
|
|
u8 osen_len;
|
2014-09-01 00:23:25 -04:00
|
|
|
u8 ampe_len;
|
|
|
|
u8 mic_len;
|
2015-07-23 20:39:45 -04:00
|
|
|
u8 pref_freq_list_len;
|
2015-01-21 08:30:48 -05:00
|
|
|
struct mb_ies_info mb_ies;
|
2008-10-29 15:48:14 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
|
|
|
|
|
2009-12-13 16:11:11 -05:00
|
|
|
ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
|
2008-10-29 15:48:14 -04:00
|
|
|
struct ieee802_11_elems *elems,
|
|
|
|
int show_errors);
|
2009-03-09 14:45:17 -04:00
|
|
|
int ieee802_11_ie_count(const u8 *ies, size_t ies_len);
|
2009-09-11 09:36:59 -04:00
|
|
|
struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
|
|
|
|
u32 oui_type);
|
2011-10-20 14:50:23 -04:00
|
|
|
struct ieee80211_hdr;
|
|
|
|
const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len);
|
2008-10-29 15:48:14 -04:00
|
|
|
|
2012-08-12 04:33:00 -04:00
|
|
|
struct hostapd_wmm_ac_params {
|
|
|
|
int cwmin;
|
|
|
|
int cwmax;
|
|
|
|
int aifs;
|
|
|
|
int txop_limit; /* in units of 32us */
|
|
|
|
int admission_control_mandatory;
|
|
|
|
};
|
|
|
|
|
|
|
|
int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
|
|
|
|
const char *name, const char *val);
|
2013-04-27 14:27:15 -04:00
|
|
|
enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel);
|
2014-11-22 12:48:08 -05:00
|
|
|
int ieee80211_chan_to_freq(const char *country, u8 op_class, u8 chan);
|
2015-07-27 15:24:18 -04:00
|
|
|
enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
|
|
|
|
int sec_channel, int vht,
|
|
|
|
u8 *op_class, u8 *channel);
|
2015-03-04 20:24:36 -05:00
|
|
|
int ieee80211_is_dfs(int freq);
|
2016-02-15 09:53:40 -05:00
|
|
|
enum phy_type ieee80211_get_phy_type(int freq, int ht, int vht);
|
2012-08-12 04:33:00 -04:00
|
|
|
|
2013-06-19 12:16:23 -04:00
|
|
|
int supp_rates_11b_only(struct ieee802_11_elems *elems);
|
2015-01-21 08:30:48 -05:00
|
|
|
int mb_ies_info_by_ies(struct mb_ies_info *info, const u8 *ies_buf,
|
|
|
|
size_t ies_len);
|
|
|
|
struct wpabuf * mb_ies_by_info(struct mb_ies_info *info);
|
2013-06-19 12:16:23 -04:00
|
|
|
|
2014-06-03 04:24:53 -04:00
|
|
|
const char * fc2str(u16 fc);
|
2016-02-15 09:53:17 -05:00
|
|
|
|
2016-02-15 09:53:32 -05:00
|
|
|
struct oper_class_map {
|
|
|
|
enum hostapd_hw_mode mode;
|
|
|
|
u8 op_class;
|
|
|
|
u8 min_chan;
|
|
|
|
u8 max_chan;
|
|
|
|
u8 inc;
|
|
|
|
enum { BW20, BW40PLUS, BW40MINUS, BW80, BW2160, BW160, BW80P80 } bw;
|
|
|
|
enum { P2P_SUPP, NO_P2P_SUPP } p2p;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct oper_class_map global_op_class[];
|
|
|
|
extern size_t global_op_class_size;
|
|
|
|
|
2016-02-15 09:53:17 -05:00
|
|
|
const u8 * get_ie(const u8 *ies, size_t len, u8 eid);
|
|
|
|
|
2016-02-15 09:53:24 -05:00
|
|
|
size_t mbo_add_ie(u8 *buf, size_t len, const u8 *attr, size_t attr_len);
|
|
|
|
|
2008-10-29 15:48:14 -04:00
|
|
|
#endif /* IEEE802_11_COMMON_H */
|