30 #include <tins/config.h> 32 #if !defined(TINS_DOT11_DOT11_MGMT_H) && defined(TINS_HAVE_DOT11) 34 #define TINS_DOT11_DOT11_MGMT_H 38 #include <tins/dot11/dot11_base.h> 39 #include <tins/macros.h> 80 PREV_AUTH_NOT_VALID = 2,
81 STA_LEAVING_IBSS_ESS = 3,
84 CLASS2_FROM_NO_AUTH = 6,
85 CLASS3_FROM_NO_AUTH = 7,
87 STA_NOT_AUTH_WITH_STA = 9,
88 POW_CAP_NOT_VALID = 10,
89 SUPPORTED_CHANN_NOT_VALID = 11,
92 HANDSHAKE_TIMEOUT = 15,
93 GROUP_KEY_TIMEOUT = 16,
95 INVALID_GROUP_CIPHER = 18,
96 INVALID_PAIRWISE_CIPHER = 19,
98 UNSOPPORTED_RSN_VERSION = 21,
99 INVALID_RSN_CAPABILITIES = 22,
101 CIPHER_SUITE_REJECTED = 24,
102 UNSPECIFIED_QOS_REASON = 32,
103 NOT_ENOUGH_BANDWITH = 33,
105 STA_OUT_OF_LIMITS = 35,
106 REQUESTED_BY_STA_LEAVING = 36,
107 REQUESTED_BY_STA_REJECT_MECHANISM = 37,
108 REQUESTED_BY_STA_REJECT_SETUP = 38,
109 REQUESTED_BY_STA_TIMEOUT = 39,
110 PEER_STA_NOT_SUPPORT_CIPHER = 45
122 UNIDENTIFIED_SIGNAL = 0x4,
134 #if TINS_IS_LITTLE_ENDIAN 147 radio_measurement_:1,
149 delayed_block_ack_:1,
150 immediate_block_ack_:1;
151 #elif TINS_IS_BIG_ENDIAN 152 uint16_t channel_agility_:1,
160 immediate_block_ack_:1,
161 delayed_block_ack_:1,
163 radio_measurement_:1,
221 return short_preamble_;
239 return channel_agility_;
248 return spectrum_mgmt_;
284 return radio_measurement_;
302 return delayed_block_ack_;
311 return immediate_block_ack_;
319 void ess(
bool new_value) {
338 cf_poll_ = new_value;
347 cf_poll_req_ = new_value;
356 privacy_ = new_value;
365 short_preamble_ = new_value;
383 channel_agility_ = new_value;
392 spectrum_mgmt_ = new_value;
400 void qos(
bool new_value) {
409 void sst(
bool new_value) {
428 radio_measurement_ = new_value;
437 dsss_ofdm_ = new_value;
446 delayed_block_ack_ = new_value;
455 immediate_block_ack_ = new_value;
464 uint8_t hop_set, hop_pattern, hop_index;
467 : dwell_time(0), hop_set(0), hop_pattern(0), hop_index(0) {}
473 : dwell_time(dwell_time), hop_set(hop_set),
474 hop_pattern(hop_pattern), hop_index(hop_index) {}
483 uint8_t cfp_count, cfp_period;
484 uint16_t cfp_max_duration, cfp_dur_remaining;
487 : cfp_count(0), cfp_period(0), cfp_max_duration(0), cfp_dur_remaining(0) {}
491 uint16_t cfp_max_duration,
492 uint16_t cfp_dur_remaining)
493 : cfp_count(cfp_count), cfp_period(cfp_period),
494 cfp_max_duration(cfp_max_duration),
495 cfp_dur_remaining(cfp_dur_remaining) {}
504 static const size_t minimum_size = address_type::address_size +
sizeof(uint8_t) + 2 *
sizeof(uint8_t);
507 uint8_t recovery_interval;
508 channel_map_type channel_map;
513 uint8_t recovery_interval,
514 const channel_map_type& channel_map)
515 : dfs_owner(addr), recovery_interval(recovery_interval),
516 channel_map(channel_map) {}
526 static const size_t minimum_size = 3 +
sizeof(uint8_t) * 3;
529 byte_array first_channel, number_channels, max_transmit_power;
537 : country(country), first_channel(first), number_channels(number),
538 max_transmit_power(max) {}
547 static const size_t minimum_size =
sizeof(uint8_t) * 4;
549 uint8_t flag, number_of_sets, modulus, offset;
553 : flag(0), number_of_sets(0), modulus(0), offset(0) {}
560 : flag(flag), number_of_sets(sets), modulus(modulus),
561 offset(offset), random_table(table) {}
570 uint8_t switch_mode, new_channel, switch_count;
573 : switch_mode(0), new_channel(0), switch_count(0) {}
578 : switch_mode(mode), new_channel(channel), switch_count(count) { }
587 uint8_t quiet_count, quiet_period;
588 uint16_t quiet_duration, quiet_offset;
591 : quiet_count(0), quiet_period(0), quiet_duration(0), quiet_offset(0) {}
597 : quiet_count(count), quiet_period(period),
598 quiet_duration(duration), quiet_offset(offset) {}
607 uint16_t station_count;
608 uint16_t available_capacity;
609 uint8_t channel_utilization;
612 : station_count(0), available_capacity(0), channel_utilization(0) {}
614 bss_load_type(uint16_t count, uint8_t utilization, uint16_t capacity)
615 : station_count(count), available_capacity(capacity),
616 channel_utilization(utilization) {}
625 uint8_t dtim_count, dtim_period, bitmap_control;
629 : dtim_count(0), dtim_period(0), bitmap_control(0) {}
635 : dtim_count(count), dtim_period(period), bitmap_control(control),
636 partial_virtual_bitmap(bitmap) {}
652 : oui(oui), data(data) { }
668 return ext_header_.addr2;
677 return ext_header_.addr3;
686 #if TINS_IS_LITTLE_ENDIAN 687 return ext_header_.frag_seq & 0xf;
689 return (ext_header_.frag_seq >> 8) & 0xf;
699 #if TINS_IS_LITTLE_ENDIAN 700 return (ext_header_.frag_seq >> 4) & 0xfff;
702 return (Endian::le_to_host<uint16_t>(ext_header_.frag_seq) >> 4) & 0xfff;
720 void addr2(
const address_type& new_addr2);
727 void addr3(
const address_type& new_addr3);
748 void addr4(
const address_type& new_addr4);
757 void ssid(
const std::string& new_ssid);
771 void supported_rates(
const rates_type& new_rates);
778 void extended_supported_rates(
const rates_type& new_rates);
785 void qos_capability(qos_capability_type new_qos_capability);
793 void power_capability(uint8_t min_power, uint8_t max_power);
804 void supported_channels(
const channels_type& new_channels);
814 void edca_parameter_set(uint32_t ac_be, uint32_t ac_bk, uint32_t ac_vi, uint32_t ac_vo);
821 void request_information(
const request_info_type elements);
835 void ds_parameter_set(uint8_t current_channel);
849 void ibss_parameter_set(uint16_t atim_window);
871 void fh_parameters(uint8_t prime_radix, uint8_t number_channels);
885 void power_constraint(uint8_t local_power_constraint);
907 void tpc_report(uint8_t transmit_power, uint8_t link_margin);
914 void erp_information(uint8_t value);
935 void challenge_text(
const std::string& text);
965 std::string ssid()
const;
975 rates_type supported_rates()
const;
985 rates_type extended_supported_rates()
const;
995 qos_capability_type qos_capability()
const;
1005 std::pair<uint8_t, uint8_t> power_capability()
const;
1019 channels_type supported_channels()
const;
1029 request_info_type request_information()
const;
1049 uint8_t ds_parameter_set()
const;
1070 uint16_t ibss_parameter_set()
const;
1100 std::pair<uint8_t, uint8_t> fh_parameters()
const;
1120 uint8_t power_constraint()
const;
1150 std::pair<uint8_t, uint8_t> tpc_report()
const;
1160 uint8_t erp_information()
const;
1190 std::string challenge_text()
const;
1210 uint32_t header_size()
const;
1232 uint8_t addr2[address_type::address_size];
1233 uint8_t addr3[address_type::address_size];
1257 void write_ext_header(Memory::OutputMemoryStream& stream);
1259 uint32_t management_frame_size() {
1263 static std::vector<uint8_t> serialize_rates(
const rates_type& rates);
1264 static rates_type deserialize_rates(
const option*
option);
1266 template<
typename T>
1267 T search_and_convert(
OptionTypes opt_type)
const {
1268 const option* opt = search_option(opt_type);
1272 return opt->
to<T>();
1281 #endif // TINS_DOT11_DOT11_MGMT_H
Definition: dot11_mgmt.h:624
std::vector< uint8_t > byte_array
Definition: pdu.h:45
address_type addr2() const
Getter for the second address.
Definition: dot11_mgmt.h:667
Class representing an 802.11 frame.
Definition: dot11_base.h:54
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
PDUType pdu_type() const
Getter for the PDU's type.
Definition: dot11_mgmt.h:1217
uint32_t header_size() const
Returns the 802.11 frame's header length.
Definition: dot11_mgmt.cpp:69
OptionTypes
Enum for the different types of tagged options.
Definition: dot11_base.h:99
ReasonCodes
Enum used in the reason code field.
Definition: dot11_mgmt.h:78
bool matches_flag(PDUType flag) const
Check whether this PDU matches the specified flag.
Definition: dot11_mgmt.h:1226
small_uint< 4 > frag_num() const
Getter for the fragment number.
Definition: dot11_mgmt.h:685
Definition: dot11_mgmt.h:546
Definition: dot11_mgmt.h:644
Definition: dot11_mgmt.h:569
std::vector< float > rates_type
Definition: dot11_mgmt.h:50
address_type addr3() const
Getter for the third address.
Definition: dot11_mgmt.h:676
Represents a PDU option field.
Definition: pdu_option.h:201
Definition: dot11_mgmt.h:503
Definition: dot11_mgmt.h:586
Base class for all management frames in the IEEE 802.11 protocol.
Definition: dot11_mgmt.h:45
bool matches_flag(PDUType flag) const
Check whether this PDU matches the specified flag.
Definition: dot11_base.h:497
std::vector< std::pair< uint8_t, uint8_t > > channel_map_type
Definition: dot11_mgmt.h:60
Definition: dot11_mgmt.h:524
Definition: dot11_mgmt.h:482
std::vector< uint8_t > request_info_type
Definition: dot11_mgmt.h:65
std::vector< std::pair< uint8_t, uint8_t > > channels_type
Definition: dot11_mgmt.h:55
The Tins namespace.
Definition: address_range.h:38
T to() const
Constructs a T from this PDUOption.
Definition: pdu_option.h:389
Definition: dot11_mgmt.h:462
MapMask
Enum that represents the map field within a channels map field.
Definition: dot11_mgmt.h:119
Definition: dot11_mgmt.h:606
uint8_t qos_capability_type
Definition: dot11_mgmt.h:660
small_uint< 12 > seq_num() const
Getter for the sequence number field.
Definition: dot11_mgmt.h:698
Exception thrown when an option is not found.
Definition: exceptions.h:56
const address_type & addr4() const
Getter for the fourth address.
Definition: dot11_mgmt.h:711