30 #include <tins/config.h>
32 #if !defined(TINS_DOT11_DOT11_H) && defined(TINS_HAVE_DOT11)
33 #define TINS_DOT11_DOT11_H
36 #include <tins/pdu_option.h>
37 #include <tins/small_uint.h>
38 #include <tins/hw_address.h>
39 #include <tins/endianness.h>
40 #include <tins/cxxstd.h>
41 #include <tins/macros.h>
45 class InputMemoryStream;
46 class OutputMemoryStream;
108 HOPPING_PATTERN_PARAMS,
109 HOPPING_PATTERN_TABLE,
117 POWER_CONSTRAINT = 32,
133 EXT_SUPPORTED_RATES = 50,
138 FAST_BSS_TRANSITION_FTE,
142 SUPPORTED_OP_CLASSES,
143 EXT_CH_SWITCH_ANNOUNCEMENT,
146 BSS_AVG_ACCESS_DELAY,
149 MEASUREMENT_PILOT_TRANSMISSION,
150 BSS_AVAIL_ADMISSION_CAPACITY,
156 BSS_2040_INTOLERANT_CH_REPORT,
157 OVERLAPPING_BSS_SCAN_PARAM,
165 NONTRANSMITTED_BSSID_CAP,
167 MULTIPLE_BSSID_INDEX,
178 COLLOCATED_INTERFERENCE_REPORT,
189 ADVERTISEMENT_PROTOCOL,
190 EXPEDITED_BANDWIDTH_REQ,
196 MESH_LINK_METRIC_REPORT,
197 CONGESTION_NOTIFICATION,
199 MESH_CH_SWITCH_PARAMS,
204 MCCAOP_ADVERTISEMENT,
227 CH_MEASUREMENT_FEEDBACK,
236 DYNAMIC_TONE_PAIRING_REPORT,
239 RELAY_TRANSFER_PARAM_SET,
240 BEAMLINK_MAINTENANCE,
241 MULTIPLE_MAC_SUBLAYERS,
243 DMG_LINK_ADAPTATION_ACK,
244 MCCAOP_ADV_OVERVIEW = 174,
246 QUIET_PERIOD_RESP = 177,
250 INTRA_ACCESS_CAT_PRIORITY,
253 HCCA_TXOP_UPDATE_COUNT,
254 HIGHER_LAYER_STREAM_ID,
256 ANTENNA_SECTOR_ID_PATTERN,
260 WIDE_BANDWIDTH_CH_SWITCH,
261 TRANSMIT_POWER_ENVELOPE,
267 REDUCED_NEIGHBOR_REPORT,
271 FINE_TUNING_MEASUREMENT_PARAMS,
272 VENDOR_SPECIFIC = 221
316 DATA_CF_ACK_POLL = 3,
323 QOS_DATA_CF_POLL = 10,
324 QOS_DATA_CF_ACK_POLL = 11,
333 Dot11(
const address_type& dst_hw_addr = address_type());
347 Dot11(
const uint8_t* buffer, uint32_t total_sz);
355 return header_.control.protocol;
364 return header_.control.type;
373 return header_.control.subtype;
382 return header_.control.to_ds;
391 return header_.control.from_ds;
400 return header_.control.more_frag;
409 return header_.control.retry;
418 return header_.control.power_mgmt;
427 return header_.control.more_data;
436 return header_.control.wep;
445 return header_.control.order;
454 return Endian::le_to_host(header_.duration_id);
463 return header_.addr1;
550 void duration_id(uint16_t new_duration_id);
557 void addr1(
const address_type& new_addr1);
566 uint32_t header_size()
const;
579 void add_option(
const option& opt);
590 internal_add_option(opt);
591 options_.push_back(std::move(opt));
604 bool remove_option(OptionTypes type);
614 const option* search_option(OptionTypes type)
const;
628 return new Dot11(*
this);
637 return flag == pdu_flag;
663 static Dot11* from_bytes(
const uint8_t* buffer, uint32_t total_sz);
665 virtual void write_ext_header(Memory::OutputMemoryStream& stream);
666 virtual void write_fixed_parameters(Memory::OutputMemoryStream& stream);
667 void parse_tagged_parameters(Memory::InputMemoryStream& stream);
668 void add_tagged_option(OptionTypes opt, uint8_t len,
const uint8_t* val);
677 #if TINS_IS_LITTLE_ENDIAN
689 #elif TINS_IS_BIG_ENDIAN
702 } TINS_END_PACK control;
703 uint16_t duration_id;
704 uint8_t addr1[address_type::address_size];
710 void internal_add_option(
const option& opt);
711 void write_serialization(uint8_t* buffer, uint32_t total_sz);
712 options_type::const_iterator search_option_iterator(
OptionTypes type)
const;
713 options_type::iterator search_option_iterator(
OptionTypes type);
717 uint32_t options_size_;
Class representing an 802.11 frame.
Definition: dot11_base.h:54
small_uint< 1 > wep() const
Getter for the WEP field.
Definition: dot11_base.h:435
static const address_type BROADCAST
Broadcast hardware address.
Definition: dot11_base.h:79
PDUType pdu_type() const
Getter for the PDU's type.
Definition: dot11_base.h:620
bool matches_flag(PDUType flag) const
Check whether this PDU matches the specified flag.
Definition: dot11_base.h:636
ManagementSubtypes
Enum for the different subtypes of 802.11 management frames.
Definition: dot11_base.h:279
small_uint< 2 > protocol() const
Getter for the protocol version field.
Definition: dot11_base.h:354
OptionTypes
Enum for the different types of tagged options.
Definition: dot11_base.h:99
small_uint< 1 > more_data() const
Getter for the More Data field.
Definition: dot11_base.h:426
small_uint< 4 > subtype() const
Getter for the Subtype field.
Definition: dot11_base.h:372
small_uint< 1 > power_mgmt() const
Getter for the Power-Management field.
Definition: dot11_base.h:417
std::vector< option > options_type
Definition: dot11_base.h:69
small_uint< 1 > from_ds() const
Getter for the From-DS field.
Definition: dot11_base.h:390
const options_type & options() const
Getter for the option list.
Definition: dot11_base.h:645
Types
Enum for the different types of 802.11 frames.
Definition: dot11_base.h:90
DataSubtypes
Enum fro the different subtypes of 802.11 data frames.
Definition: dot11_base.h:312
HWAddress< 6 > address_type
Definition: dot11_base.h:59
small_uint< 1 > to_ds() const
Getter for the To-DS field.
Definition: dot11_base.h:381
uint16_t duration_id() const
Getter for the Duration-ID field.
Definition: dot11_base.h:453
PDUOption< uint8_t, Dot11 > option
IEEE 802.11 options struct.
Definition: dot11_base.h:64
address_type addr1() const
Getter for the first address.
Definition: dot11_base.h:462
small_uint< 1 > more_frag() const
Getter for the More-Frag field.
Definition: dot11_base.h:399
ControlSubtypes
Enum for the different subtypes of 802.11 control frames.
Definition: dot11_base.h:297
small_uint< 2 > type() const
Getter for the Type field.
Definition: dot11_base.h:363
small_uint< 1 > order() const
Getter for the Order field.
Definition: dot11_base.h:444
Dot11 * clone() const
Definition: dot11_base.h:627
void add_option(option &&opt)
Adds a new option to this Dot11 PDU.
Definition: dot11_base.h:589
small_uint< 1 > retry() const
Getter for the Retry field.
Definition: dot11_base.h:408
Abstraction of a network interface.
Definition: network_interface.h:47
Represents a PDU option field.
Definition: pdu_option.h:201
Base class for protocol data units.
Definition: pdu.h:107
endian_type
Definition: pdu.h:117
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
Sends packets through a network interface.
Definition: packet_sender.h:118
The Tins namespace.
Definition: address_range.h:38