2 * Routines for Wireless LAN (IEEE 802.11) dissection
4 * Copyright 2000, Axis Communications AB
5 * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * Copied from README.developer
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include "ws_symbol_export.h"
20 #endif /* __cplusplus */
23 gboolean association_has_mobility_domain_element;
24 gboolean has_ft_akm_suite;
25 gboolean has_non_ft_akm_suite;
26 proto_node *rsn_first_ft_akm_suite;
27 proto_node *rsn_first_non_ft_akm_suite;
28 } association_sanity_check_t;
30 typedef struct ieee80211_tagged_field_data
33 association_sanity_check_t* sanity_check;
36 proto_item* item_tag_length;
37 } ieee80211_tagged_field_data_t;
40 int add_tagged_field(packet_info *pinfo, proto_tree *tree,
41 tvbuff_t *tvb, int offset, int ftype,
42 const guint8 *valid_element_ids,
43 guint valid_element_ids_count,
44 association_sanity_check_t *association_sanity_check);
46 int dissect_wifi_dpp_config_proto(packet_info *pinfo, proto_tree *query,
47 tvbuff_t *tvb, int offset);
48 #define MAX_SSID_LEN 32
49 #define MAX_PROTECT_LEN 10
52 * Table of data rates, indexed by MCS index, bandwidth (0 for 20, 1 for 40),
53 * amd guard interval (0 for long, 1 for short).
55 #define MAX_MCS_INDEX 76
57 WS_DLL_PUBLIC const guint16 ieee80211_ht_Dbps[MAX_MCS_INDEX+1];
58 float ieee80211_htrate(int mcs_index, gboolean bandwidth, gboolean short_gi);
60 WS_DLL_PUBLIC value_string_ext ieee80211_supported_rates_vals_ext;
63 gboolean is_broadcast_bssid(const address *bssid);
67 #endif /* __cplusplus */
70 * Extract the protocol version from the frame control field
72 #define FCF_PROT_VERSION(x) ((x) & 0x3)
75 * Extract the frame type from the frame control field.
77 #define FCF_FRAME_TYPE(x) (((x) & 0xC) >> 2)
80 * Extract the frame subtype from the frame control field.
82 #define FCF_FRAME_SUBTYPE(x) (((x) & 0xF0) >> 4)
85 * Extract the control frame extension from the frame control field.
87 #define FCF_FRAME_EXTENSION(x) (((x) & 0xF00) >> 8)
90 * Checks if the frame is control frame extension.
92 #define IS_FRAME_EXTENSION(x) ((FCF_FRAME_TYPE(x) == 0x1 && FCF_FRAME_SUBTYPE(x) == 0x6) ? 1 : 0)
95 * Convert the frame type and subtype from the frame control field into
96 * one of the MGT_, CTRL_, or DATA_ values.
97 * Now includes extension subtype in case present.
99 #define COMPOSE_FRAME_TYPE(x) ((FCF_FRAME_TYPE(x) == 0x1 && FCF_FRAME_SUBTYPE(x) == 0x6) ? (((x & 0x0C)<< 6) + ((x) & 0xF0) + FCF_FRAME_EXTENSION(x)) : (((x & 0x0C)<< 2)+FCF_FRAME_SUBTYPE(x))) /* Create key to (sub)type */
102 * The subtype field of a data frame is, in effect, composed of 4 flag
103 * bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
104 * any data), and QoS.
106 #define DATA_FRAME_IS_CF_ACK(x) ((x) & 0x01)
107 #define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
108 #define DATA_FRAME_IS_NULL(x) ((x) & 0x04)
109 #define DATA_FRAME_IS_QOS(x) ((x) & 0x08)
112 * Extract the flags from the frame control field.
113 * Now includes subset of flags when the subtype is control frame extension.
115 #define FCF_FLAGS(x) ((FCF_FRAME_TYPE(x) == 0x1 && FCF_FRAME_SUBTYPE(x) == 0x6) ? (((x) & 0xF000) >> 12) : (((x) & 0xFF00) >> 8))
118 * Bits from the flags field.
120 #define FLAG_TO_DS 0x01
121 #define FLAG_FROM_DS 0x02
122 #define FLAG_MORE_FRAGMENTS 0x04
123 #define FLAG_RETRY 0x08
124 #define FLAG_POWER_MGT 0x10
125 #define FLAG_MORE_DATA 0x20
126 #define FLAG_PROTECTED 0x40
127 #define FLAG_ORDER 0x80 /* overloaded for "has HT control" */
130 * Test bits in the flags field.
133 * XXX - Only HAVE_FRAGMENTS, IS_PROTECTED, and HAS_HT_CONTROL
134 * are in use. Should the rest be removed?
136 #define IS_TO_DS(x) ((x) & FLAG_TO_DS)
137 #define IS_FROM_DS(x) ((x) & FLAG_FROM_DS)
138 #define HAVE_FRAGMENTS(x) ((x) & FLAG_MORE_FRAGMENTS)
139 #define IS_RETRY(x) ((x) & FLAG_RETRY)
140 #define POWER_MGT_STATUS(x) ((x) & FLAG_POWER_MGT)
141 #define HAS_MORE_DATA(x) ((x) & FLAG_MORE_DATA)
142 #define IS_PROTECTED(x) ((x) & FLAG_PROTECTED)
143 #define IS_STRICTLY_ORDERED(x) ((x) & FLAG_ORDER) /* for non-QoS data frames */
144 #define HAS_HT_CONTROL(x) ((x) & FLAG_ORDER) /* for management and QoS data frames */
147 * Extract subfields from the flags field.
149 #define FLAGS_DS_STATUS(x) ((x) & (FLAG_FROM_DS|FLAG_TO_DS))
152 * Extract an indication of the types of addresses in a data frame from
153 * the frame control field.
155 #define FCF_ADDR_SELECTOR(x) ((x) & ((FLAG_TO_DS|FLAG_FROM_DS) << 8))
157 #define DATA_ADDR_T1 0
158 #define DATA_ADDR_T2 (FLAG_FROM_DS << 8)
159 #define DATA_ADDR_T3 (FLAG_TO_DS << 8)
160 #define DATA_ADDR_T4 ((FLAG_TO_DS|FLAG_FROM_DS) << 8)
163 * COMPOSE_FRAME_TYPE() values for management frames.
165 #define MGT_ASSOC_REQ 0x00 /* association request */
166 #define MGT_ASSOC_RESP 0x01 /* association response */
167 #define MGT_REASSOC_REQ 0x02 /* reassociation request */
168 #define MGT_REASSOC_RESP 0x03 /* reassociation response */
169 #define MGT_PROBE_REQ 0x04 /* Probe request */
170 #define MGT_PROBE_RESP 0x05 /* Probe response */
171 #define MGT_MEASUREMENT_PILOT 0x06 /* Measurement Pilot */
172 #define MGT_BEACON 0x08 /* Beacon frame */
173 #define MGT_ATIM 0x09 /* ATIM */
174 #define MGT_DISASS 0x0A /* Disassociation */
175 #define MGT_AUTHENTICATION 0x0B /* Authentication */
176 #define MGT_DEAUTHENTICATION 0x0C /* Deauthentication */
177 #define MGT_ACTION 0x0D /* Action */
178 #define MGT_ACTION_NO_ACK 0x0E /* Action No Ack */
179 #define MGT_ARUBA_WLAN 0x0F /* Aruba WLAN Specific */
182 * COMPOSE_FRAME_TYPE() values for control frames.
183 * 0x160 - 0x16A are for control frame extension where type = 1 and subtype =6.
185 #define CTRL_TRIGGER 0x12 /* HE Trigger */
186 #define CTRL_BEAMFORM_RPT_POLL 0x14 /* Beamforming Report */
187 #define CTRL_VHT_NDP_ANNC 0x15 /* VHT NDP Announcement */
188 #define CTRL_POLL 0x162 /* Poll */
189 #define CTRL_SPR 0x163 /* Service Period Request */
190 #define CTRL_GRANT 0x164 /* Grant */
191 #define CTRL_DMG_CTS 0x165 /* DMG Clear to Send */
192 #define CTRL_DMG_DTS 0x166 /* DMG Denial to Send */
193 #define CTRL_GRANT_ACK 0x167 /* Grant Acknowledgment */
194 #define CTRL_SSW 0x168 /* Sector Sweep */
195 #define CTRL_SSW_FEEDBACK 0x169 /* Sector Sweep Feedback */
196 #define CTRL_SSW_ACK 0x16A /* Sector Sweep Acknowledgment */
197 #define CTRL_CONTROL_WRAPPER 0x17 /* Control Wrapper */
198 #define CTRL_BLOCK_ACK_REQ 0x18 /* Block ack Request */
199 #define CTRL_BLOCK_ACK 0x19 /* Block ack */
200 #define CTRL_PS_POLL 0x1A /* power-save poll */
201 #define CTRL_RTS 0x1B /* request to send */
202 #define CTRL_CTS 0x1C /* clear to send */
203 #define CTRL_ACKNOWLEDGEMENT 0x1D /* acknowledgement */
204 #define CTRL_CFP_END 0x1E /* contention-free period end */
205 #define CTRL_CFP_ENDACK 0x1F /* contention-free period end/ack */
208 * COMPOSE_FRAME_TYPE() values for data frames.
210 #define DATA 0x20 /* Data */
211 #define DATA_CF_ACK 0x21 /* Data + CF-Ack */
212 #define DATA_CF_POLL 0x22 /* Data + CF-Poll */
213 #define DATA_CF_ACK_POLL 0x23 /* Data + CF-Ack + CF-Poll */
214 #define DATA_NULL_FUNCTION 0x24 /* Null function (no data) */
215 #define DATA_CF_ACK_NOD 0x25 /* CF-Ack (no data) */
216 #define DATA_CF_POLL_NOD 0x26 /* CF-Poll (No data) */
217 #define DATA_CF_ACK_POLL_NOD 0x27 /* CF-Ack + CF-Poll (no data) */
219 #define DATA_QOS_DATA 0x28 /* QoS Data */
220 #define DATA_QOS_DATA_CF_ACK 0x29 /* QoS Data + CF-Ack */
221 #define DATA_QOS_DATA_CF_POLL 0x2A /* QoS Data + CF-Poll */
222 #define DATA_QOS_DATA_CF_ACK_POLL 0x2B /* QoS Data + CF-Ack + CF-Poll */
223 #define DATA_QOS_NULL 0x2C /* QoS Null */
224 #define DATA_QOS_CF_POLL_NOD 0x2E /* QoS CF-Poll (No Data) */
225 #define DATA_QOS_CF_ACK_POLL_NOD 0x2F /* QoS CF-Ack + CF-Poll (No Data) */
228 * COMPOSE_FRAME_TYPE() values for extension frames.
230 #define EXTENSION_DMG_BEACON 0x30 /* Extension DMG beacon */
232 typedef struct _wlan_stats {
235 guchar ssid[MAX_SSID_LEN];
236 gchar protection[MAX_PROTECT_LEN];
240 typedef struct _wlan_hdr {
245 struct _wlan_stats stats;
248 #define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
249 #define WLANCAP_MAGIC_COOKIE_V1 0x80211001
250 #define WLANCAP_MAGIC_COOKIE_V2 0x80211002
252 /* UAT entry structure. */
256 } uat_wep_key_record_t;
258 #define ADV_PROTO_ID_ANQP 0
259 #define ANV_PROTO_ID_MIH_IS 1
260 #define ADV_PROTO_ID_MIH_CESCD 2
261 #define ADV_PROTO_ID_EAS 3
262 #define ADV_PROTO_ID_VS 221
264 typedef struct anqp_info_dissector_data {
267 } anqp_info_dissector_data_t;
269 /* WFA vendor specific subtypes */
270 #define WFA_SUBTYPE_SUBSCRIPTION_REMEDIATION 0
271 #define WFA_SUBTYPE_DEAUTHENTICATION_IMMINENT 1
272 #define WFA_SUBTYPE_P2P 9
273 #define WFA_SUBTYPE_WIFI_DISPLAY 10
274 #define WFA_SUBTYPE_HS20_INDICATION 16
275 #define WFA_SUBTYPE_HS20_ANQP 17
276 #define WFA_SUBTYPE_OSEN 18
277 #define WFA_SUBTYPE_DPP 26
278 #define WFA_SUBTYPE_IEEE1905_MULTI_AP 27 /* ox1B */
286 * indent-tabs-mode: nil
289 * ex: set shiftwidth=2 tabstop=8 expandtab:
290 * :indentSize=2:tabSize=8:noTabs=true: