mirror of
https://github.com/mfontanini/libtins
synced 2026-01-28 12:44:25 +01:00
Merge branch 'master' of ssh://git.code.sf.net/p/libtins/code
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#ifndef __IEEE802_11_h
|
||||
#define __IEEE802_11_h
|
||||
|
||||
#include <list>
|
||||
#include <stdint.h>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -46,6 +47,45 @@ namespace Tins {
|
||||
CONTROL = 1,
|
||||
DATA = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Enum for the different types of tagged options.
|
||||
*/
|
||||
enum TaggedOption {
|
||||
SSID,
|
||||
SUPPORTED_RATES,
|
||||
FH_SET,
|
||||
DS_SET,
|
||||
CF_SET,
|
||||
TIM,
|
||||
BSS,
|
||||
COUNTRY,
|
||||
HOPPING_PATTERN_PARAMS,
|
||||
HOPPING_PATTERN_TABLE,
|
||||
REQUEST,
|
||||
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
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Enum for the different subtypes of 802.11 management frames.
|
||||
@@ -93,6 +133,35 @@ namespace Tins {
|
||||
CF_ACK_POLL = 7
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief IEEE 802.11 options struct.
|
||||
*/
|
||||
struct IEEE802_11_Option {
|
||||
/**
|
||||
* \brief The option number.
|
||||
*/
|
||||
uint8_t option;
|
||||
/**
|
||||
* \brief The value's length in bytes.
|
||||
*/
|
||||
uint8_t length;
|
||||
/**
|
||||
* \brief The option's value.
|
||||
*/
|
||||
uint8_t *value;
|
||||
|
||||
/**
|
||||
* \brief Creates an instance of IEEE802_11_Option.
|
||||
*
|
||||
* The option's value is copied, therefore the user should
|
||||
* manually free any memory pointed by the "val" parameter.
|
||||
* \param opt The option number.
|
||||
* \param len The length of the option's value in bytes.
|
||||
* \param val The option's value.
|
||||
*/
|
||||
IEEE802_11_Option(uint8_t opt, uint8_t len, const uint8_t *val);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 PDU
|
||||
*
|
||||
@@ -137,7 +206,14 @@ namespace Tins {
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
IEEE802_11(const uint8_t *buffer, uint32_t total_sz);
|
||||
|
||||
|
||||
/**
|
||||
* \brief IEEE802_11 destructor.
|
||||
*
|
||||
* Releases the memory allocated for tagged options.
|
||||
*/
|
||||
~IEEE802_11();
|
||||
|
||||
/**
|
||||
* \brief Getter for the protocol version.
|
||||
*
|
||||
@@ -410,12 +486,24 @@ namespace Tins {
|
||||
* \sa PDU::send()
|
||||
*/
|
||||
bool send(PacketSender* sender);
|
||||
|
||||
/**
|
||||
* \brief Adds a new option to this IEEE802_11 PDU.
|
||||
*
|
||||
* This copies the value buffer.
|
||||
* \param opt The option identifier.
|
||||
* \param len The length of the value field.
|
||||
* \param val The value of this option.
|
||||
*/
|
||||
void add_tagged_option(TaggedOption opt, uint8_t len, const uint8_t *val);
|
||||
|
||||
/**
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return PDU::IEEE802_11; }
|
||||
protected:
|
||||
virtual size_t write_fixed_parameters(uint8_t *buffer, uint32_t total_sz) { return 0; }
|
||||
private:
|
||||
/**
|
||||
* Struct that represents the 802.11 header
|
||||
@@ -465,11 +553,14 @@ namespace Tins {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
IEEE802_11(const ieee80211_header *header_ptr);
|
||||
|
||||
|
||||
void write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *parent);
|
||||
|
||||
|
||||
ieee80211_header _header;
|
||||
uint8_t _opt_addr[6];
|
||||
uint32_t _iface_index;
|
||||
uint32_t _iface_index, _options_size;
|
||||
std::list<IEEE802_11_Option> _options;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user