|
libtins
4.0
|
Class that represents the IEEE 802.11 radio tap header. More...
#include <radiotap.h>
Classes | |
| struct | mcs_type |
| The type used to represent the MCS flags field. More... | |
| struct | xchannel_type |
| The type used to represent the XChannel field. More... | |
Public Types | |
| enum | ChannelType { TURBO = 0x10, CCK = 0x20, OFDM = 0x40, TWO_GZ = 0x80, FIVE_GZ = 0x100, PASSIVE = 0x200, DYN_CCK_OFDM = 0x400, GFSK = 0x800 } |
| Enumeration of the different channel type flags. More... | |
| enum | PresentFlags { TSFT = 1 << 0, TSTF = 1 << 0, FLAGS = 1 << 1, RATE = 1 << 2, CHANNEL = 1 << 3, FHSS = 1 << 4, DBM_SIGNAL = 1 << 5, DBM_NOISE = 1 << 6, LOCK_QUALITY = 1 << 7, TX_ATTENUATION = 1 << 8, DB_TX_ATTENUATION = 1 << 9, DBM_TX_ATTENUATION = 1 << 10, ANTENNA = 1 << 11, DB_SIGNAL = 1 << 12, DB_NOISE = 1 << 13, RX_FLAGS = 1 << 14, TX_FLAGS = 1 << 15, DATA_RETRIES = 1 << 17, XCHANNEL = 1 << 18, CHANNEL_PLUS = 1 << 18, MCS = 1 << 19 } |
| Flags used in the present field. More... | |
| enum | FrameFlags { CFP = 1, PREAMBLE = 2, WEP = 4, FRAGMENTATION = 8, FCS = 16, PADDING = 32, FAILED_FCS = 64, SHORT_GI = 128 } |
| Flags used in the RadioTap::flags() method. | |
| typedef PDUOption< RadioTap::PresentFlags, RadioTap > | option |
| typedef std::vector< uint8_t > | options_payload_type |
Public Types inherited from Tins::PDU | |
| 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, DOT1Q, PPPOE, STP, PPI, IPSEC_AH, IPSEC_ESP, PKTAP, MPLS, UNKNOWN = 999, USER_DEFINED_PDU = 1000 } |
| Enum which identifies each type of PDU. More... | |
| typedef byte_array | serialization_type |
Public Member Functions | |
| RadioTap () | |
| Default constructor. | |
| RadioTap (const uint8_t *buffer, uint32_t total_sz) | |
| Constructs a RadioTap object from a buffer and adds all identifiable PDUs found in the buffer as children of this one. More... | |
| void | send (PacketSender &sender, const NetworkInterface &iface) |
| void | version (uint8_t new_version) |
| Setter for the version field. More... | |
| void | padding (uint8_t new_padding) |
| Setter for the padding field. More... | |
| void | length (uint16_t new_length) |
| Setter for the length field. More... | |
| void | tsft (uint64_t new_tsft) |
| Setter for the TSFT field. More... | |
| void | flags (FrameFlags new_flags) |
| Setter for the flags field. More... | |
| void | rate (uint8_t new_rate) |
| Setter for the rate field. More... | |
| void | channel (uint16_t new_freq, uint16_t new_type) |
| Setter for the channel frequency and type field. More... | |
| void | dbm_signal (int8_t new_dbm_signal) |
| Setter for the dbm signal field. More... | |
| void | dbm_noise (int8_t new_dbm_noise) |
| Setter for the dbm noise field. More... | |
| void | signal_quality (uint8_t new_signal_quality) |
| Setter for the signal quality field. More... | |
| void | antenna (uint8_t new_antenna) |
| Setter for the antenna field. More... | |
| void | db_signal (uint8_t new_db_signal) |
| Setter for the db signal field. More... | |
| void | rx_flags (uint16_t new_rx_flag) |
| Setter for the rx flag field. More... | |
| void | tx_flags (uint16_t new_tx_flag) |
| Setter for the tx flag field. More... | |
| void | xchannel (xchannel_type new_xchannel) |
| Setter for the xchannel field. More... | |
| void | data_retries (uint8_t new_data_retries) |
| Setter for the data retries field. More... | |
| void | mcs (const mcs_type &new_mcs) |
| Setter for the MCS field. More... | |
| uint8_t | version () const |
| Getter for the version field. More... | |
| uint8_t | padding () const |
| Getter for the padding field. More... | |
| uint16_t | length () const |
| Getter for the length field. More... | |
| uint64_t | tsft () const |
| Getter for the tsft field. More... | |
| FrameFlags | flags () const |
| Getter for the flags field. More... | |
| uint8_t | rate () const |
| Getter for the rate field. More... | |
| uint16_t | channel_freq () const |
| Getter for the channel frequency field. More... | |
| uint16_t | channel_type () const |
| Getter for the channel type field. More... | |
| int8_t | dbm_signal () const |
| Getter for the dbm signal field. More... | |
| int8_t | dbm_noise () const |
| Getter for the dbm noise field. More... | |
| uint16_t | signal_quality () const |
| Getter for the signal quality field. More... | |
| uint8_t | antenna () const |
| Getter for the antenna field. More... | |
| uint8_t | db_signal () const |
| Getter for the db signal field. More... | |
| xchannel_type | xchannel () const |
| Getter for the XChannel field. More... | |
| uint8_t | data_retries () const |
| Getter for the data retries field. More... | |
| uint16_t | rx_flags () const |
| Getter for the rx flags field. More... | |
| uint16_t | tx_flags () const |
| Getter for the tx flags field. More... | |
| mcs_type | mcs () const |
| Getter for the MCS field. More... | |
| PresentFlags | present () const |
| Getter for the present bit fields. More... | |
| bool | matches_response (const uint8_t *ptr, uint32_t total_sz) const |
| Check whether ptr points to a valid response for this PDU. More... | |
| uint32_t | header_size () const |
| Returns the RadioTap frame's header length. More... | |
| uint32_t | trailer_size () const |
| Returns the frame's trailer size. More... | |
| void | add_option (const option &opt) |
| const options_payload_type & | options_payload () const |
| Gets the options payload. More... | |
| RadioTap * | clone () const |
| PDUType | pdu_type () const |
| Getter for the PDU's type. More... | |
Public Member Functions inherited from Tins::PDU | |
| 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... | |
| uint32_t | size () const |
| The whole chain of PDU's 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 * | recv_response (PacketSender &sender, const NetworkInterface &iface) |
| Receives a matching response for this packet. More... | |
| virtual bool | matches_flag (PDUType flag) const |
| Check whether this PDU matches the specified flag. More... | |
Public Attributes | |
| TINS_BEGIN_PACK struct Tins::RadioTap::mcs_type | TINS_END_PACK |
| TINS_BEGIN_PACK struct Tins::RadioTap::xchannel_type | TINS_END_PACK |
Static Public Attributes | |
| static const PDU::PDUType | pdu_flag = PDU::RADIOTAP |
| This PDU's flag. | |
| static const endian_type | endianness = LE |
Static Public Attributes inherited from Tins::PDU | |
| static const endian_type | endianness = BE |
Additional Inherited Members | |
Protected Member Functions inherited from Tins::PDU | |
| 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... | |
Class that represents the IEEE 802.11 radio tap header.
By default, RadioTap PDUs set the necesary fields to send an 802.11 PDU as its inner pdu, avoiding packet drops. As a consequence, the FCS-at-end flag is on, the channel is set to 1, TSFT is set to 0, dbm_signal is set to -50, and the rx_flag and antenna fields to 0.
The type used to store RadioTap options
| typedef std::vector<uint8_t> Tins::RadioTap::options_payload_type |
The type used to store the options payload
Enumeration of the different channel type flags.
These channel type flags can be OR'd and set using the RadioTap::channel() method.
Flags used in the present field.
| Enumerator | |
|---|---|
| TSTF |
Deprecated (typo), use TSFT. |
| Tins::RadioTap::RadioTap | ( | const uint8_t * | buffer, |
| uint32_t | total_sz | ||
| ) |
Constructs a RadioTap object from a buffer and adds all identifiable PDUs found in the buffer as children of this one.
If there is not enough size for a RadioTap header, 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::RadioTap::add_option | ( | const option & | opt | ) |
Adds the given option
| option | The option to be added. |
| void Tins::RadioTap::antenna | ( | uint8_t | new_antenna | ) |
Setter for the antenna field.
| new_antenna | The antenna signal. |
| uint8_t Tins::RadioTap::antenna | ( | ) | const |
Getter for the antenna field.
| void Tins::RadioTap::channel | ( | uint16_t | new_freq, |
| uint16_t | new_type | ||
| ) |
Setter for the channel frequency and type field.
| new_freq | The new channel frequency. |
| new_type | The new channel type. |
| uint16_t Tins::RadioTap::channel_freq | ( | ) | const |
Getter for the channel frequency field.
| uint16_t Tins::RadioTap::channel_type | ( | ) | const |
Getter for the channel type field.
|
inlinevirtual |
Implements Tins::PDU.
| void Tins::RadioTap::data_retries | ( | uint8_t | new_data_retries | ) |
Setter for the data retries field.
| new_rx_flag | The data retries. |
| uint8_t Tins::RadioTap::data_retries | ( | ) | const |
Getter for the data retries field.
| void Tins::RadioTap::db_signal | ( | uint8_t | new_db_signal | ) |
Setter for the db signal field.
| new_antenna | The db signal signal. |
| uint8_t Tins::RadioTap::db_signal | ( | ) | const |
Getter for the db signal field.
| void Tins::RadioTap::dbm_noise | ( | int8_t | new_dbm_noise | ) |
Setter for the dbm noise field.
| new_dbm_noise | The new dbm noise. |
| int8_t Tins::RadioTap::dbm_noise | ( | ) | const |
Getter for the dbm noise field.
| void Tins::RadioTap::dbm_signal | ( | int8_t | new_dbm_signal | ) |
Setter for the dbm signal field.
| new_dbm_signal | The new dbm signal. |
| int8_t Tins::RadioTap::dbm_signal | ( | ) | const |
Getter for the dbm signal field.
| void Tins::RadioTap::flags | ( | FrameFlags | new_flags | ) |
Setter for the flags field.
| new_flags | The new flags. |
| RadioTap::FrameFlags Tins::RadioTap::flags | ( | ) | const |
Getter for the flags field.
|
virtual |
Returns the RadioTap frame's header length.
Implements Tins::PDU.
| void Tins::RadioTap::length | ( | uint16_t | new_length | ) |
Setter for the length field.
| new_length | The new length. |
| uint16_t Tins::RadioTap::length | ( | ) | const |
Getter for the length field.
|
virtual |
Check whether ptr points to a valid response for this PDU.
| ptr | The pointer to the buffer. |
| total_sz | The size of the buffer. |
Reimplemented from Tins::PDU.
| void Tins::RadioTap::mcs | ( | const mcs_type & | new_mcs | ) |
Setter for the MCS field.
| new_rx_flag | The MCS retries. |
| RadioTap::mcs_type Tins::RadioTap::mcs | ( | ) | const |
Getter for the MCS field.
| const RadioTap::options_payload_type & Tins::RadioTap::options_payload | ( | ) | const |
Gets the options payload.
Use Utils::RadioTapParser to iterate these options and extract fields manually, in case you want to have deeper access into the option types/values stored in a RadioTap frame.
| void Tins::RadioTap::padding | ( | uint8_t | new_padding | ) |
Setter for the padding field.
| new_padding | The new padding. |
| uint8_t Tins::RadioTap::padding | ( | ) | const |
Getter for the padding field.
|
inlinevirtual |
| RadioTap::PresentFlags Tins::RadioTap::present | ( | ) | const |
Getter for the present bit fields.
Use this method and masks created from the values taken from the PresentFlags enum to find out which fields are set. Accessing non-initialized fields, the behaviour is undefined will be undefined. It is only safe to use the getter of a field if its corresponding bit flag is set in the present field.
| void Tins::RadioTap::rate | ( | uint8_t | new_rate | ) |
Setter for the rate field.
| new_rate | The new rate. |
| uint8_t Tins::RadioTap::rate | ( | ) | const |
Getter for the rate field.
| void Tins::RadioTap::rx_flags | ( | uint16_t | new_rx_flag | ) |
Setter for the rx flag field.
| new_rx_flag | The rx flags. |
| uint16_t Tins::RadioTap::rx_flags | ( | ) | const |
Getter for the rx flags field.
|
virtual |
Reimplemented from Tins::PDU.
| void Tins::RadioTap::signal_quality | ( | uint8_t | new_signal_quality | ) |
Setter for the signal quality field.
| new_antenna | The signal quality signal. |
| uint16_t Tins::RadioTap::signal_quality | ( | ) | const |
Getter for the signal quality field.
|
virtual |
| void Tins::RadioTap::tsft | ( | uint64_t | new_tsft | ) |
Setter for the TSFT field.
| new_tsft | The new TSFT |
| uint64_t Tins::RadioTap::tsft | ( | ) | const |
Getter for the tsft field.
| void Tins::RadioTap::tx_flags | ( | uint16_t | new_tx_flag | ) |
Setter for the tx flag field.
| new_tx_flag | The tx flags. |
| uint16_t Tins::RadioTap::tx_flags | ( | ) | const |
Getter for the tx flags field.
| void Tins::RadioTap::version | ( | uint8_t | new_version | ) |
Setter for the version field.
| new_version | The new version. |
| uint8_t Tins::RadioTap::version | ( | ) | const |
Getter for the version field.
| void Tins::RadioTap::xchannel | ( | xchannel_type | new_xchannel | ) |
Setter for the xchannel field.
| new_xchannel | The xchannel field |
| RadioTap::xchannel_type Tins::RadioTap::xchannel | ( | ) | const |
Getter for the XChannel field.
|
static |
RadioTap is little endian
1.8.11