mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 05:24:26 +01:00
RadioTap and Dot11 now use HWAddress.
This commit is contained in:
267
include/dot11.h
267
include/dot11.h
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "pdu.h"
|
||||
#include "utils.h"
|
||||
#include "hwaddress.h"
|
||||
|
||||
namespace Tins {
|
||||
|
||||
@@ -37,6 +38,8 @@ namespace Tins {
|
||||
*/
|
||||
class Dot11 : public PDU {
|
||||
public:
|
||||
typedef HWAddress<6> address_type;
|
||||
|
||||
/**
|
||||
* \brief This PDU's flag.
|
||||
*/
|
||||
@@ -205,7 +208,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11(const uint8_t* dst_hw_addr = 0, PDU* child = 0);
|
||||
Dot11(const address_type &dst_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 PDU
|
||||
@@ -217,7 +221,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11(const std::string& iface, const uint8_t* dst_hw_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 PDU
|
||||
@@ -229,7 +235,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11(uint32_t iface_index, const uint8_t* dst_hw_addr = 0, PDU* child = 0);
|
||||
Dot11(uint32_t iface_index,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 object from a buffer and adds all identifiable
|
||||
@@ -338,7 +346,7 @@ namespace Tins {
|
||||
*
|
||||
* \return The first address as a constant uint8_t pointer.
|
||||
*/
|
||||
inline const uint8_t* addr1() const { return this->_header.addr1; }
|
||||
inline address_type addr1() const { return this->_header.addr1; }
|
||||
|
||||
/**
|
||||
* \brief Getter for the interface.
|
||||
@@ -429,7 +437,7 @@ namespace Tins {
|
||||
*
|
||||
* \param new_addr1 const uint8_t array of 6 bytes containing the new first's address.
|
||||
*/
|
||||
void addr1(const uint8_t* new_addr1);
|
||||
void addr1(const address_type &new_addr1);
|
||||
|
||||
/**
|
||||
* \brief Setter for the interface.
|
||||
@@ -443,7 +451,7 @@ namespace Tins {
|
||||
*
|
||||
* \param new_iface string reference containing the new interface name.
|
||||
*/
|
||||
void iface(const std::string& new_iface) throw (std::runtime_error);
|
||||
void iface(const std::string& new_iface);
|
||||
|
||||
/* Virtual methods */
|
||||
/**
|
||||
@@ -536,7 +544,7 @@ namespace Tins {
|
||||
#endif
|
||||
} __attribute__((__packed__)) control;
|
||||
uint16_t duration_id;
|
||||
uint8_t addr1[ADDR_SIZE];
|
||||
uint8_t addr1[address_type::address_size];
|
||||
|
||||
} __attribute__((__packed__));
|
||||
private:
|
||||
@@ -953,14 +961,14 @@ namespace Tins {
|
||||
*
|
||||
* \return The second address as a constant uint8_t pointer.
|
||||
*/
|
||||
inline const uint8_t* addr2() const { return this->_ext_header.addr2; }
|
||||
inline address_type addr2() const { return this->_ext_header.addr2; }
|
||||
|
||||
/**
|
||||
* \brief Getter for the third address.
|
||||
*
|
||||
* \return The third address as a constant uint8_t pointer.
|
||||
*/
|
||||
inline const uint8_t* addr3() const { return this->_ext_header.addr3; }
|
||||
inline address_type addr3() const { return this->_ext_header.addr3; }
|
||||
|
||||
/**
|
||||
* \brief Getter for the fragment number.
|
||||
@@ -988,14 +996,14 @@ namespace Tins {
|
||||
*
|
||||
* \param new_addr2 const uint8_t array of 6 bytes containing the new second's address.
|
||||
*/
|
||||
void addr2(const uint8_t* new_addr2);
|
||||
void addr2(const address_type &new_addr2);
|
||||
|
||||
/**
|
||||
* \brief Setter for the third address.
|
||||
*
|
||||
* \param new_addr3 const uint8_t array of 6 bytes containing the new third address.
|
||||
*/
|
||||
void addr3(const uint8_t* new_addr3);
|
||||
void addr3(const address_type &new_addr3);
|
||||
|
||||
/**
|
||||
* \brief Setter for the fragment number.
|
||||
@@ -1062,8 +1070,11 @@ namespace Tins {
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11ManagementFrame(const uint8_t *dst_hw_addr = 0, const uint8_t *src_hw_addr = 0);
|
||||
Dot11ManagementFrame(const std::string &iface, const uint8_t *dst_hw_addr, const uint8_t *src_hw_addr) throw (std::runtime_error);
|
||||
Dot11ManagementFrame(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
Dot11ManagementFrame(const std::string &iface,
|
||||
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);
|
||||
Dot11ManagementFrame(const Dot11ManagementFrame& other);
|
||||
|
||||
@@ -1302,7 +1313,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Beacon(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11Beacon(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Beacon.
|
||||
@@ -1314,7 +1326,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Beacon(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11Beacon(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11Beacon object from a buffer and adds
|
||||
@@ -1615,7 +1629,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Disassoc(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11Disassoc(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Disassociation.
|
||||
@@ -1627,7 +1642,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Disassoc(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11Disassoc(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11Disassoc object from a buffer and adds
|
||||
@@ -1708,7 +1725,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11AssocRequest(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11AssocRequest(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Association Request.
|
||||
@@ -1720,7 +1738,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11AssocRequest(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11AssocRequest(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11AssocRequest object from a
|
||||
@@ -1866,7 +1886,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11AssocResponse(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11AssocResponse(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Association Response.
|
||||
@@ -1878,7 +1899,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11AssocResponse(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11AssocResponse(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11AssocResponse object from a
|
||||
@@ -2013,7 +2036,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ReAssocRequest(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11ReAssocRequest(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 ReAssociation Request.
|
||||
@@ -2025,7 +2049,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ReAssocRequest(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11ReAssocRequest(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11AssocRequest object from a
|
||||
@@ -2186,7 +2212,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ReAssocResponse(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11ReAssocResponse(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Association Response.
|
||||
@@ -2198,7 +2225,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ReAssocResponse(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11ReAssocResponse(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11ReAssocResponse object from a
|
||||
@@ -2333,7 +2362,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Authentication(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11Authentication(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Authentication.
|
||||
@@ -2345,7 +2375,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Authentication(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11Authentication(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11Authentication object from a
|
||||
@@ -2465,7 +2497,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Deauthentication(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11Deauthentication(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Deauthentication.
|
||||
@@ -2477,7 +2510,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11Deauthentication(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11Deauthentication(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11Deauthentication object from a buffer and adds
|
||||
@@ -2558,7 +2593,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ProbeRequest(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11ProbeRequest(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Probe Request.
|
||||
@@ -2570,7 +2606,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ProbeRequest(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11ProbeRequest(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11ProbeRequest object from a
|
||||
@@ -2650,7 +2688,8 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ProbeResponse(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0);
|
||||
Dot11ProbeResponse(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Probe Response.
|
||||
@@ -2662,7 +2701,9 @@ namespace Tins {
|
||||
* \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
*/
|
||||
Dot11ProbeResponse(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0) throw (std::runtime_error);
|
||||
Dot11ProbeResponse(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11ProbeResponse object from a
|
||||
@@ -2932,23 +2973,32 @@ namespace Tins {
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11Data(uint32_t iface_index, const uint8_t *dst_hw_addr = 0, const uint8_t *src_hw_addr = 0, PDU* child = 0);
|
||||
Dot11Data(const uint8_t *dst_hw_addr = 0, const uint8_t *src_hw_addr = 0, PDU* child = 0);
|
||||
Dot11Data(const std::string &iface, const uint8_t *dst_hw_addr, const uint8_t *src_hw_addr, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11Data(uint32_t iface_index,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
Dot11Data(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
Dot11Data(const std::string &iface, const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr, PDU* child = 0);
|
||||
|
||||
Dot11Data(const uint8_t *buffer, uint32_t total_sz);
|
||||
/**
|
||||
* \brief Getter for the second address.
|
||||
*
|
||||
* \return The second address as a constant uint8_t pointer.
|
||||
*/
|
||||
inline const uint8_t* addr2() const { return this->_ext_header.addr2; }
|
||||
inline address_type addr2() const { return this->_ext_header.addr2; }
|
||||
|
||||
/**
|
||||
* \brief Getter for the third address.
|
||||
*
|
||||
* \return The third address as a constant uint8_t pointer.
|
||||
*/
|
||||
inline const uint8_t* addr3() const { return this->_ext_header.addr3; }
|
||||
inline address_type addr3() const { return this->_ext_header.addr3; }
|
||||
|
||||
/**
|
||||
* \brief Getter for the fragment number.
|
||||
@@ -2976,14 +3026,14 @@ namespace Tins {
|
||||
*
|
||||
* \param new_addr2 const uint8_t array of 6 bytes containing the new second's address.
|
||||
*/
|
||||
void addr2(const uint8_t* new_addr2);
|
||||
void addr2(const address_type &new_addr2);
|
||||
|
||||
/**
|
||||
* \brief Setter for the third address.
|
||||
*
|
||||
* \param new_addr3 const uint8_t array of 6 bytes containing the new third address.
|
||||
*/
|
||||
void addr3(const uint8_t* new_addr3);
|
||||
void addr3(const address_type &new_addr3);
|
||||
|
||||
/**
|
||||
* \brief Setter for the fragment number.
|
||||
@@ -3075,7 +3125,9 @@ namespace Tins {
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11QoSData(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0, PDU* child = 0);
|
||||
Dot11QoSData(const address_type &dst_hw_addr = 0,
|
||||
const address_type &src_hw_addr = 0,
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 QoS Data PDU
|
||||
@@ -3088,7 +3140,10 @@ namespace Tins {
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11QoSData(const std::string& iface, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11QoSData(const std::string& iface,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 QoS Data PDU
|
||||
@@ -3101,7 +3156,10 @@ namespace Tins {
|
||||
* \param src_hw_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11QoSData(uint32_t iface_index, const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0, PDU* child = 0);
|
||||
Dot11QoSData(uint32_t iface_index,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 QoS Data object from a buffer and adds all identifiable
|
||||
@@ -3190,7 +3248,8 @@ namespace Tins {
|
||||
* \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11Control(const uint8_t* dst_addr = 0, PDU* child = 0);
|
||||
Dot11Control(const address_type &dst_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 control frame PDU
|
||||
@@ -3202,7 +3261,9 @@ namespace Tins {
|
||||
* \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11Control(const std::string& iface, const uint8_t* dst_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11Control(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 control frame PDU
|
||||
@@ -3214,7 +3275,9 @@ namespace Tins {
|
||||
* \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11Control(uint32_t iface_index, const uint8_t* dst_addr = 0, PDU* child = 0);
|
||||
Dot11Control(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 control frame object from a buffer and
|
||||
@@ -3255,7 +3318,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11ControlTA(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11ControlTA(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 control frame TA PDU
|
||||
@@ -3268,7 +3333,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11ControlTA(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11ControlTA(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 control frame TA PDU
|
||||
@@ -3281,7 +3349,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11ControlTA(uint32_t iface_index, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0);
|
||||
Dot11ControlTA(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 control frame object from a buffer and
|
||||
@@ -3294,13 +3365,13 @@ namespace Tins {
|
||||
/**
|
||||
* \brief Getter for the target address field.
|
||||
*/
|
||||
inline const uint8_t* target_addr() const { return _taddr; }
|
||||
inline address_type target_addr() const { return _taddr; }
|
||||
|
||||
/**
|
||||
* \brief Setter for the target address field.
|
||||
* \param addr The new target address.
|
||||
*/
|
||||
void target_addr(const uint8_t *addr);
|
||||
void target_addr(const address_type &addr);
|
||||
|
||||
/**
|
||||
* \brief Returns the 802.11 frame's header length.
|
||||
@@ -3337,7 +3408,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11RTS(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11RTS(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 RTS frame PDU
|
||||
@@ -3350,7 +3423,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11RTS(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11RTS(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 RTS frame PDU
|
||||
@@ -3363,7 +3439,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11RTS(uint32_t iface_index, const uint8_t* dst_hw_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0);
|
||||
Dot11RTS(uint32_t iface_index,
|
||||
const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 RTS frame object from a buffer and
|
||||
@@ -3412,7 +3491,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11PSPoll(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11PSPoll(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 PS-Poll frame PDU
|
||||
@@ -3425,7 +3506,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11PSPoll(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11PSPoll(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 PS-Poll frame PDU
|
||||
@@ -3438,7 +3522,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11PSPoll(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child);
|
||||
Dot11PSPoll(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 PS-Poll frame object from a buffer and
|
||||
@@ -3487,7 +3574,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11CFEnd(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11CFEnd(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 CF-End frame PDU
|
||||
@@ -3500,7 +3589,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11CFEnd(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11CFEnd(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 CF-End frame PDU
|
||||
@@ -3513,7 +3605,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11CFEnd(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child);
|
||||
Dot11CFEnd(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 CF-End frame object from a buffer and
|
||||
@@ -3561,7 +3656,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11EndCFAck(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11EndCFAck(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 End-CF-Ack frame PDU
|
||||
@@ -3573,7 +3670,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11EndCFAck(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11EndCFAck(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 End-CF-Ack frame PDU
|
||||
@@ -3585,7 +3685,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11EndCFAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child);
|
||||
Dot11EndCFAck(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 End-CF-Ack frame object from a buffer and
|
||||
@@ -3633,7 +3736,7 @@ namespace Tins {
|
||||
* \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11Ack(const uint8_t* dst_addr = 0, PDU* child = 0);
|
||||
Dot11Ack(const address_type &dst_addr = address_type(), PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Ack frame PDU
|
||||
@@ -3645,7 +3748,9 @@ namespace Tins {
|
||||
* \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11Ack(const std::string& iface, const uint8_t* dst_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11Ack(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 Ack frame PDU
|
||||
@@ -3658,7 +3763,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11Ack(uint32_t iface_index, const uint8_t* dst_addr, PDU* child);
|
||||
Dot11Ack(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 Ack frame object from a buffer and
|
||||
@@ -3709,7 +3816,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11BlockAckRequest(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11BlockAckRequest(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Block Ack request frame PDU
|
||||
@@ -3721,7 +3830,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11BlockAckRequest(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11BlockAckRequest(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 Block Ack request frame PDU
|
||||
@@ -3733,7 +3845,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11BlockAckRequest(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child);
|
||||
Dot11BlockAckRequest(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 Block Ack request frame object from a buffer and
|
||||
@@ -3836,7 +3951,9 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11BlockAck(const uint8_t* dst_addr = 0, const uint8_t* target_addr = 0, PDU* child = 0);
|
||||
Dot11BlockAck(const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating a 802.11 Block Ack frame PDU
|
||||
@@ -3848,7 +3965,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11BlockAck(const std::string& iface, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0) throw (std::runtime_error);
|
||||
Dot11BlockAck(const std::string& iface,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 Block Ack frame PDU
|
||||
@@ -3860,7 +3980,10 @@ namespace Tins {
|
||||
* \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional).
|
||||
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
|
||||
*/
|
||||
Dot11BlockAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child);
|
||||
Dot11BlockAck(uint32_t iface_index,
|
||||
const address_type &dst_addr = address_type(),
|
||||
const address_type &target_addr = address_type(),
|
||||
PDU* child = 0);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an 802.11 Block Ack request frame object from a buffer and
|
||||
|
||||
456
src/dot11.cpp
456
src/dot11.cpp
@@ -42,32 +42,41 @@ using namespace std;
|
||||
const uint8_t *Tins::Dot11::BROADCAST = (const uint8_t*)"\xff\xff\xff\xff\xff\xff";
|
||||
const uint32_t Tins::Dot11::ADDR_SIZE;
|
||||
|
||||
Tins::Dot11::Dot11(const uint8_t* dst_hw_addr, PDU* child) : PDU(ETHERTYPE_IP, child), _options_size(0) {
|
||||
Tins::Dot11::Dot11(const address_type &dst_hw_addr, PDU* child)
|
||||
: PDU(ETHERTYPE_IP, child), _options_size(0)
|
||||
{
|
||||
memset(&this->_header, 0, sizeof(ieee80211_header));
|
||||
if(dst_hw_addr)
|
||||
this->addr1(dst_hw_addr);
|
||||
addr1(dst_hw_addr);
|
||||
}
|
||||
|
||||
Tins::Dot11::Dot11(const std::string& iface, const uint8_t* dst_hw_addr, PDU* child) throw (std::runtime_error) : PDU(ETHERTYPE_IP, child), _options_size(0) {
|
||||
memset(&this->_header, 0, sizeof(ieee80211_header));
|
||||
if(dst_hw_addr)
|
||||
this->addr1(dst_hw_addr);
|
||||
Tins::Dot11::Dot11(const std::string& iface,
|
||||
const address_type &dst_hw_addr, PDU* child)
|
||||
: PDU(ETHERTYPE_IP, child), _options_size(0)
|
||||
{
|
||||
memset(&_header, 0, sizeof(ieee80211_header));
|
||||
addr1(dst_hw_addr);
|
||||
this->iface(iface);
|
||||
}
|
||||
|
||||
|
||||
Tins::Dot11::Dot11(uint32_t iface_index, const uint8_t* dst_hw_addr, PDU* child) : PDU(ETHERTYPE_IP, child), _options_size(0) {
|
||||
memset(&this->_header, 0, sizeof(ieee80211_header));
|
||||
if(dst_hw_addr)
|
||||
this->addr1(dst_hw_addr);
|
||||
Tins::Dot11::Dot11(uint32_t iface_index,
|
||||
const address_type &dst_hw_addr, PDU* child)
|
||||
: PDU(ETHERTYPE_IP, child), _options_size(0)
|
||||
{
|
||||
memset(&_header, 0, sizeof(ieee80211_header));
|
||||
addr1(dst_hw_addr);
|
||||
this->iface(iface_index);
|
||||
}
|
||||
|
||||
Tins::Dot11::Dot11(const ieee80211_header *header_ptr) : PDU(ETHERTYPE_IP) {
|
||||
Tins::Dot11::Dot11(const ieee80211_header *header_ptr)
|
||||
: PDU(ETHERTYPE_IP)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Tins::Dot11::Dot11(const uint8_t *buffer, uint32_t total_sz) : PDU(ETHERTYPE_IP), _options_size(0) {
|
||||
Tins::Dot11::Dot11(const uint8_t *buffer, uint32_t total_sz)
|
||||
: PDU(ETHERTYPE_IP), _options_size(0)
|
||||
{
|
||||
if(total_sz < sizeof(_header.control))
|
||||
throw std::runtime_error("Not enough size for an IEEE 802.11 header in the buffer.");
|
||||
uint32_t sz = std::min((uint32_t)sizeof(_header), total_sz);
|
||||
@@ -170,15 +179,16 @@ void Tins::Dot11::duration_id(uint16_t new_duration_id) {
|
||||
this->_header.duration_id = new_duration_id;
|
||||
}
|
||||
|
||||
void Tins::Dot11::addr1(const uint8_t* new_addr1) {
|
||||
memcpy(this->_header.addr1, new_addr1, 6);
|
||||
void Tins::Dot11::addr1(const address_type &new_addr1) {
|
||||
//memcpy(this->_header.addr1, new_addr1, 6);
|
||||
std::copy(new_addr1.begin(), new_addr1.end(), _header.addr1);
|
||||
}
|
||||
|
||||
void Tins::Dot11::iface(uint32_t new_iface_index) {
|
||||
this->_iface_index = new_iface_index;
|
||||
}
|
||||
|
||||
void Tins::Dot11::iface(const std::string& new_iface) throw (std::runtime_error) {
|
||||
void Tins::Dot11::iface(const std::string& new_iface) {
|
||||
if (!Tins::Utils::interface_id(new_iface, this->_iface_index)) {
|
||||
throw std::runtime_error("Invalid interface name!");
|
||||
}
|
||||
@@ -283,22 +293,20 @@ Tins::Dot11ManagementFrame::Dot11ManagementFrame(const uint8_t *buffer, uint32_t
|
||||
std::memcpy(_addr4, buffer + sizeof(_ext_header), sizeof(_addr4));
|
||||
}
|
||||
|
||||
Tins::Dot11ManagementFrame::Dot11ManagementFrame(const uint8_t *dst_hw_addr, const uint8_t *src_hw_addr) : Dot11(dst_hw_addr) {
|
||||
this->type(Dot11::MANAGEMENT);
|
||||
if(src_hw_addr)
|
||||
addr2(src_hw_addr);
|
||||
else
|
||||
std::memset(_ext_header.addr2, 0, sizeof(_ext_header.addr2));
|
||||
Tins::Dot11ManagementFrame::Dot11ManagementFrame(
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11(dst_hw_addr)
|
||||
{
|
||||
type(Dot11::MANAGEMENT);
|
||||
addr2(src_hw_addr);
|
||||
}
|
||||
|
||||
Tins::Dot11ManagementFrame::Dot11ManagementFrame(const std::string &iface,
|
||||
const uint8_t *dst_hw_addr,
|
||||
const uint8_t *src_hw_addr) throw (std::runtime_error) : Dot11(iface, dst_hw_addr) {
|
||||
this->type(Dot11::MANAGEMENT);
|
||||
if(src_hw_addr)
|
||||
addr2(src_hw_addr);
|
||||
else
|
||||
std::memset(_ext_header.addr2, 0, sizeof(_ext_header.addr2));
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11(iface, dst_hw_addr)
|
||||
{
|
||||
type(Dot11::MANAGEMENT);
|
||||
addr2(src_hw_addr);
|
||||
}
|
||||
|
||||
Tins::Dot11ManagementFrame::Dot11ManagementFrame(const Dot11ManagementFrame &other) : Dot11(other) {
|
||||
@@ -318,12 +326,14 @@ uint32_t Tins::Dot11ManagementFrame::header_size() const {
|
||||
return sz;
|
||||
}
|
||||
|
||||
void Tins::Dot11ManagementFrame::addr2(const uint8_t* new_addr2) {
|
||||
memcpy(this->_ext_header.addr2, new_addr2, 6);
|
||||
void Tins::Dot11ManagementFrame::addr2(const address_type &new_addr2) {
|
||||
//memcpy(this->_ext_header.addr2, new_addr2, 6);
|
||||
std::copy(new_addr2.begin(), new_addr2.end(), _ext_header.addr2);
|
||||
}
|
||||
|
||||
void Tins::Dot11ManagementFrame::addr3(const uint8_t* new_addr3) {
|
||||
memcpy(this->_ext_header.addr3, new_addr3, 6);
|
||||
void Tins::Dot11ManagementFrame::addr3(const address_type &new_addr3) {
|
||||
//memcpy(this->_ext_header.addr3, new_addr3, 6);
|
||||
std::copy(new_addr3.begin(), new_addr3.end(), _ext_header.addr3);
|
||||
}
|
||||
|
||||
void Tins::Dot11ManagementFrame::frag_num(uint8_t new_frag_num) {
|
||||
@@ -611,19 +621,24 @@ void Tins::Dot11ManagementFrame::challenge_text(uint8_t* ch_text, uint8_t ch_tex
|
||||
|
||||
/* Dot11Beacon */
|
||||
|
||||
Tins::Dot11Beacon::Dot11Beacon(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame() {
|
||||
this->subtype(Dot11::BEACON);
|
||||
Tins::Dot11Beacon::Dot11Beacon(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
subtype(Dot11::BEACON);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Beacon::Dot11Beacon(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){
|
||||
this->subtype(Dot11::BEACON);
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
subtype(Dot11::BEACON);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Beacon::Dot11Beacon(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11Beacon::Dot11Beacon(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz)
|
||||
{
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -818,14 +833,16 @@ Tins::PDU *Tins::Dot11Beacon::clone_pdu() const {
|
||||
|
||||
/* Diassoc */
|
||||
|
||||
Tins::Dot11Disassoc::Dot11Disassoc(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
this->subtype(Dot11::DISASSOC);
|
||||
Tins::Dot11Disassoc::Dot11Disassoc(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
subtype(Dot11::DISASSOC);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Disassoc::Dot11Disassoc(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){
|
||||
this->subtype(Dot11::DISASSOC);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
@@ -867,15 +884,19 @@ Tins::PDU *Tins::Dot11Disassoc::clone_pdu() const {
|
||||
|
||||
/* Assoc request. */
|
||||
|
||||
Tins::Dot11AssocRequest::Dot11AssocRequest(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
this->subtype(Dot11::ASSOC_REQ);
|
||||
Tins::Dot11AssocRequest::Dot11AssocRequest(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
subtype(Dot11::ASSOC_REQ);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11AssocRequest::Dot11AssocRequest(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){
|
||||
this->subtype(Dot11::ASSOC_REQ);
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
subtype(Dot11::ASSOC_REQ);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
@@ -944,19 +965,25 @@ Tins::PDU *Tins::Dot11AssocRequest::clone_pdu() const {
|
||||
|
||||
/* Assoc response. */
|
||||
|
||||
Tins::Dot11AssocResponse::Dot11AssocResponse(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
this->subtype(Dot11::ASSOC_RESP);
|
||||
Tins::Dot11AssocResponse::Dot11AssocResponse(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
subtype(Dot11::ASSOC_RESP);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11AssocResponse::Dot11AssocResponse(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) {
|
||||
this->subtype(Dot11::ASSOC_RESP);
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
subtype(Dot11::ASSOC_RESP);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11AssocResponse::Dot11AssocResponse(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11AssocResponse::Dot11AssocResponse(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz)
|
||||
{
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1009,19 +1036,25 @@ Tins::PDU *Tins::Dot11AssocResponse::clone_pdu() const {
|
||||
|
||||
/* ReAssoc request. */
|
||||
|
||||
Tins::Dot11ReAssocRequest::Dot11ReAssocRequest(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
Tins::Dot11ReAssocRequest::Dot11ReAssocRequest(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::REASSOC_REQ);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11ReAssocRequest::Dot11ReAssocRequest(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::REASSOC_REQ);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11ReAssocRequest::Dot11ReAssocRequest(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11ReAssocRequest::Dot11ReAssocRequest(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz)
|
||||
{
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1090,19 +1123,24 @@ Tins::PDU *Tins::Dot11ReAssocRequest::clone_pdu() const {
|
||||
|
||||
/* ReAssoc response. */
|
||||
|
||||
Tins::Dot11ReAssocResponse::Dot11ReAssocResponse(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
Tins::Dot11ReAssocResponse::Dot11ReAssocResponse(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::REASSOC_RESP);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11ReAssocResponse::Dot11ReAssocResponse(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) {
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::REASSOC_RESP);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11ReAssocResponse::Dot11ReAssocResponse(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11ReAssocResponse::Dot11ReAssocResponse(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz) {
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1155,17 +1193,23 @@ Tins::PDU *Tins::Dot11ReAssocResponse::clone_pdu() const {
|
||||
|
||||
/* Probe Request */
|
||||
|
||||
Tins::Dot11ProbeRequest::Dot11ProbeRequest(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
Tins::Dot11ProbeRequest::Dot11ProbeRequest(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::PROBE_REQ);
|
||||
}
|
||||
|
||||
Tins::Dot11ProbeRequest::Dot11ProbeRequest(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) {
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::PROBE_REQ);
|
||||
}
|
||||
|
||||
Tins::Dot11ProbeRequest::Dot11ProbeRequest(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11ProbeRequest::Dot11ProbeRequest(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz)
|
||||
{
|
||||
parse_tagged_parameters(buffer, total_sz);
|
||||
}
|
||||
|
||||
@@ -1194,19 +1238,25 @@ Tins::PDU* Tins::Dot11ProbeRequest::clone_pdu() const {
|
||||
|
||||
/* Probe Response */
|
||||
|
||||
Tins::Dot11ProbeResponse::Dot11ProbeResponse(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
Tins::Dot11ProbeResponse::Dot11ProbeResponse(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::PROBE_RESP);
|
||||
memset(&this->_body, 0, sizeof(this->_body));
|
||||
}
|
||||
|
||||
Tins::Dot11ProbeResponse::Dot11ProbeResponse(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) {
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::PROBE_RESP);
|
||||
memset(&this->_body, 0, sizeof(this->_body));
|
||||
}
|
||||
|
||||
Tins::Dot11ProbeResponse::Dot11ProbeResponse(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11ProbeResponse::Dot11ProbeResponse(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz)
|
||||
{
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1337,19 +1387,25 @@ uint32_t Tins::Dot11ProbeResponse::write_fixed_parameters(uint8_t *buffer, uint3
|
||||
|
||||
/* Auth */
|
||||
|
||||
Tins::Dot11Authentication::Dot11Authentication(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
Tins::Dot11Authentication::Dot11Authentication(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::AUTH);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Authentication::Dot11Authentication(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) {
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::AUTH);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Authentication::Dot11Authentication(const uint8_t *buffer, uint32_t total_sz) : Dot11ManagementFrame(buffer, total_sz) {
|
||||
Tins::Dot11Authentication::Dot11Authentication(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz)
|
||||
{
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1398,19 +1454,24 @@ uint32_t Tins::Dot11Authentication::write_fixed_parameters(uint8_t *buffer, uint
|
||||
|
||||
/* Deauth */
|
||||
|
||||
Tins::Dot11Deauthentication::Dot11Deauthentication(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr) : Dot11ManagementFrame(dst_hw_addr, src_hw_addr) {
|
||||
Tins::Dot11Deauthentication::Dot11Deauthentication(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::DEAUTH);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Deauthentication::Dot11Deauthentication(const std::string& iface,
|
||||
const uint8_t* dst_hw_addr,
|
||||
const uint8_t* src_hw_addr) throw (std::runtime_error) : Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr)
|
||||
: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr)
|
||||
{
|
||||
this->subtype(Dot11::DEAUTH);
|
||||
memset(&_body, 0, sizeof(_body));
|
||||
}
|
||||
|
||||
Tins::Dot11Deauthentication::Dot11Deauthentication(const uint8_t *buffer, uint32_t total_sz) {
|
||||
Tins::Dot11Deauthentication::Dot11Deauthentication(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ManagementFrame(buffer, total_sz) {
|
||||
uint32_t sz = management_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1447,7 +1508,8 @@ Tins::PDU *Tins::Dot11Deauthentication::clone_pdu() const {
|
||||
|
||||
/* Dot11Data */
|
||||
|
||||
Tins::Dot11Data::Dot11Data(const uint8_t *buffer, uint32_t total_sz) : Dot11(buffer, total_sz) {
|
||||
Tins::Dot11Data::Dot11Data(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11(buffer, total_sz) {
|
||||
uint32_t sz = Dot11::header_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1467,32 +1529,30 @@ Tins::Dot11Data::Dot11Data(const uint8_t *buffer, uint32_t total_sz) : Dot11(buf
|
||||
inner_pdu(new Tins::SNAP(buffer, total_sz));
|
||||
}
|
||||
|
||||
Tins::Dot11Data::Dot11Data(uint32_t iface_index, const uint8_t *dst_hw_addr, const uint8_t *src_hw_addr, PDU* child) : Dot11(iface_index, dst_hw_addr, child) {
|
||||
this->type(Dot11::DATA);
|
||||
if(src_hw_addr)
|
||||
this->addr2(src_hw_addr);
|
||||
else
|
||||
std::memset(_ext_header.addr2, 0, sizeof(_ext_header.addr2));
|
||||
Tins::Dot11Data::Dot11Data(uint32_t iface_index, const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr, PDU* child)
|
||||
: Dot11(iface_index, dst_hw_addr, child)
|
||||
{
|
||||
type(Dot11::DATA);
|
||||
addr2(src_hw_addr);
|
||||
}
|
||||
|
||||
Tins::Dot11Data::Dot11Data(const uint8_t *dst_hw_addr, const uint8_t *src_hw_addr, PDU* child) : Dot11(dst_hw_addr, child) {
|
||||
this->type(Dot11::DATA);
|
||||
if(src_hw_addr)
|
||||
this->addr2(src_hw_addr);
|
||||
else
|
||||
std::memset(_ext_header.addr2, 0, sizeof(_ext_header.addr2));
|
||||
Tins::Dot11Data::Dot11Data(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr, PDU* child)
|
||||
: Dot11(dst_hw_addr, child)
|
||||
{
|
||||
type(Dot11::DATA);
|
||||
addr2(src_hw_addr);
|
||||
}
|
||||
|
||||
|
||||
Tins::Dot11Data::Dot11Data(const std::string &iface,
|
||||
const uint8_t *dst_hw_addr,
|
||||
const uint8_t *src_hw_addr,
|
||||
PDU* child) throw (std::runtime_error) : Dot11(iface, dst_hw_addr, child) {
|
||||
this->type(Dot11::DATA);
|
||||
if(src_hw_addr)
|
||||
this->addr2(src_hw_addr);
|
||||
else
|
||||
std::memset(_ext_header.addr2, 0, sizeof(_ext_header.addr2));
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr,
|
||||
PDU* child)
|
||||
: Dot11(iface, dst_hw_addr, child)
|
||||
{
|
||||
type(Dot11::DATA);
|
||||
addr2(src_hw_addr);
|
||||
}
|
||||
|
||||
void Tins::Dot11Data::copy_ext_header(const Dot11Data* other) {
|
||||
@@ -1508,12 +1568,14 @@ uint32_t Tins::Dot11Data::header_size() const {
|
||||
return sz;
|
||||
}
|
||||
|
||||
void Tins::Dot11Data::addr2(const uint8_t* new_addr2) {
|
||||
memcpy(this->_ext_header.addr2, new_addr2, 6);
|
||||
void Tins::Dot11Data::addr2(const address_type &new_addr2) {
|
||||
//memcpy(this->_ext_header.addr2, new_addr2, 6);
|
||||
std::copy(new_addr2.begin(), new_addr2.end(), _ext_header.addr2);
|
||||
}
|
||||
|
||||
void Tins::Dot11Data::addr3(const uint8_t* new_addr3) {
|
||||
memcpy(this->_ext_header.addr3, new_addr3, 6);
|
||||
void Tins::Dot11Data::addr3(const address_type &new_addr3) {
|
||||
//memcpy(this->_ext_header.addr3, new_addr3, 6);
|
||||
std::copy(new_addr3.begin(), new_addr3.end(), _ext_header.addr3);
|
||||
}
|
||||
|
||||
void Tins::Dot11Data::frag_num(uint8_t new_frag_num) {
|
||||
@@ -1548,21 +1610,33 @@ Tins::PDU *Tins::Dot11Data::clone_pdu() const {
|
||||
|
||||
/* QoS data. */
|
||||
|
||||
Tins::Dot11QoSData::Dot11QoSData(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr, PDU* child) : Dot11Data(dst_hw_addr, src_hw_addr, child) {
|
||||
Tins::Dot11QoSData::Dot11QoSData(const address_type &dst_hw_addr,
|
||||
const address_type &src_hw_addr, PDU* child)
|
||||
: Dot11Data(dst_hw_addr, src_hw_addr, child)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Tins::Dot11QoSData::Dot11QoSData(const std::string& iface, const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr, PDU* child) throw (std::runtime_error) : Dot11Data(iface, dst_hw_addr, src_hw_addr, child) {
|
||||
Tins::Dot11QoSData::Dot11QoSData(const std::string& iface,
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr,
|
||||
PDU* child)
|
||||
: Dot11Data(iface, dst_hw_addr, src_hw_addr, child)
|
||||
{
|
||||
this->subtype(Dot11::QOS_DATA_DATA);
|
||||
this->_qos_control = 0;
|
||||
}
|
||||
|
||||
Tins::Dot11QoSData::Dot11QoSData(uint32_t iface_index, const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr, PDU* child) : Dot11Data(iface_index, dst_hw_addr, src_hw_addr, child) {
|
||||
Tins::Dot11QoSData::Dot11QoSData(uint32_t iface_index,
|
||||
const address_type &dst_hw_addr, const address_type &src_hw_addr,
|
||||
PDU* child)
|
||||
: Dot11Data(iface_index, dst_hw_addr, src_hw_addr, child)
|
||||
{
|
||||
this->subtype(Dot11::QOS_DATA_DATA);
|
||||
this->_qos_control = 0;
|
||||
}
|
||||
|
||||
Tins::Dot11QoSData::Dot11QoSData(const uint8_t *buffer, uint32_t total_sz) : Dot11Data(buffer, std::min(data_frame_size(), total_sz)) {
|
||||
Tins::Dot11QoSData::Dot11QoSData(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11Data(buffer, std::min(data_frame_size(), total_sz)) {
|
||||
uint32_t sz = data_frame_size();
|
||||
buffer += sz;
|
||||
total_sz -= sz;
|
||||
@@ -1613,42 +1687,51 @@ Tins::PDU *Tins::Dot11QoSData::clone_pdu() const {
|
||||
|
||||
/* Dot11Control */
|
||||
|
||||
Tins::Dot11Control::Dot11Control(const uint8_t* dst_addr, PDU* child) : Dot11(dst_addr, child) {
|
||||
Tins::Dot11Control::Dot11Control(const address_type &dst_addr, PDU* child)
|
||||
: Dot11(dst_addr, child)
|
||||
{
|
||||
type(CONTROL);
|
||||
}
|
||||
|
||||
Tins::Dot11Control::Dot11Control(const std::string& iface, const uint8_t* dst_addr, PDU* child) throw (std::runtime_error) : Dot11(iface, dst_addr, child) {
|
||||
Tins::Dot11Control::Dot11Control(const std::string& iface,
|
||||
const address_type &dst_addr, PDU* child)
|
||||
: Dot11(iface, dst_addr, child)
|
||||
{
|
||||
type(CONTROL);
|
||||
}
|
||||
|
||||
Tins::Dot11Control::Dot11Control(uint32_t iface_index, const uint8_t* dst_addr, PDU* child) : Dot11(iface_index, dst_addr, child) {
|
||||
Tins::Dot11Control::Dot11Control(uint32_t iface_index,
|
||||
const address_type &dst_addr, PDU* child)
|
||||
: Dot11(iface_index, dst_addr, child)
|
||||
{
|
||||
type(CONTROL);
|
||||
}
|
||||
|
||||
Tins::Dot11Control::Dot11Control(const uint8_t *buffer, uint32_t total_sz) : Dot11(buffer, total_sz) {
|
||||
Tins::Dot11Control::Dot11Control(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11(buffer, total_sz) {
|
||||
|
||||
}
|
||||
|
||||
/* Dot11ControlTA */
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(const uint8_t* dst_addr, const uint8_t *target_address, PDU* child) : Dot11Control(dst_addr, child) {
|
||||
if(target_address)
|
||||
target_addr(target_address);
|
||||
else
|
||||
std::memset(_taddr, 0, sizeof(_taddr));
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(const address_type &dst_addr,
|
||||
const address_type &target_address, PDU* child)
|
||||
: Dot11Control(dst_addr, child)
|
||||
{
|
||||
target_addr(target_address);
|
||||
}
|
||||
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_address, PDU* child) throw (std::runtime_error) : Dot11Control(iface, dst_addr, child){
|
||||
if(target_address)
|
||||
target_addr(target_address);
|
||||
else
|
||||
std::memset(_taddr, 0, sizeof(_taddr));
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(const std::string& iface,
|
||||
const address_type &dst_addr, const address_type &target_address, PDU* child)
|
||||
: Dot11Control(iface, dst_addr, child)
|
||||
{
|
||||
target_addr(target_address);
|
||||
}
|
||||
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_address, PDU* child) : Dot11Control(iface_index, dst_addr, child) {
|
||||
if(target_address)
|
||||
target_addr(target_address);
|
||||
else
|
||||
std::memset(_taddr, 0, sizeof(_taddr));
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(uint32_t iface_index,
|
||||
const address_type &dst_addr, const address_type &target_address, PDU* child)
|
||||
: Dot11Control(iface_index, dst_addr, child)
|
||||
{
|
||||
target_addr(target_address);
|
||||
}
|
||||
|
||||
Tins::Dot11ControlTA::Dot11ControlTA(const uint8_t *buffer, uint32_t total_sz) : Dot11Control(buffer, total_sz) {
|
||||
@@ -1669,24 +1752,35 @@ uint32_t Tins::Dot11ControlTA::write_ext_header(uint8_t *buffer, uint32_t total_
|
||||
return sizeof(_taddr);
|
||||
}
|
||||
|
||||
void Tins::Dot11ControlTA::target_addr(const uint8_t *addr) {
|
||||
std::memcpy(_taddr, addr, sizeof(_taddr));
|
||||
void Tins::Dot11ControlTA::target_addr(const address_type &addr) {
|
||||
//std::memcpy(_taddr, addr, sizeof(_taddr));
|
||||
std::copy(addr.begin(), addr.end(), _taddr);
|
||||
}
|
||||
|
||||
/* Dot11RTS */
|
||||
Tins::Dot11RTS::Dot11RTS(const uint8_t* dst_addr , const uint8_t* target_addr, PDU* child) : Dot11ControlTA(dst_addr, target_addr, child) {
|
||||
Tins::Dot11RTS::Dot11RTS(const address_type &dst_addr ,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(RTS);
|
||||
}
|
||||
|
||||
Tins::Dot11RTS::Dot11RTS(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11ControlTA(iface, dst_addr, target_addr, child) {
|
||||
Tins::Dot11RTS::Dot11RTS(const std::string& iface, const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(RTS);
|
||||
}
|
||||
|
||||
Tins::Dot11RTS::Dot11RTS(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) {
|
||||
Tins::Dot11RTS::Dot11RTS(uint32_t iface_index, const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface_index, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(RTS);
|
||||
}
|
||||
|
||||
Tins::Dot11RTS::Dot11RTS(const uint8_t *buffer, uint32_t total_sz) : Dot11ControlTA(buffer, total_sz) {
|
||||
Tins::Dot11RTS::Dot11RTS(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ControlTA(buffer, total_sz) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1698,19 +1792,29 @@ Tins::PDU *Tins::Dot11RTS::clone_pdu() const {
|
||||
|
||||
/* Dot11PSPoll */
|
||||
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(const uint8_t* dst_addr , const uint8_t* target_addr, PDU* child) : Dot11ControlTA(dst_addr, target_addr, child) {
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(PS);
|
||||
}
|
||||
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11ControlTA(iface, dst_addr, target_addr, child) {
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(const std::string& iface,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(PS);
|
||||
}
|
||||
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) {
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(uint32_t iface_index, const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface_index, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(PS);
|
||||
}
|
||||
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(const uint8_t *buffer, uint32_t total_sz) : Dot11ControlTA(buffer, total_sz) {
|
||||
Tins::Dot11PSPoll::Dot11PSPoll(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ControlTA(buffer, total_sz) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1722,19 +1826,29 @@ Tins::PDU *Tins::Dot11PSPoll::clone_pdu() const {
|
||||
|
||||
/* Dot11CFEnd */
|
||||
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(const uint8_t* dst_addr , const uint8_t* target_addr, PDU* child) : Dot11ControlTA(dst_addr, target_addr, child) {
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(CF_END);
|
||||
}
|
||||
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11ControlTA(iface, dst_addr, target_addr, child) {
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(const std::string& iface,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(CF_END);
|
||||
}
|
||||
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) {
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(uint32_t iface_index, const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface_index, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(CF_END);
|
||||
}
|
||||
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(const uint8_t *buffer, uint32_t total_sz) : Dot11ControlTA(buffer, total_sz) {
|
||||
Tins::Dot11CFEnd::Dot11CFEnd(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ControlTA(buffer, total_sz) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1746,19 +1860,29 @@ Tins::PDU *Tins::Dot11CFEnd::clone_pdu() const {
|
||||
|
||||
/* Dot11EndCFAck */
|
||||
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(const uint8_t* dst_addr , const uint8_t* target_addr, PDU* child) : Dot11ControlTA(dst_addr, target_addr, child) {
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(CF_END_ACK);
|
||||
}
|
||||
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11ControlTA(iface, dst_addr, target_addr, child) {
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(const std::string& iface,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(CF_END_ACK);
|
||||
}
|
||||
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) {
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(uint32_t iface_index,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface_index, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(CF_END_ACK);
|
||||
}
|
||||
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(const uint8_t *buffer, uint32_t total_sz) : Dot11ControlTA(buffer, total_sz) {
|
||||
Tins::Dot11EndCFAck::Dot11EndCFAck(const uint8_t *buffer, uint32_t total_sz)
|
||||
: Dot11ControlTA(buffer, total_sz) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1770,15 +1894,23 @@ Tins::PDU *Tins::Dot11EndCFAck::clone_pdu() const {
|
||||
|
||||
/* Dot11Ack */
|
||||
|
||||
Tins::Dot11Ack::Dot11Ack(const uint8_t* dst_addr, PDU* child) : Dot11Control(dst_addr, child) {
|
||||
Tins::Dot11Ack::Dot11Ack(const address_type &dst_addr, PDU* child)
|
||||
: Dot11Control(dst_addr, child)
|
||||
{
|
||||
subtype(ACK);
|
||||
}
|
||||
|
||||
Tins::Dot11Ack::Dot11Ack(const std::string& iface, const uint8_t* dst_addr, PDU* child) throw (std::runtime_error) : Dot11Control(iface, dst_addr, child) {
|
||||
Tins::Dot11Ack::Dot11Ack(const std::string& iface,
|
||||
const address_type &dst_addr, PDU* child)
|
||||
: Dot11Control(iface, dst_addr, child)
|
||||
{
|
||||
subtype(ACK);
|
||||
}
|
||||
|
||||
Tins::Dot11Ack::Dot11Ack(uint32_t iface_index, const uint8_t* dst_addr, PDU* child) : Dot11Control(iface_index, dst_addr, child) {
|
||||
Tins::Dot11Ack::Dot11Ack(uint32_t iface_index,
|
||||
const address_type &dst_addr, PDU* child)
|
||||
: Dot11Control(iface_index, dst_addr, child)
|
||||
{
|
||||
subtype(ACK);
|
||||
}
|
||||
|
||||
@@ -1794,15 +1926,24 @@ Tins::PDU *Tins::Dot11Ack::clone_pdu() const {
|
||||
|
||||
/* Dot11BlockAck */
|
||||
|
||||
Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(const uint8_t* dst_addr , const uint8_t* target_addr, PDU* child) : Dot11ControlTA(dst_addr, target_addr, child) {
|
||||
Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(
|
||||
const address_type &dst_addr , const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(dst_addr, target_addr, child)
|
||||
{
|
||||
init_block_ack();
|
||||
}
|
||||
|
||||
Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11ControlTA(iface, dst_addr, target_addr, child) {
|
||||
Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(const std::string& iface,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface, dst_addr, target_addr, child)
|
||||
{
|
||||
init_block_ack();
|
||||
}
|
||||
|
||||
Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) {
|
||||
Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(uint32_t iface_index,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface_index, dst_addr, target_addr, child)
|
||||
{
|
||||
init_block_ack();
|
||||
}
|
||||
|
||||
@@ -1851,17 +1992,26 @@ Tins::PDU *Tins::Dot11BlockAckRequest::clone_pdu() const {
|
||||
}
|
||||
|
||||
/* Dot11BlockAck */
|
||||
Tins::Dot11BlockAck::Dot11BlockAck(const uint8_t* dst_addr , const uint8_t* target_addr, PDU* child) : Dot11ControlTA(dst_addr, target_addr, child) {
|
||||
Tins::Dot11BlockAck::Dot11BlockAck(const address_type &dst_addr,
|
||||
const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(BLOCK_ACK);
|
||||
std::memset(_bitmap, 0, sizeof(_bitmap));
|
||||
}
|
||||
|
||||
Tins::Dot11BlockAck::Dot11BlockAck(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11ControlTA(iface, dst_addr, target_addr, child) {
|
||||
Tins::Dot11BlockAck::Dot11BlockAck(const std::string& iface,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(BLOCK_ACK);
|
||||
std::memset(_bitmap, 0, sizeof(_bitmap));
|
||||
}
|
||||
|
||||
Tins::Dot11BlockAck::Dot11BlockAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) {
|
||||
Tins::Dot11BlockAck::Dot11BlockAck(uint32_t iface_index,
|
||||
const address_type &dst_addr, const address_type &target_addr, PDU* child)
|
||||
: Dot11ControlTA(iface_index, dst_addr, target_addr, child)
|
||||
{
|
||||
subtype(BLOCK_ACK);
|
||||
std::memset(_bitmap, 0, sizeof(_bitmap));
|
||||
}
|
||||
|
||||
@@ -208,8 +208,11 @@ bool Tins::RadioTap::send(PacketSender* sender) {
|
||||
addr.sll_ifindex = _iface_index;
|
||||
|
||||
Tins::Dot11 *wlan = dynamic_cast<Tins::Dot11*>(inner_pdu());
|
||||
if(wlan)
|
||||
memcpy(&(addr.sll_addr), wlan->addr1(), 6);
|
||||
if(wlan) {
|
||||
Dot11::address_type dot11_addr(wlan->addr1());
|
||||
std::copy(dot11_addr.begin(), dot11_addr.end(), addr.sll_addr);
|
||||
//memcpy(&(addr.sll_addr), wlan->addr1(), 6);
|
||||
}
|
||||
|
||||
return sender->send_l2(this, (struct sockaddr*)&addr, (uint32_t)sizeof(addr));
|
||||
}
|
||||
|
||||
@@ -25,6 +25,27 @@ TEST_F(HWAddressTest, DefaultConstructor) {
|
||||
EXPECT_TRUE(std::equal(addr.begin(), addr.end(), empty_addr));
|
||||
}
|
||||
|
||||
TEST_F(HWAddressTest, EqualsOperator) {
|
||||
HWAddress<6> addr1(byte_address), addr2(byte_address);
|
||||
EXPECT_EQ(addr1, addr2);
|
||||
}
|
||||
|
||||
TEST_F(HWAddressTest, DistinctOperator) {
|
||||
HWAddress<6> addr1(byte_address), addr2(empty_addr);
|
||||
EXPECT_NE(addr1, addr2);
|
||||
}
|
||||
|
||||
TEST_F(HWAddressTest, CopyConstructor) {
|
||||
HWAddress<6> addr1(byte_address), addr2(addr1);
|
||||
EXPECT_EQ(addr1, addr2);
|
||||
}
|
||||
|
||||
TEST_F(HWAddressTest, CopyAssignmentOperator) {
|
||||
HWAddress<6> addr1(byte_address), addr2;
|
||||
addr2 = addr1;
|
||||
EXPECT_EQ(addr1, addr2);
|
||||
}
|
||||
|
||||
TEST_F(HWAddressTest, ConstructorFromBytes) {
|
||||
HWAddress<6> addr(byte_address);
|
||||
EXPECT_TRUE(std::equal(addr.begin(), addr.end(), byte_address));
|
||||
|
||||
Reference in New Issue
Block a user