1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added a constructor on IEEE802_11 which doesn't take an interface as a parameter.

This commit is contained in:
Matias Fontanini
2011-08-21 20:58:20 -03:00
parent 235f12e862
commit 393beda0d7
2 changed files with 19 additions and 1 deletions

View File

@@ -93,6 +93,17 @@ namespace Tins {
CF_ACK_POLL = 7
};
/**
* \brief Constructor for creating a 802.11 PDU
*
* Constructor that builds a 802.11 PDU taking the destination's and source's MAC.
*
* \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).
* \param child PDU* with the PDU contained by the 802.11 PDU (optional).
*/
IEEE802_11(const uint8_t* dst_hw_addr = 0, const uint8_t* src_hw_addr = 0, PDU* child = 0);
/**
* \brief Constructor for creating a 802.11 PDU
*

View File

@@ -35,6 +35,14 @@
using namespace std;
Tins::IEEE802_11::IEEE802_11(const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr, PDU* child) : PDU(ETHERTYPE_IP, child) {
memset(&this->_header, 0, sizeof(ieee80211_header));
if(dst_hw_addr)
this->dst_addr(dst_hw_addr);
if(src_hw_addr)
this->src_addr(src_hw_addr);
}
Tins::IEEE802_11::IEEE802_11(const std::string& iface, const uint8_t* dst_hw_addr, const uint8_t* src_hw_addr, PDU* child) throw (std::runtime_error) : PDU(ETHERTYPE_IP, child) {
memset(&this->_header, 0, sizeof(ieee80211_header));
if(dst_hw_addr)
@@ -42,7 +50,6 @@ Tins::IEEE802_11::IEEE802_11(const std::string& iface, const uint8_t* dst_hw_add
if(src_hw_addr)
this->src_addr(src_hw_addr);
this->iface(iface);
}