libtins  3.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | Static Public Attributes | List of all members
Tins::Dot11Beacon Class Reference

Represents an IEEE 802.11 Beacon. More...

#include <dot11_beacon.h>

Inheritance diagram for Tins::Dot11Beacon:
Tins::Dot11ManagementFrame Tins::Dot11 Tins::PDU

Public Member Functions

 Dot11Beacon (const address_type &dst_hw_addr=address_type(), const address_type &src_hw_addr=address_type())
 Constructor for creating a 802.11 Beacon. More...
 
 Dot11Beacon (const uint8_t *buffer, uint32_t total_sz)
 Constructs a Dot11Beacon object from a buffer and adds all identifiable PDUs found in the buffer as children of this one. More...
 
uint64_t timestamp () const
 Getter for the timestamp field. More...
 
uint16_t interval () const
 Getter for the interval field. More...
 
const capability_informationcapabilities () const
 Getter for the Capabilities Information structure. More...
 
capability_informationcapabilities ()
 Getter for the Capabilities Information. More...
 
void timestamp (uint64_t new_timestamp)
 Setter for the timestamp field. More...
 
void interval (uint16_t new_interval)
 Setter for the interval field. More...
 
uint32_t header_size () const
 Returns the frame's header length. More...
 
bool matches_flag (PDUType flag) const
 Check whether this PDU matches the specified flag. More...
 
Dot11Beaconclone () const
 Clones this PDU. More...
 
PDUType pdu_type () const
 Getter for the PDU's type. More...
 
- Public Member Functions inherited from Tins::Dot11ManagementFrame
address_type addr2 () const
 Getter for the second address. More...
 
address_type addr3 () const
 Getter for the third address. More...
 
small_uint< 4 > frag_num () const
 Getter for the fragment number. More...
 
small_uint< 12 > seq_num () const
 Getter for the sequence number field. More...
 
const address_typeaddr4 () const
 Getter for the fourth address. More...
 
void addr2 (const address_type &new_addr2)
 Setter for the second address. More...
 
void addr3 (const address_type &new_addr3)
 Setter for the third address. More...
 
void frag_num (small_uint< 4 > new_frag_num)
 Setter for the fragment number. More...
 
void seq_num (small_uint< 12 > new_seq_num)
 Setter for the sequence number. More...
 
void addr4 (const address_type &new_addr4)
 Setter for the fourth address. More...
 
void ssid (const std::string &new_ssid)
 Helper method to set the SSID. More...
 
void rsn_information (const RSNInformation &info)
 Helper method to set the RSN information option. More...
 
void supported_rates (const rates_type &new_rates)
 Helper method to set the supported rates option. More...
 
void extended_supported_rates (const rates_type &new_rates)
 Helper method to set the extended supported rates option. More...
 
void qos_capability (qos_capability_type new_qos_capability)
 Helper method to set the QoS capabilities option. More...
 
void power_capability (uint8_t min_power, uint8_t max_power)
 Helper method to set the power capabilities option. More...
 
void supported_channels (const channels_type &new_channels)
 Helper method to set the supported channels option. More...
 
void edca_parameter_set (uint32_t ac_be, uint32_t ac_bk, uint32_t ac_vi, uint32_t ac_vo)
 Helper method to set the EDCA Parameter Set. More...
 
void request_information (const request_info_type elements)
 Helper method to set the Request Information element tagged option. More...
 
void fh_parameter_set (const fh_params_set &fh_params)
 Helper method to set the FH parameter set tagged option. More...
 
void ds_parameter_set (uint8_t current_channel)
 Helper method to set the DS parameter tagged option. More...
 
void cf_parameter_set (const cf_params_set &params)
 Helper method to set the CF parameter set tagged option. More...
 
void ibss_parameter_set (uint16_t atim_window)
 Helper method to set the IBSS parameter set tagged option. More...
 
void ibss_dfs (const ibss_dfs_params &params)
 Helper method to set the IBSS DFS tagged option. More...
 
void country (const country_params &params)
 Helper method to set the country tagged option. More...
 
void fh_parameters (uint8_t prime_radix, uint8_t number_channels)
 Helper method to set the FH parameters set tagged option. More...
 
void fh_pattern_table (const fh_pattern_type &params)
 Helper method to set the FH pattern table tagged option. More...
 
void power_constraint (uint8_t local_power_constraint)
 Helper method to set the Power Constraint tagged option. More...
 
void channel_switch (const channel_switch_type &data)
 Helper method to set the Channel Switch tagged option. More...
 
void quiet (const quiet_type &data)
 Helper method to set the Quiet tagged option. More...
 
void tpc_report (uint8_t transmit_power, uint8_t link_margin)
 Helper method to set the TPC Report tagged option. More...
 
void erp_information (uint8_t value)
 Helper method to set the ERP Information tagged option. More...
 
void bss_load (const bss_load_type &data)
 Helper method to set the BSS Load tagged option. More...
 
void tim (const tim_type &data)
 Helper method to set the TIM tagged option. More...
 
void challenge_text (const std::string &text)
 Helper method to set the Challenge Text tagged option. More...
 
void vendor_specific (const vendor_specific_type &data)
 Helper method to add a Vendor Specific tagged option. More...
 
RSNInformation rsn_information () const
 Helper method to search for this PDU's rsn information option. More...
 
std::string ssid () const
 Helper method to search for this PDU's SSID. More...
 
rates_type supported_rates () const
 Helper method to get the supported rates. More...
 
rates_type extended_supported_rates () const
 Helper method to get the extended supported rates. More...
 
qos_capability_type qos_capability () const
 Helper method to get the QOS capability. More...
 
std::pair< uint8_t, uint8_t > power_capability () const
 Helper method to get the power capability. More...
 
channels_type supported_channels () const
 Helper method to get the supported channels. More...
 
request_info_type request_information () const
 Helper method to get the request information. More...
 
fh_params_set fh_parameter_set () const
 Helper method to get the fh parameter set. More...
 
uint8_t ds_parameter_set () const
 Helper method to get the DSSS parameter set. More...
 
cf_params_set cf_parameter_set () const
 Helper method to get the CF parameter set. More...
 
uint16_t ibss_parameter_set () const
 Helper method to get the ibss parameter set. More...
 
ibss_dfs_params ibss_dfs () const
 Helper method to get the ibss dfs. More...
 
country_params country () const
 Helper method to get the country option. More...
 
std::pair< uint8_t, uint8_t > fh_parameters () const
 Helper method to get the fh parameters option. More...
 
fh_pattern_type fh_pattern_table () const
 Helper method to get the fh patterns option. More...
 
uint8_t power_constraint () const
 Helper method to get the power constraint option. More...
 
channel_switch_type channel_switch () const
 Helper method to get the channel switch option. More...
 
quiet_type quiet () const
 Helper method to get the quiet option. More...
 
std::pair< uint8_t, uint8_t > tpc_report () const
 Helper method to get the tpc report option. More...
 
uint8_t erp_information () const
 Helper method to get the erp information option. More...
 
bss_load_type bss_load () const
 Helper method to get the bss load option. More...
 
tim_type tim () const
 Helper method to get the tim option. More...
 
std::string challenge_text () const
 Helper method to get the challenge text option. More...
 
vendor_specific_type vendor_specific () const
 Helper method to get a Vendor Specific option. More...
 
uint32_t header_size () const
 Returns the 802.11 frame's header length. More...
 
PDUType pdu_type () const
 Getter for the PDU's type. More...
 
bool matches_flag (PDUType flag) const
 Check whether this PDU matches the specified flag. More...
 
- Public Member Functions inherited from Tins::Dot11
 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 > 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 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...
 
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 optionsearch_option (OptionTypes type) const
 Looks up a tagged option in the option list. More...
 
const options_typeoptions () const
 Getter for the option list. More...
 
- Public Member Functions inherited from Tins::PDU
 PDU ()
 Default constructor.
 
 PDU (PDU &&rhs) TINS_NOEXCEPT
 Move constructor. More...
 
PDUoperator= (PDU &&rhs) TINS_NOEXCEPT
 Move assignment operator. More...
 
virtual ~PDU ()
 PDU destructor. 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...
 
PDUinner_pdu () const
 Getter for the inner PDU. More...
 
PDUrelease_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 PDUrecv_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...
 

Static Public Attributes

static const PDU::PDUType pdu_flag = PDU::DOT11_BEACON
 This PDU's flag.
 
- Static Public Attributes inherited from Tins::Dot11ManagementFrame
static const PDU::PDUType pdu_flag = PDU::DOT11_MANAGEMENT
 
- Static Public Attributes inherited from Tins::Dot11
static const PDU::PDUType pdu_flag = PDU::DOT11
 This PDU's flag.
 
static const address_type BROADCAST
 Broadcast hardware address.
 
static const endian_type endianness = LE
 
- Static Public Attributes inherited from Tins::PDU
static const endian_type endianness = BE
 

Additional Inherited Members

- Public Types inherited from Tins::Dot11ManagementFrame
enum  ReasonCodes {
  UNSPECIFIED = 1, PREV_AUTH_NOT_VALID = 2, STA_LEAVING_IBSS_ESS = 3, INACTIVITY = 4,
  CANT_HANDLE_STA = 5, CLASS2_FROM_NO_AUTH = 6, CLASS3_FROM_NO_AUTH = 7, STA_LEAVING_BSS = 8,
  STA_NOT_AUTH_WITH_STA = 9, POW_CAP_NOT_VALID = 10, SUPPORTED_CHANN_NOT_VALID = 11, INVALID_CONTENT = 13,
  MIC_FAIL = 14, HANDSHAKE_TIMEOUT = 15, GROUP_KEY_TIMEOUT = 16, WRONG_HANDSHAKE = 17,
  INVALID_GROUP_CIPHER = 18, INVALID_PAIRWISE_CIPHER = 19, INVALID_AKMP = 20, UNSOPPORTED_RSN_VERSION = 21,
  INVALID_RSN_CAPABILITIES = 22, AUTH_FAILED = 23, CIPHER_SUITE_REJECTED = 24, UNSPECIFIED_QOS_REASON = 32,
  NOT_ENOUGH_BANDWITH = 33, POOR_CHANNEL = 34, STA_OUT_OF_LIMITS = 35, REQUESTED_BY_STA_LEAVING = 36,
  REQUESTED_BY_STA_REJECT_MECHANISM = 37, REQUESTED_BY_STA_REJECT_SETUP = 38, REQUESTED_BY_STA_TIMEOUT = 39, PEER_STA_NOT_SUPPORT_CIPHER = 45
}
 Enum used in the reason code field. More...
 
enum  MapMask {
  BSS = 0x1, OFDM_PREAMBLE = 0x2, UNIDENTIFIED_SIGNAL = 0x4, RADAR = 0x8,
  UNMEASURED = 0x10, RESERVED = 0xE0
}
 Enum that represents the map field within a channels map field. More...
 
typedef std::vector< float > rates_type
 
typedef std::vector< std::pair
< uint8_t, uint8_t > > 
channels_type
 
typedef std::vector< std::pair
< uint8_t, uint8_t > > 
channel_map_type
 
typedef std::vector< uint8_t > request_info_type
 
typedef uint8_t qos_capability_type
 
- Public Types inherited from Tins::Dot11
enum  Types { MANAGEMENT = 0, CONTROL = 1, DATA = 2 }
 Enum for the different types of 802.11 frames.
 
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, QOS_CAPABILITY = 46, RSN = 48,
  EXT_SUPPORTED_RATES = 50, 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.
 
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.
 
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.
 
typedef HWAddress< 6 > address_type
 
typedef PDUOption< uint8_t, Dot11option
 IEEE 802.11 options struct.
 
typedef std::list< optionoptions_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
 
- Static Public Member Functions inherited from Tins::Dot11
static Dot11from_bytes (const uint8_t *buffer, uint32_t total_sz)
 Allocates an Dot11 PDU from a buffer. More...
 
- Public Attributes inherited from Tins::Dot11ManagementFrame
TINS_BEGIN_PACK class
Tins::Dot11ManagementFrame::capability_information 
TINS_END_PACK
 
- Protected Member Functions inherited from Tins::Dot11ManagementFrame
 Dot11ManagementFrame (const address_type &dst_hw_addr=address_type(), const address_type &src_hw_addr=address_type())
 
 Dot11ManagementFrame (const uint8_t *buffer, uint32_t total_sz)
 Constructs a Dot11ManagementFrame object from a buffer and adds all identifiable PDUs found in the buffer as children of this one. More...
 
void write_ext_header (Memory::OutputMemoryStream &stream)
 
uint32_t management_frame_size ()
 
- Protected Member Functions inherited from Tins::Dot11
void parse_tagged_parameters (Memory::InputMemoryStream &stream)
 
void add_tagged_option (OptionTypes opt, uint8_t len, const uint8_t *val)
 
- Protected Member Functions inherited from Tins::PDU
 PDU (const PDU &other)
 Copy constructor.
 
PDUoperator= (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 (const PDU *parent)
 Prepares this PDU for serialization. More...
 
void serialize (uint8_t *buffer, uint32_t total_sz, const PDU *parent)
 Serializes this PDU and propagates this action to child PDUs. More...
 
- Protected Attributes inherited from Tins::Dot11ManagementFrame
TINS_BEGIN_PACK struct
Tins::Dot11ManagementFrame::dot11_extended_header 
TINS_END_PACK
 
- Protected Attributes inherited from Tins::Dot11
TINS_BEGIN_PACK struct
Tins::Dot11::dot11_header 
TINS_END_PACK
 

Detailed Description

Represents an IEEE 802.11 Beacon.

Constructor & Destructor Documentation

Tins::Dot11Beacon::Dot11Beacon ( const address_type dst_hw_addr = address_type(),
const address_type src_hw_addr = address_type() 
)

Constructor for creating a 802.11 Beacon.

Constructs a 802.11 Beacon taking destination and source hardware address.

Parameters
dst_hw_addrThe destination hardware address.
src_hw_addrThe source hardware address.
Tins::Dot11Beacon::Dot11Beacon ( const uint8_t *  buffer,
uint32_t  total_sz 
)

Constructs a Dot11Beacon object 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 the header in the buffer or the input data is malformed, a malformed_packet exception is thrown.

Parameters
bufferThe buffer from which this PDU will be constructed.
total_szThe total size of the buffer.

Member Function Documentation

const capability_information& Tins::Dot11Beacon::capabilities ( ) const
inline

Getter for the Capabilities Information structure.

Returns
A constant refereence to the stored Capabilities Information field.
capability_information& Tins::Dot11Beacon::capabilities ( )
inline

Getter for the Capabilities Information.

Returns
A refereence to the stored Capabilities Information field.
Dot11Beacon* Tins::Dot11Beacon::clone ( ) const
inlinevirtual

Clones this PDU.

See Also
PDU::clone

Reimplemented from Tins::Dot11.

uint32_t Tins::Dot11Beacon::header_size ( ) const
virtual

Returns the frame's header length.

Returns
An uint32_t with the header's size.
See Also
PDU::header_size()

Reimplemented from Tins::Dot11.

uint16_t Tins::Dot11Beacon::interval ( ) const
inline

Getter for the interval field.

Returns
The stored interval value.
void Tins::Dot11Beacon::interval ( uint16_t  new_interval)

Setter for the interval field.

Parameters
new_intervalThe interval to be set.
bool Tins::Dot11Beacon::matches_flag ( PDUType  flag) const
inlinevirtual

Check whether this PDU matches the specified flag.

Parameters
flagThe flag to match
See Also
PDU::matches_flag

Reimplemented from Tins::Dot11.

PDUType Tins::Dot11Beacon::pdu_type ( ) const
inlinevirtual

Getter for the PDU's type.

See Also
PDU::pdu_type

Reimplemented from Tins::Dot11.

uint64_t Tins::Dot11Beacon::timestamp ( ) const
inline

Getter for the timestamp field.

Returns
The stored timestamp value.
void Tins::Dot11Beacon::timestamp ( uint64_t  new_timestamp)

Setter for the timestamp field.

Parameters
new_timestampThe timestamp to be set.

The documentation for this class was generated from the following file: