From aaad48c25cb1a172cabf30c353147097fdd31f6a Mon Sep 17 00:00:00 2001 From: Santiago Alessandri Date: Tue, 6 Sep 2011 09:55:35 -0300 Subject: [PATCH] Added Dot11ReAssocRequest. --- include/dot11.h | 241 ++++++++++++++++++++++++++++++++++++++++-------- src/dot11.cpp | 145 +++++++++++++++++++++++------ 2 files changed, 317 insertions(+), 69 deletions(-) diff --git a/include/dot11.h b/include/dot11.h index b1eeef8..2c1ee06 100644 --- a/include/dot11.h +++ b/include/dot11.h @@ -1645,6 +1645,165 @@ namespace Tins { AssocRespBody _body; }; + class Dot11ReAssocRequest : public Dot11ManagementFrame { + + public: + /** + * \brief Default constructor for the ReAssociation Request frame. + * + */ + Dot11ReAssocRequest(); + + /** + * \brief Constructor for creating a 802.11 ReAssociation Request. + * + * Constructor that builds a 802.11 ReAssociation Request taking the interface name, + * destination's and source's MAC. + * + * \param iface string containing the interface's name from where to send the packet. + * \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); + + /** + * \brief Constructor which creates a Dot11ReAssocRequest object from a + * buffer and adds all identifiable PDUs found in the buffer as children of this one. + * + * \param buffer The buffer from which this PDU will be constructed. + * \param total_sz The total size of the buffer. + */ + Dot11ReAssocRequest(const uint8_t *buffer, uint32_t total_sz); + + /** + * \brief Copy constructor. + */ + Dot11ReAssocRequest(const Dot11ReAssocRequest &other); + + /** + * \brief Copy assignment operator. + */ + Dot11ReAssocRequest &operator= (const Dot11ReAssocRequest &other); + + /** + * \brief Getter for the Capabilities Information. + * + * \return CapabilityInformation Structure in a CapabilityInformation&. + */ + inline const CapabilityInformation& capabilities() const { return this->_body.capability;} + + /** + * \brief Getter for the Capabilities Information. + * + * \return CapabilityInformation Structure in a CapabilityInformation&. + */ + inline CapabilityInformation& capabilities() { return this->_body.capability;} + + /** + * \brief Getter for the listen interval. + * + * \return The listen interval in an uint16_t. + */ + inline uint16_t listen_interval() const { return this->_body.listen_interval; } + + /** + * \brief Getter for the current AP field. + * + * \return The current AP value in an uint8_t*. + */ + inline const uint8_t* current_ap() const {return this->_body.current_ap; } + + /** + * \brief Setter for the listen interval. + * + * \param new_listen_interval uint16_t with the new listen interval. + */ + void listen_interval(uint16_t new_listen_interval); + + /** + * \brief Setter for the current AP field. + * + * \param new_current_ap uint8_t array of 6 bytes with the new current_ap + */ + void current_ap(const uint8_t* new_current_ap); + + /** + * \brief Helper method to set the essid. + * + * \param new_ssid The ssid to be set. + */ + void ssid(const std::string &new_ssid); + + /** + * \brief Helper method to set the supported rates. + * + * \param new_rates A list of rates to be set. + */ + void supported_rates(const std::list &new_rates); + + /** + * \brief Helper method to set the extended supported rates. + * + * \param new_rates A list of rates to be set. + */ + void extended_supported_rates(const std::list &new_rates); + + /** + * \brief Helper method to set the power capabilities. + * + * \param min_power uint8_t indicating the minimum transmiting power capability. + * \param max_power uint8_t indicating the maximum transmiting power capability. + */ + void power_capabilities(uint8_t min_power, uint8_t max_power); + + /** + * \brief Helper method to set the supported channels. + * + * \param new_channels A list of channels to be set. + */ + void supported_channels(const std::list > &new_channels); + + /** + * \brief Helper method to set the RSN information option. + * + * \param info The RSNInformation structure to be set. + */ + void rsn_information(const RSNInformation& info); + + /** + * \brief Helper method to set the QoS capabilities. + * + * \param new_qos_capabilities uint8_t with the capabilities. + */ + void qos_capabilities(uint8_t new_qos_capabilities); + + /** + * \brief Returns the frame's header length. + * + * \return An uint32_t with the header's size. + * \sa PDU::header_size() + */ + uint32_t header_size() const; + + + protected: + + + + private: + struct ReAssocReqBody { + CapabilityInformation capability; + uint16_t listen_interval; + uint8_t current_ap[6]; + }; + + void copy_fields(const Dot11ReAssocRequest* other); + uint32_t write_fixed_parameters(uint8_t* buffer, uint32_t total_sz); + + ReAssocReqBody _body; + + }; + class Dot11QoSData : public Dot11DataFrame { public: @@ -1725,7 +1884,7 @@ namespace Tins { * \sa PDU::header_size() */ uint32_t header_size() const; - + /** * \brief Getter for the PDU's type. * \sa PDU::pdu_type @@ -1779,13 +1938,13 @@ namespace Tins { Dot11Control(uint32_t iface_index, const uint8_t* dst_addr = 0, PDU* child = 0); /** - * \brief Constructor which creates an 802.11 control frame object from a buffer and + * \brief Constructor which creates an 802.11 control frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11Control(const uint8_t *buffer, uint32_t total_sz); - + /** * \brief Getter for the PDU's type. * \sa PDU::pdu_type @@ -1837,24 +1996,24 @@ namespace Tins { Dot11ControlTA(uint32_t iface_index, const uint8_t* dst_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0); /** - * \brief Constructor which creates an 802.11 control frame object from a buffer and + * \brief Constructor which creates an 802.11 control frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11ControlTA(const uint8_t *buffer, uint32_t total_sz); - + /** * \brief Getter for the target address field. */ inline const uint8_t* 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); - + /** * \brief Returns the 802.11 frame's header length. * @@ -1867,13 +2026,13 @@ namespace Tins { * \brief Getter for the control ta additional fields size. */ uint32_t controlta_size() const { return sizeof(_taddr) + sizeof(ieee80211_header); } - + uint32_t write_ext_header(uint8_t *buffer, uint32_t total_sz); private: - + uint8_t _taddr[6]; }; - + class Dot11RTS : public Dot11ControlTA { public: /** @@ -1914,20 +2073,20 @@ namespace Tins { Dot11RTS(uint32_t iface_index, const uint8_t* dst_hw_addr = 0, const uint8_t *target_addr = 0, PDU* child = 0); /** - * \brief Constructor which creates an 802.11 RTS frame object from a buffer and + * \brief Constructor which creates an 802.11 RTS frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11RTS(const uint8_t *buffer, uint32_t total_sz); - + /** * \brief Getter for the PDU's type. * \sa PDU::pdu_type */ PDUType pdu_type() const { return PDU::DOT11_RTS; } }; - + class Dot11PSPoll : public Dot11ControlTA { public: /** @@ -1968,14 +2127,14 @@ namespace Tins { Dot11PSPoll(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child); /** - * \brief Constructor which creates an 802.11 PS-Poll frame object from a buffer and + * \brief Constructor which creates an 802.11 PS-Poll frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11PSPoll(const uint8_t *buffer, uint32_t total_sz); }; - + class Dot11CFEnd : public Dot11ControlTA { public: /** @@ -2016,14 +2175,14 @@ namespace Tins { Dot11CFEnd(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child); /** - * \brief Constructor which creates an 802.11 CF-End frame object from a buffer and + * \brief Constructor which creates an 802.11 CF-End frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11CFEnd(const uint8_t *buffer, uint32_t total_sz); }; - + class Dot11EndCFAck : public Dot11ControlTA { public: /** @@ -2061,14 +2220,14 @@ namespace Tins { Dot11EndCFAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child); /** - * \brief Constructor which creates an 802.11 End-CF-Ack frame object from a buffer and + * \brief Constructor which creates an 802.11 End-CF-Ack frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11EndCFAck(const uint8_t *buffer, uint32_t total_sz); }; - + class Dot11Ack : public Dot11Control { public: /** @@ -2107,20 +2266,20 @@ namespace Tins { Dot11Ack(uint32_t iface_index, const uint8_t* dst_addr, PDU* child); /** - * \brief Constructor which creates an 802.11 Ack frame object from a buffer and + * \brief Constructor which creates an 802.11 Ack frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11Ack(const uint8_t *buffer, uint32_t total_sz); - + /** * \brief Getter for the PDU's type. * \sa PDU::pdu_type */ PDUType pdu_type() const { return PDU::DOT11_ACK; } }; - + /** * \brief Class that represents an 802.11 Block Ack Request PDU. */ @@ -2161,27 +2320,27 @@ namespace Tins { Dot11BlockAckRequest(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child); /** - * \brief Constructor which creates an 802.11 Block Ack request frame object from a buffer and + * \brief Constructor which creates an 802.11 Block Ack request frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11BlockAckRequest(const uint8_t *buffer, uint32_t total_sz); - + /* Getter */ - + /** * \brief Getter for the bar control field. * \return The bar control field. */ uint16_t bar_control() const { return *(const uint16_t*)&_bar_control; } - + /** * \brief Getter for the start sequence field. * \return The bar start sequence. */ uint16_t start_sequence() const { return *(const uint16_t*)&_start_sequence; } - + /** * \brief Returns the 802.11 frame's header length. * @@ -2189,15 +2348,15 @@ namespace Tins { * \sa PDU::header_size() */ uint32_t header_size() const; - + /* Setter */ - + /** * \brief Setter for the bar control field. * \param bar The new bar control field. */ void bar_control(uint16_t bar); - + /** * \brief Setter for the start sequence field. * \param bar The new start sequence field. @@ -2208,25 +2367,25 @@ namespace Tins { * \brief Getter for the control ta additional fields size. */ uint32_t blockack_request_size() const { return controlta_size() + sizeof(_bar_control) + sizeof(_start_sequence); } - + uint32_t write_ext_header(uint8_t *buffer, uint32_t total_sz); private: struct BarControl { uint16_t reserved:12, tid:4; } __attribute__((__packed__)); - + struct StartSequence { uint16_t frag:4, seq:12; } __attribute__((__packed__)); - + void init_block_ack(); - + BarControl _bar_control; StartSequence _start_sequence; }; - + /** * \brief Class that represents an 802.11 block ack frame. */ @@ -2267,13 +2426,13 @@ namespace Tins { Dot11BlockAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child); /** - * \brief Constructor which creates an 802.11 Block Ack request frame object from a buffer and + * \brief Constructor which creates an 802.11 Block Ack request frame object from a buffer and * adds all identifiable PDUs found in the buffer as children of this one. * \param buffer The buffer from which this PDU will be constructed. * \param total_sz The total size of the buffer. */ Dot11BlockAck(const uint8_t *buffer, uint32_t total_sz); - + /** * \brief Returns the 802.11 frame's header length. * @@ -2281,19 +2440,19 @@ namespace Tins { * \sa PDU::header_size() */ uint32_t header_size() const; - + /** * \brief Getter for the bitmap field. * \return The bitmap field. */ const uint8_t *bitmap() const { return _bitmap; } - + /** * \brief Setter for the bitmap field. * \param bit The new bitmap field to be set. */ void bitmap(const uint8_t *bit); - + /** * \brief Getter for the PDU's type. * \sa PDU::pdu_type @@ -2301,7 +2460,7 @@ namespace Tins { PDUType pdu_type() const { return PDU::DOT11_BLOCK_ACK; } private: uint32_t write_ext_header(uint8_t *buffer, uint32_t total_sz); - + uint8_t _bitmap[8]; }; }; diff --git a/src/dot11.cpp b/src/dot11.cpp index ff57668..fa84f08 100644 --- a/src/dot11.cpp +++ b/src/dot11.cpp @@ -241,7 +241,7 @@ Tins::PDU *Tins::Dot11::from_bytes(const uint8_t *buffer, uint32_t total_sz) { else if(hdr->control.type == DATA){ if(hdr->control.subtype <= 4) ret = new Dot11DataFrame(buffer, total_sz); - else + else ret = new Dot11QoSData(buffer, total_sz); } else if(hdr->control.type == CONTROL){ @@ -888,6 +888,95 @@ uint32_t Tins::Dot11AssocResponse::write_fixed_parameters(uint8_t *buffer, uint3 return sz; } +/* ReAssoc Request */ + +Tins::Dot11ReAssocRequest::Dot11ReAssocRequest() : Dot11ManagementFrame() { + 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) { + 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) { + uint32_t sz = Dot11ManagementFrame::header_size(); + buffer += sz; + total_sz -= sz; + if(total_sz < sizeof(_body)) + throw std::runtime_error("Not enough size for an IEEE 802.11 association header in the buffer."); + memcpy(&_body, buffer, sizeof(_body)); + buffer += sizeof(_body); + total_sz -= sizeof(_body); + parse_tagged_parameters(buffer, total_sz); +} + +Tins::Dot11ReAssocRequest::Dot11ReAssocRequest(const Dot11ReAssocRequest &other) : Dot11ManagementFrame(other) { + copy_fields(&other); +} + +Tins::Dot11ReAssocRequest &Tins::Dot11ReAssocRequest::operator= (const Dot11ReAssocRequest &other) { + copy_inner_pdu(other); + copy_fields(&other); + return *this; +} + +void Tins::Dot11ReAssocRequest::copy_fields(const Dot11ReAssocRequest *other) { + Dot11ManagementFrame::copy_ext_header(other); + std::memcpy(&_body, &other->_body, sizeof(_body)); +} + +void Tins::Dot11ReAssocRequest::listen_interval(uint16_t new_listen_interval) { + this->_body.listen_interval = new_listen_interval; +} + +void Tins::Dot11ReAssocRequest::current_ap(const uint8_t* new_current_ap) { + memcpy(this->_body.current_ap, new_current_ap, 6); +} + +void Tins::Dot11ReAssocRequest::ssid(const std::string &new_ssid) { + Dot11ManagementFrame::ssid(new_ssid); +} + +void Tins::Dot11ReAssocRequest::supported_rates(const std::list &new_rates) { + Dot11ManagementFrame::supported_rates(new_rates); +} + +void Tins::Dot11ReAssocRequest::extended_supported_rates(const std::list &new_rates) { + Dot11ManagementFrame::extended_supported_rates(new_rates); +} + +void Tins::Dot11ReAssocRequest::power_capabilities(uint8_t min_power, uint8_t max_power) { + Dot11ManagementFrame::power_capabilities(min_power, max_power); +} + +void Tins::Dot11ReAssocRequest::supported_channels(const std::list > &new_channels) { + Dot11ManagementFrame::supported_channels(new_channels); +} + +void Tins::Dot11ReAssocRequest::rsn_information(const RSNInformation& info) { + Dot11ManagementFrame::rsn_information(info); +} + +void Tins::Dot11ReAssocRequest::qos_capabilities(uint8_t new_qos_capabilities) { + Dot11ManagementFrame::qos_capabilities(new_qos_capabilities); +} + +uint32_t Tins::Dot11ReAssocRequest::header_size() const { + return Dot11ManagementFrame::header_size() + sizeof(this->_body); +} + +uint32_t Tins::Dot11ReAssocRequest::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz) { + uint32_t sz = sizeof(this->_body); + assert(sz <= total_sz); + memcpy(buffer, &this->_body, sz); + return sz; +} + + /* QoS data. */ 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) : Dot11DataFrame(iface, dst_hw_addr, src_hw_addr, child) { @@ -1008,16 +1097,16 @@ Tins::Dot11RTS::Dot11RTS(const uint8_t* dst_addr , const uint8_t* target_addr, P 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 uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : 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 uint8_t* dst_addr, const uint8_t *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) { + } /* Dot11PSPoll */ @@ -1026,16 +1115,16 @@ Tins::Dot11PSPoll::Dot11PSPoll(const uint8_t* dst_addr , const uint8_t* target_a 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 uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : 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 uint8_t* dst_addr, const uint8_t *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) { + } /* Dot11CFEnd */ @@ -1044,16 +1133,16 @@ Tins::Dot11CFEnd::Dot11CFEnd(const uint8_t* dst_addr , const uint8_t* target_add 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 uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : 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 uint8_t* dst_addr, const uint8_t *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) { + } /* Dot11EndCFAck */ @@ -1062,16 +1151,16 @@ Tins::Dot11EndCFAck::Dot11EndCFAck(const uint8_t* dst_addr , const uint8_t* targ 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 uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : 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 uint8_t* dst_addr, const uint8_t *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) { + } /* Dot11Ack */ @@ -1080,16 +1169,16 @@ Tins::Dot11Ack::Dot11Ack(const uint8_t* dst_addr, PDU* child) : Dot11Control(ds 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 uint8_t* dst_addr, PDU* child) throw (std::runtime_error) : 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 uint8_t* dst_addr, PDU* child) : Dot11Control(iface_index, dst_addr, child) { subtype(ACK); } -Tins::Dot11Ack::Dot11Ack(const uint8_t *buffer, uint32_t total_sz) : Dot11Control(buffer, total_sz) { - +Tins::Dot11Ack::Dot11Ack(const uint8_t *buffer, uint32_t total_sz) : Dot11Control(buffer, total_sz) { + } /* Dot11BlockAck */ @@ -1098,15 +1187,15 @@ Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(const uint8_t* dst_addr , const 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 uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : 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 uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11ControlTA(iface_index, dst_addr, target_addr, child) { init_block_ack(); } -Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(const uint8_t *buffer, uint32_t total_sz) : Dot11ControlTA(buffer, total_sz) { +Tins::Dot11BlockAckRequest::Dot11BlockAckRequest(const uint8_t *buffer, uint32_t total_sz) : Dot11ControlTA(buffer, total_sz) { uint32_t padding = controlta_size(); buffer += padding; total_sz -= padding; @@ -1135,7 +1224,7 @@ uint32_t Tins::Dot11BlockAckRequest::write_ext_header(uint8_t *buffer, uint32_t void Tins::Dot11BlockAckRequest::bar_control(uint16_t bar) { std::memcpy(&_bar_control, &bar, sizeof(bar)); } - + void Tins::Dot11BlockAckRequest::start_sequence(uint16_t seq) { std::memcpy(&_start_sequence, &seq, sizeof(seq)); } @@ -1150,17 +1239,17 @@ Tins::Dot11BlockAck::Dot11BlockAck(const uint8_t* dst_addr , const uint8_t* targ 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) : Dot11BlockAckRequest(iface, dst_addr, target_addr, child) { +Tins::Dot11BlockAck::Dot11BlockAck(const std::string& iface, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) throw (std::runtime_error) : Dot11BlockAckRequest(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) : Dot11BlockAckRequest(iface_index, dst_addr, target_addr, child) { +Tins::Dot11BlockAck::Dot11BlockAck(uint32_t iface_index, const uint8_t* dst_addr, const uint8_t *target_addr, PDU* child) : Dot11BlockAckRequest(iface_index, dst_addr, target_addr, child) { subtype(BLOCK_ACK); std::memset(_bitmap, 0, sizeof(_bitmap)); } -Tins::Dot11BlockAck::Dot11BlockAck(const uint8_t *buffer, uint32_t total_sz) : Dot11BlockAckRequest(buffer, total_sz) { +Tins::Dot11BlockAck::Dot11BlockAck(const uint8_t *buffer, uint32_t total_sz) : Dot11BlockAckRequest(buffer, total_sz) { uint32_t padding = blockack_request_size(); buffer += padding; total_sz -= padding;