libtins 4.5
|
Class representing an 802.11 frame. More...
#include <dot11_base.h>
Classes | |
struct | dot11_header |
Public Types | |
enum | Types { MANAGEMENT = 0 , CONTROL = 1 , DATA = 2 } |
Enum for the different types of 802.11 frames. More... | |
enum | OptionTypes { SSID , SUPPORTED_RATES , FH_SET , DS_SET , CF_SET , TIM , IBSS_SET , COUNTRY , HOPPING_PATTERN_PARAMS , HOPPING_PATTERN_TABLE , REQUEST_INFORMATION , BSS_LOAD , EDCA , TSPEC , TCLAS , SCHEDULE , CHALLENGE_TEXT , POWER_CONSTRAINT = 32 , POWER_CAPABILITY , TPC_REQUEST , TPC_REPORT , SUPPORTED_CHANNELS , CHANNEL_SWITCH , MEASUREMENT_REQUEST , MEASUREMENT_REPORT , QUIET , IBSS_DFS , ERP_INFORMATION , TS_DELAY , TCLAS_PROCESSING , HT_CAPABILITY , QOS_CAPABILITY , RSN = 48 , EXT_SUPPORTED_RATES = 50 , AP_CHANNEL_REPORT , NEIGHBOR_REPORT , RCPI , MOBILITY_DOMAIN_MDE , FAST_BSS_TRANSITION_FTE , TIMEOUT_INTERVAL , RIC_DATA_RDE , DSE_REG_LOC , SUPPORTED_OP_CLASSES , EXT_CH_SWITCH_ANNOUNCEMENT , HT_OPERATION , SEC_CH_OFFSET , BSS_AVG_ACCESS_DELAY , ANTENNA , RSNI , MEASUREMENT_PILOT_TRANSMISSION , BSS_AVAIL_ADMISSION_CAPACITY , BSS_AC_ACCESS_DELAY , TIME_ADVERTISEMENT , RM_ENABLED_CAP , MULTIPLE_BSSID , BSS_2040_COEX , BSS_2040_INTOLERANT_CH_REPORT , OVERLAPPING_BSS_SCAN_PARAM , RIC_DESCRIPTOR , MGMT_MIC , EVENT_REQ = 78 , EVENT_REPORT , DIAG_REQ , DIAG_REPORT , LOCATION_PARAMS , NONTRANSMITTED_BSSID_CAP , SSID_LIST , MULTIPLE_BSSID_INDEX , FMS_DESCRIPTOR , FMS_REQ , FMS_RESP , QOS_TRAFFIC_CAP , BSS_MAX_IDLE_PERIOD , TFS_REQ , TFS_RESP , WNM_SLEEP_MODE , TIM_BROADCAST_REQ , TIM_BROADCAST_RESP , COLLOCATED_INTERFERENCE_REPORT , CH_USAGE , TIME_ZONE , DMS_REQ , DMS_RESP , LINK_ID , WAKEUP_SCHEDULE , CH_SWITCH_TIMING , PTI_CONTROL , TPU_BUFFER_STATUS , INTERWORKING , ADVERTISEMENT_PROTOCOL , EXPEDITED_BANDWIDTH_REQ , QOS_MAP , ROAMING_CONSORTIUM , EMERG_ALERT_ID , MESH_CONFIG , MESH_ID , MESH_LINK_METRIC_REPORT , CONGESTION_NOTIFICATION , MESH_PEERING_MGMT , MESH_CH_SWITCH_PARAMS , MESH_AWAKE_WINDOW , BEACON_TIMING , MCCAOP_SETUP_REQ , MCCAOP_SETUP_REPLY , MCCAOP_ADVERTISEMENT , MCCAOP_TEARDOWN , GANN , RANN , EXT_CAP , PREQ = 130 , PREP , PERR , PXU = 137 , PXUC , AUTH_MESH_PEER_EX , MIC , DEST_URI , UAPSD_COEX , DMG_WAKEUP_SCHEDULE , EXT_SCHEDULE , STA_AVAIL , DMG_TSPEC , NEXT_DMG_ATI , DMG_CAP , DMG_OP = 151 , DMG_BSS_PARAM_CHG , DMG_BEAM_REFINEMENT , CH_MEASUREMENT_FEEDBACK , AWAKE_WINDOW = 157 , MULTIBAND , ADDBA_ESXT , NEXTPCP_LIST , PCP_HANDOVER , DMG_LINK_MARGIN , SWITCHING_STREAM , SESSION_TRANSITION , DYNAMIC_TONE_PAIRING_REPORT , CLUSTER_REPORT , RELAY_CAP , RELAY_TRANSFER_PARAM_SET , BEAMLINK_MAINTENANCE , MULTIPLE_MAC_SUBLAYERS , UPID , DMG_LINK_ADAPTATION_ACK , MCCAOP_ADV_OVERVIEW = 174 , QUIET_PERIOD_REQ , QUIET_PERIOD_RESP = 177 , QMF_POLICY = 181 , ECAPC_POLICY = 182 , CLUSTER_TIME_OFFSET , INTRA_ACCESS_CAT_PRIORITY , SCS_DESCRIPTOR , QLOAD_REPORT , HCCA_TXOP_UPDATE_COUNT , HIGHER_LAYER_STREAM_ID , GCR_GROUP_ADDR , ANTENNA_SECTOR_ID_PATTERN , VHT_CAP , VHT_OP , EXT_BSS_LOAD , WIDE_BANDWIDTH_CH_SWITCH , TRANSMIT_POWER_ENVELOPE , CH_SWITCH_WRAPPER , AID , QUIET_CHANNEL , OP_MODE_NOTIFY , UPSIM , REDUCED_NEIGHBOR_REPORT , TVHT_OP , DEV_LOC = 204 , WHITE_SPACE_MAP , FINE_TUNING_MEASUREMENT_PARAMS , VENDOR_SPECIFIC = 221 } |
Enum for the different types of tagged options. | |
enum | ManagementSubtypes { ASSOC_REQ = 0 , ASSOC_RESP = 1 , REASSOC_REQ = 2 , REASSOC_RESP = 3 , PROBE_REQ = 4 , PROBE_RESP = 5 , BEACON = 8 , ATIM = 9 , DISASSOC = 10 , AUTH = 11 , DEAUTH = 12 } |
Enum for the different subtypes of 802.11 management frames. More... | |
enum | ControlSubtypes { BLOCK_ACK_REQ = 8 , BLOCK_ACK = 9 , PS = 10 , RTS = 11 , CTS = 12 , ACK = 13 , CF_END = 14 , CF_END_ACK = 15 } |
Enum for the different subtypes of 802.11 control frames. More... | |
enum | DataSubtypes { DATA_DATA = 0 , DATA_CF_ACK = 1 , DATA_CF_POLL = 2 , DATA_CF_ACK_POLL = 3 , DATA_NULL = 4 , CF_ACK = 5 , CF_POLL = 6 , CF_ACK_POLL = 7 , QOS_DATA_DATA = 8 , QOS_DATA_CF_ACK = 9 , QOS_DATA_CF_POLL = 10 , QOS_DATA_CF_ACK_POLL = 11 , QOS_DATA_NULL = 12 } |
Enum fro the different subtypes of 802.11 data frames. More... | |
typedef HWAddress< 6 > | address_type |
typedef PDUOption< uint8_t, Dot11 > | option |
IEEE 802.11 options struct. | |
typedef std::vector< option > | options_type |
![]() | |
enum | endian_type { BE , LE } |
enum | PDUType { RAW , ETHERNET_II , IEEE802_3 , DOT3 = IEEE802_3 , RADIOTAP , DOT11 , DOT11_ACK , DOT11_ASSOC_REQ , DOT11_ASSOC_RESP , DOT11_AUTH , DOT11_BEACON , DOT11_BLOCK_ACK , DOT11_BLOCK_ACK_REQ , DOT11_CF_END , DOT11_DATA , DOT11_CONTROL , DOT11_DEAUTH , DOT11_DIASSOC , DOT11_END_CF_ACK , DOT11_MANAGEMENT , DOT11_PROBE_REQ , DOT11_PROBE_RESP , DOT11_PS_POLL , DOT11_REASSOC_REQ , DOT11_REASSOC_RESP , DOT11_RTS , DOT11_QOS_DATA , LLC , SNAP , IP , ARP , TCP , UDP , ICMP , BOOTP , DHCP , EAPOL , RC4EAPOL , RSNEAPOL , DNS , LOOPBACK , IPv6 , ICMPv6 , SLL , DHCPv6 , DOT1AD , DOT1Q , PPPOE , STP , PPI , IPSEC_AH , IPSEC_ESP , PKTAP , MPLS , DOT11_CONTROL_TA , VXLAN , UNKNOWN = 999 , USER_DEFINED_PDU = 1000 } |
Enum which identifies each type of PDU. More... | |
typedef byte_array | serialization_type |
Public Member Functions | |
Dot11 (const address_type &dst_hw_addr=address_type()) | |
Constructs an 802.11 PDU. More... | |
Dot11 (const uint8_t *buffer, uint32_t total_sz) | |
Constructs 802.11 PDU from a buffer and adds all identifiable PDUs found in the buffer as children of this one. More... | |
small_uint< 2 > | protocol () const |
Getter for the protocol version field. More... | |
small_uint< 2 > | type () const |
Getter for the Type field. More... | |
small_uint< 4 > | subtype () const |
Getter for the Subtype field. More... | |
small_uint< 1 > | to_ds () const |
Getter for the To-DS field. More... | |
small_uint< 1 > | from_ds () const |
Getter for the From-DS field. More... | |
small_uint< 1 > | more_frag () const |
Getter for the More-Frag field. More... | |
small_uint< 1 > | retry () const |
Getter for the Retry field. More... | |
small_uint< 1 > | power_mgmt () const |
Getter for the Power-Management field. More... | |
small_uint< 1 > | more_data () const |
Getter for the More Data field. More... | |
small_uint< 1 > | wep () const |
Getter for the WEP field. More... | |
small_uint< 1 > | order () const |
Getter for the Order field. More... | |
uint16_t | duration_id () const |
Getter for the Duration-ID field. More... | |
address_type | addr1 () const |
Getter for the first address. More... | |
void | protocol (small_uint< 2 > new_proto) |
Setter for the protocol version field. More... | |
void | type (small_uint< 2 > new_type) |
Setter for the type field. More... | |
void | subtype (small_uint< 4 > new_subtype) |
Setter for the subtype field. More... | |
void | to_ds (small_uint< 1 > new_value) |
Setter for the To-DS field. More... | |
void | from_ds (small_uint< 1 > new_value) |
Setter for the From-DS field. More... | |
void | more_frag (small_uint< 1 > new_value) |
Setter for the More-Frag field. More... | |
void | retry (small_uint< 1 > new_value) |
Setter for the Retry field. More... | |
void | power_mgmt (small_uint< 1 > new_value) |
Setter for the Power-Management field. More... | |
void | more_data (small_uint< 1 > new_value) |
Setter for the More Data field. More... | |
void | wep (small_uint< 1 > new_value) |
Setter for the WEP field. More... | |
void | order (small_uint< 1 > new_value) |
Setter for the Order field. More... | |
void | duration_id (uint16_t new_duration_id) |
Setter for the Duration-ID field. More... | |
void | addr1 (const address_type &new_addr1) |
Setter for the first address. More... | |
uint32_t | header_size () const |
Returns the 802.11 frame's header length. More... | |
void | send (PacketSender &sender, const NetworkInterface &iface) |
void | add_option (const option &opt) |
Adds a new option to this Dot11 PDU. More... | |
void | add_option (option &&opt) |
Adds a new option to this Dot11 PDU. More... | |
bool | remove_option (OptionTypes type) |
Removes a Dot11 option. More... | |
const option * | search_option (OptionTypes type) const |
Looks up a tagged option in the option list. More... | |
PDUType | pdu_type () const |
Getter for the PDU's type. More... | |
Dot11 * | clone () const |
bool | matches_flag (PDUType flag) const |
Check whether this PDU matches the specified flag. More... | |
const options_type & | options () const |
Getter for the option list. More... | |
![]() | |
PDU () | |
Default constructor. | |
PDU (PDU &&rhs) TINS_NOEXCEPT | |
Move constructor. More... | |
PDU & | operator= (PDU &&rhs) TINS_NOEXCEPT |
Move assignment operator. More... | |
virtual | ~PDU () |
PDU destructor. More... | |
virtual uint32_t | header_size () const =0 |
The header's size. More... | |
virtual uint32_t | trailer_size () const |
Trailer's size. More... | |
uint32_t | size () const |
The whole chain of PDU's size, including this one. More... | |
virtual uint32_t | advertised_size () const |
The whole chain of PDU's advertised size, including this one. More... | |
PDU * | inner_pdu () const |
Getter for the inner PDU. More... | |
PDU * | parent_pdu () const |
PDU * | release_inner_pdu () |
Releases the inner PDU. More... | |
void | inner_pdu (PDU *next_pdu) |
Sets the child PDU. More... | |
void | inner_pdu (const PDU &next_pdu) |
Sets the child PDU. More... | |
serialization_type | serialize () |
Serializes the whole chain of PDU's, including this one. More... | |
template<typename T > | |
T * | find_pdu (PDUType type=T::pdu_flag) |
Finds and returns the first PDU that matches the given flag. More... | |
template<typename T > | |
const T * | find_pdu (PDUType type=T::pdu_flag) const |
Finds and returns the first PDU that matches the given flag. More... | |
template<typename T > | |
T & | rfind_pdu (PDUType type=T::pdu_flag) |
Finds and returns the first PDU that matches the given flag. More... | |
template<typename T > | |
const T & | rfind_pdu (PDUType type=T::pdu_flag) const |
Finds and returns the first PDU that matches the given flag. More... | |
virtual PDU * | clone () const =0 |
Clones this packet. More... | |
virtual void | send (PacketSender &sender, const NetworkInterface &iface) |
Send the stack of PDUs through a PacketSender. More... | |
virtual PDU * | recv_response (PacketSender &sender, const NetworkInterface &iface) |
Receives a matching response for this packet. More... | |
virtual bool | matches_response (const uint8_t *ptr, uint32_t total_sz) const |
Check whether ptr points to a valid response for this PDU. More... | |
virtual bool | matches_flag (PDUType flag) const |
Check whether this PDU matches the specified flag. More... | |
virtual PDUType | pdu_type () const =0 |
Getter for the PDU's type. More... | |
Static Public Member Functions | |
static Dot11 * | from_bytes (const uint8_t *buffer, uint32_t total_sz) |
Allocates an Dot11 PDU from a buffer. More... | |
Static Public Attributes | |
static const PDU::PDUType | pdu_flag = PDU::DOT11 |
This PDU's flag. | |
static const address_type | BROADCAST = "ff:ff:ff:ff:ff:ff" |
Broadcast hardware address. | |
static const endian_type | endianness = LE |
![]() | |
static const endian_type | endianness = BE |
Protected Member Functions | |
virtual void | write_ext_header (Memory::OutputMemoryStream &stream) |
virtual void | write_fixed_parameters (Memory::OutputMemoryStream &stream) |
void | parse_tagged_parameters (Memory::InputMemoryStream &stream) |
void | add_tagged_option (OptionTypes opt, uint8_t len, const uint8_t *val) |
![]() | |
PDU (const PDU &other) | |
Copy constructor. | |
PDU & | operator= (const PDU &other) |
Copy assignment operator. | |
void | copy_inner_pdu (const PDU &pdu) |
Copy other PDU's inner PDU(if any). More... | |
virtual void | prepare_for_serialize () |
Prepares this PDU for serialization. More... | |
void | serialize (uint8_t *buffer, uint32_t total_sz) |
Serializes this PDU and propagates this action to child PDUs. More... | |
virtual void | write_serialization (uint8_t *buffer, uint32_t total_sz)=0 |
Serializes this TCP PDU. More... | |
Protected Attributes | |
TINS_BEGIN_PACK struct Tins::Dot11::dot11_header | TINS_END_PACK |
Class representing an 802.11 frame.
typedef HWAddress<6> Tins::Dot11::address_type |
The type used to store hardware addresses.
typedef std::vector<option> Tins::Dot11::options_type |
The type used to store tagged options.
Enum for the different subtypes of 802.11 control frames.
Enum fro the different subtypes of 802.11 data frames.
Enum for the different subtypes of 802.11 management frames.
enum Tins::Dot11::Types |
Enum for the different types of 802.11 frames.
Tins::Dot11::Dot11 | ( | const address_type & | dst_hw_addr = address_type() | ) |
Constructs an 802.11 PDU.
dst_hw_addr | The destination hardware address. |
Tins::Dot11::Dot11 | ( | const uint8_t * | buffer, |
uint32_t | total_sz | ||
) |
Constructs 802.11 PDU from a buffer and adds all identifiable PDUs found in the buffer as children of this one.
If the next PDU is not recognized, then a RawPDU is used.
If there is not enough size for a 802.11 header in the buffer, a malformed_packet exception is thrown.
buffer | The buffer from which this PDU will be constructed. |
total_sz | The total size of the buffer. |
void Tins::Dot11::add_option | ( | const option & | opt | ) |
|
inline |
|
inline |
Getter for the first address.
void Tins::Dot11::addr1 | ( | const address_type & | new_addr1 | ) |
Setter for the first address.
new_addr1 | The new first address. |
|
inlinevirtual |
Implements Tins::PDU.
Reimplemented in Tins::Dot11Beacon, Tins::Dot11RTS, Tins::Dot11PSPoll, Tins::Dot11CFEnd, Tins::Dot11EndCFAck, Tins::Dot11Ack, Tins::Dot11BlockAckRequest, Tins::Dot11BlockAck, Tins::Dot11Data, Tins::Dot11QoSData, Tins::Dot11ProbeRequest, and Tins::Dot11ProbeResponse.
|
inline |
Getter for the Duration-ID field.
void Tins::Dot11::duration_id | ( | uint16_t | new_duration_id | ) |
Setter for the Duration-ID field.
new_duration_id | The new Duration-ID field value. |
|
static |
Allocates an Dot11 PDU from a buffer.
This can be used somehow as a "virtual constructor". This method instantiates the appropriate subclass of Dot11 from the given buffer.
The allocated class' type will be figured out from the information provided in the buffer.
buffer | The buffer from which to take the PDU data. |
total_sz | The total size of the buffer. |
|
inline |
Getter for the From-DS field.
void Tins::Dot11::from_ds | ( | small_uint< 1 > | new_value | ) |
Setter for the From-DS field.
new_value | The new From-DS field value. |
|
virtual |
Returns the 802.11 frame's header length.
Implements Tins::PDU.
Reimplemented in Tins::Dot11Beacon, Tins::Dot11ControlTA, Tins::Dot11BlockAckRequest, Tins::Dot11BlockAck, Tins::Dot11Data, Tins::Dot11QoSData, Tins::Dot11ManagementFrame, and Tins::Dot11ProbeResponse.
|
inlinevirtual |
Check whether this PDU matches the specified flag.
flag | The flag to match |
Reimplemented from Tins::PDU.
Reimplemented in Tins::Dot11Beacon, Tins::Dot11Control, Tins::Dot11ControlTA, Tins::Dot11RTS, Tins::Dot11PSPoll, Tins::Dot11CFEnd, Tins::Dot11EndCFAck, Tins::Dot11Ack, Tins::Dot11BlockAckRequest, Tins::Dot11BlockAck, Tins::Dot11Data, Tins::Dot11QoSData, Tins::Dot11ManagementFrame, Tins::Dot11ProbeRequest, and Tins::Dot11ProbeResponse.
|
inline |
Getter for the More Data field.
void Tins::Dot11::more_data | ( | small_uint< 1 > | new_value | ) |
Setter for the More Data field.
new_value | The new More Data field value. |
|
inline |
Getter for the More-Frag field.
void Tins::Dot11::more_frag | ( | small_uint< 1 > | new_value | ) |
Setter for the More-Frag field.
new_value | The new More-Frag field value. |
|
inline |
Getter for the option list.
|
inline |
Getter for the Order field.
void Tins::Dot11::order | ( | small_uint< 1 > | new_value | ) |
Setter for the Order field.
new_value | The new Order field value. |
|
inlinevirtual |
Getter for the PDU's type.
Implements Tins::PDU.
Reimplemented in Tins::Dot11Beacon, Tins::Dot11Control, Tins::Dot11RTS, Tins::Dot11PSPoll, Tins::Dot11CFEnd, Tins::Dot11EndCFAck, Tins::Dot11Ack, Tins::Dot11BlockAckRequest, Tins::Dot11BlockAck, Tins::Dot11Data, Tins::Dot11QoSData, Tins::Dot11ManagementFrame, Tins::Dot11ProbeRequest, and Tins::Dot11ProbeResponse.
|
inline |
Getter for the Power-Management field.
void Tins::Dot11::power_mgmt | ( | small_uint< 1 > | new_value | ) |
Setter for the Power-Management field.
new_value | The new Power-Management field value. |
|
inline |
Getter for the protocol version field.
void Tins::Dot11::protocol | ( | small_uint< 2 > | new_proto | ) |
Setter for the protocol version field.
new_proto | The new protocol version field value. |
bool Tins::Dot11::remove_option | ( | OptionTypes | type | ) |
Removes a Dot11 option.
If there are multiple options of the given type, only the first one will be removed.
type | The type of the option to be removed. |
|
inline |
Getter for the Retry field.
void Tins::Dot11::retry | ( | small_uint< 1 > | new_value | ) |
Setter for the Retry field.
new_value | The new Retry field value. |
const Dot11::option * Tins::Dot11::search_option | ( | OptionTypes | type | ) | const |
Looks up a tagged option in the option list.
The returned pointer must not be free'd.
type | The option identifier. |
|
virtual |
Reimplemented from Tins::PDU.
|
inline |
Getter for the Subtype field.
void Tins::Dot11::subtype | ( | small_uint< 4 > | new_subtype | ) |
Setter for the subtype field.
new_subtype | The new subtype field value. |
|
inline |
Getter for the To-DS field.
void Tins::Dot11::to_ds | ( | small_uint< 1 > | new_value | ) |
Setter for the To-DS field.
new_value | The new To-DS field value. |
|
inline |
Getter for the Type field.
void Tins::Dot11::type | ( | small_uint< 2 > | new_type | ) |
Setter for the type field.
new_type | The new type field value. |
|
inline |
Getter for the WEP field.
void Tins::Dot11::wep | ( | small_uint< 1 > | new_value | ) |
Setter for the WEP field.
new_value | The new WEP field value. |
|
static |
The endianness used by Dot11.