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;
84 static const endian_type endianness = LE;
108 HOPPING_PATTERN_PARAMS,
109 HOPPING_PATTERN_TABLE,
117 POWER_CONSTRAINT = 32,
132 EXT_SUPPORTED_RATES = 50,
133 VENDOR_SPECIFIC = 221
177 DATA_CF_ACK_POLL = 3,
184 QOS_DATA_CF_POLL = 10,
185 QOS_DATA_CF_ACK_POLL = 11,
194 Dot11(
const address_type& dst_hw_addr = address_type());
208 Dot11(
const uint8_t* buffer, uint32_t total_sz);
216 return header_.control.protocol;
225 return header_.control.type;
234 return header_.control.subtype;
243 return header_.control.to_ds;
252 return header_.control.from_ds;
261 return header_.control.more_frag;
270 return header_.control.retry;
279 return header_.control.power_mgmt;
288 return header_.control.more_data;
297 return header_.control.wep;
306 return header_.control.order;
315 return Endian::le_to_host(header_.duration_id);
324 return header_.addr1;
411 void duration_id(uint16_t new_duration_id);
418 void addr1(
const address_type& new_addr1);
427 uint32_t header_size()
const;
440 void add_option(
const option& opt);
451 internal_add_option(opt);
452 options_.push_back(std::move(opt));
475 const option* search_option(
OptionTypes type)
const;
489 return new Dot11(*
this);
498 return flag == pdu_flag;
524 static Dot11* from_bytes(
const uint8_t* buffer, uint32_t total_sz);
526 virtual void write_ext_header(Memory::OutputMemoryStream& stream);
527 virtual void write_fixed_parameters(Memory::OutputMemoryStream& stream);
528 void parse_tagged_parameters(Memory::InputMemoryStream& stream);
529 void add_tagged_option(
OptionTypes opt, uint8_t len,
const uint8_t* val);
538 #if TINS_IS_LITTLE_ENDIAN 550 #elif TINS_IS_BIG_ENDIAN 563 } TINS_END_PACK control;
564 uint16_t duration_id;
565 uint8_t addr1[address_type::address_size];
571 void internal_add_option(
const option& opt);
572 void write_serialization(uint8_t* buffer, uint32_t total_sz);
573 options_type::const_iterator search_option_iterator(
OptionTypes type)
const;
574 options_type::iterator search_option_iterator(
OptionTypes type);
578 uint32_t options_size_;
579 options_type options_;
584 #endif // TINS_DOT11_DOT11_H const options_type & options() const
Getter for the option list.
Definition: dot11_base.h:506
small_uint< 1 > more_data() const
Getter for the More Data field.
Definition: dot11_base.h:287
PDUOption< uint8_t, Dot11 > option
IEEE 802.11 options struct.
Definition: dot11_base.h:64
Class representing an 802.11 frame.
Definition: dot11_base.h:54
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
address_type addr1() const
Getter for the first address.
Definition: dot11_base.h:323
small_uint< 1 > power_mgmt() const
Getter for the Power-Management field.
Definition: dot11_base.h:278
OptionTypes
Enum for the different types of tagged options.
Definition: dot11_base.h:99
small_uint< 1 > more_frag() const
Getter for the More-Frag field.
Definition: dot11_base.h:260
Sends packets through a network interface.
Definition: packet_sender.h:116
Represents a PDU option field.
Definition: pdu_option.h:201
small_uint< 1 > to_ds() const
Getter for the To-DS field.
Definition: dot11_base.h:242
bool matches_flag(PDUType flag) const
Check whether this PDU matches the specified flag.
Definition: dot11_base.h:497
small_uint< 1 > wep() const
Getter for the WEP field.
Definition: dot11_base.h:296
HWAddress< 6 > address_type
Definition: dot11_base.h:59
DataSubtypes
Enum fro the different subtypes of 802.11 data frames.
Definition: dot11_base.h:173
Dot11 * clone() const
Definition: dot11_base.h:488
static const address_type BROADCAST
Broadcast hardware address.
Definition: dot11_base.h:79
The Tins namespace.
Definition: address_range.h:38
small_uint< 2 > type() const
Getter for the Type field.
Definition: dot11_base.h:224
void add_option(option &&opt)
Adds a new option to this Dot11 PDU.
Definition: dot11_base.h:450
small_uint< 1 > order() const
Getter for the Order field.
Definition: dot11_base.h:305
Types
Enum for the different types of 802.11 frames.
Definition: dot11_base.h:90
std::vector< option > options_type
Definition: dot11_base.h:69
small_uint< 1 > retry() const
Getter for the Retry field.
Definition: dot11_base.h:269
Abstraction of a network interface.
Definition: network_interface.h:47
uint16_t duration_id() const
Getter for the Duration-ID field.
Definition: dot11_base.h:314
small_uint< 2 > protocol() const
Getter for the protocol version field.
Definition: dot11_base.h:215
PDUType pdu_type() const
Getter for the PDU's type.
Definition: dot11_base.h:481
ManagementSubtypes
Enum for the different subtypes of 802.11 management frames.
Definition: dot11_base.h:140
Base class for protocol data units.
Definition: pdu.h:107
ControlSubtypes
Enum for the different subtypes of 802.11 control frames.
Definition: dot11_base.h:158
small_uint< 4 > subtype() const
Getter for the Subtype field.
Definition: dot11_base.h:233
small_uint< 1 > from_ds() const
Getter for the From-DS field.
Definition: dot11_base.h:251