diff --git a/include/dot11.h b/include/dot11.h index 96f8010..1b7f881 100644 --- a/include/dot11.h +++ b/include/dot11.h @@ -167,12 +167,10 @@ namespace Tins { * Constructor that builds an 802.11 PDU taking the interface index, * destination's and source's MAC. * - * \param iface_index const uint32_t with the interface's index from where to send the packet. - * \param dst_hw_addr uint8_t array of 6 bytes containing the destination's MAC(optional). + * \param dst_hw_addr The destination hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11(const NetworkInterface &iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), + Dot11(const address_type &dst_hw_addr = address_type(), PDU* child = 0); /** @@ -263,14 +261,14 @@ namespace Tins { /** * \brief Getter for the first address. * - * \return The first address as a constant uint8_t pointer. + * \return The first address. */ address_type addr1() const { return _header.addr1; } /** - * \brief Getter for the interface. + * \brief Getter for the network interface. * - * \return The interface's index as an uint32_t. + * \return The network interface in which this PDU will be sent. */ const NetworkInterface &iface() const { return _iface; } @@ -354,16 +352,17 @@ namespace Tins { /** * \brief Setter for the first address. * - * \param new_addr1 const uint8_t array of 6 bytes containing the new first's address. + * \param new_addr1 The new first address. */ void addr1(const address_type &new_addr1); /** - * \brief Setter for the interface. + * \brief Setter for the network interface. * - * \param new_iface_index uint32_t containing the new interface index. + * \param new_iface The network interface in which this PDU + * will be sent. */ - void iface(const NetworkInterface &new_ifac); + void iface(const NetworkInterface &new_iface); /* Virtual methods */ /** @@ -1432,9 +1431,8 @@ namespace Tins { } __attribute__((__packed__)); - Dot11ManagementFrame(const NetworkInterface &iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11ManagementFrame(const address_type &dst_hw_addr = address_type(), + const address_type &src_hw_addr = address_type()); /** * \brief Constructor which creates a Dot11ManagementFrame object from a buffer and adds all identifiable @@ -1475,16 +1473,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Beacon. * - * Constructor that builds a 802.11 Beacon taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Beacon taking destination and source + * hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11Beacon(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11Beacon(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 @@ -1594,16 +1590,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Disassociation. * - * Constructor that builds a 802.11 Disassociation taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Disassociation taking the destination + * and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11Disassoc(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11Disassoc(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 @@ -1683,16 +1677,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Association Request. * - * Constructor that builds a 802.11 Association Request taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Association Request taking the + * destination and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11AssocRequest(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11AssocRequest(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 @@ -1787,16 +1779,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Association Response. * - * Constructor that builds a 802.11 Association Response taking the interface name, - * destination's and source's MAC. + * Constructors a 802.11 Association Response taking destination + * and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11AssocResponse(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11AssocResponse(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 @@ -1906,16 +1896,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 ReAssociation Request. * - * Constructor that builds a 802.11 Association Request taking the interface name, - * destination's and source's MAC. + * Constructors a 802.11 Association Request taking the destination + * and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11ReAssocRequest(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11ReAssocRequest(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 @@ -2025,16 +2013,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Association Response. * - * Constructor that builds a 802.11 ReAssociation Response taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 ReAssociation Response taking the + * destination and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11ReAssocResponse(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11ReAssocResponse(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 @@ -2144,16 +2130,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Authentication. * - * Constructor that builds a 802.11 Dot11Authentication taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Dot11Authentication taking the + * destination and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11Authentication(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11Authentication(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 @@ -2264,16 +2248,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Deauthentication. * - * Constructor that builds a 802.11 Deauthentication taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Deauthentication taking the + * destination and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11Deauthentication(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11Deauthentication(const address_type &dst_hw_addr = address_type(), + const address_type &src_hw_addr = address_type()); /** * \brief Constructor which creates a Dot11Deauthentication object from a buffer and adds @@ -2353,16 +2335,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Probe Request. * - * Constructor that builds a 802.11 Probe Request taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Probe Request taking the + * destination and source hardware address. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11ProbeRequest(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11ProbeRequest(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 @@ -2413,16 +2393,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Probe Response. * - * Constructor that builds a 802.11 Probe Response taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Probe Response taking the + * destination and source hardware addresses. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. */ - Dot11ProbeResponse(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type()); + Dot11ProbeResponse(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 @@ -2527,11 +2505,20 @@ namespace Tins { * \brief This PDU's flag. */ static const PDU::PDUType pdu_flag = PDU::DOT11_DATA; - - Dot11Data(const NetworkInterface &iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type(), - PDU* child = 0); + + /** + * \brief Constructor for creating a 802.11 Data frame. + * + * Constructs a 802.11 Data frame taking the + * destination and source hardware addresses. + * + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. + * \param child The inner PDU. + */ + Dot11Data(const address_type &dst_hw_addr = address_type(), + const address_type &src_hw_addr = address_type(), + PDU* child = 0); /** * \brief Constructor which creates a Dot11Data object from a buffer and adds all identifiable @@ -2674,18 +2661,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 QoS Data PDU * - * Constructor that builds a 802.11 QoS Data PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 QoS Data PDU taking the + * destination and source hardware addresses. * - * \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). + * \param dst_hw_addr The destination hardware address. + * \param src_hw_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11QoSData(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_hw_addr = address_type(), - const address_type &src_hw_addr = address_type(), - PDU* child = 0); + Dot11QoSData(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 @@ -2760,16 +2745,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 control frame PDU * - * Constructor that builds a 802.11 PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 Control PDU taking the destination and + * source hardware addresses. * - * \param iface string containing the interface's name from where to send the packet. - * \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional). + * \param dst_addr The destination hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11Control(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - PDU* child = 0); + Dot11Control(const address_type &dst_addr = address_type(), + PDU* child = 0); /** * \brief Constructor which creates an 802.11 control frame object from a buffer and @@ -2815,18 +2798,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 control frame TA PDU * - * Constructor that builds a 802.11 PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. * - * \param iface string containing the interface's name from where to send the packet. - * \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11ControlTA(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11ControlTA(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 @@ -2865,18 +2846,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 RTS frame PDU * - * Constructor that builds a 802.11 PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 RTS PDU taking the destination and source + * hardware addresses. * - * \param iface string containing the interface's name from where to send the packet. - * \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11RTS(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11RTS(const address_type &dst_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 @@ -2921,18 +2900,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 PS-Poll frame PDU * - * Constructor that builds a 802.11 PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. * - * \param iface string containing the interface's name from where to send the packet. - * \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11PSPoll(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11PSPoll(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 @@ -2977,18 +2954,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 CF-End frame PDU * - * Constructor that builds a 802.11 PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. * - * \param iface string containing the interface's name from where to send the packet. - * \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11CFEnd(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11CFEnd(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 @@ -3033,17 +3008,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 End-CF-Ack frame PDU * - * Constructor that builds a 802.11 PDU 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_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. + * + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11EndCFAck(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11EndCFAck(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 @@ -3088,16 +3062,14 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Ack frame PDU * - * Constructor that builds a 802.11 PDU taking the interface name, - * destination's and source's MAC. + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. * - * \param iface string containing the interface's name from where to send the packet. - * \param dst_addr uint8_t array of 6 bytes containing the destination's MAC(optional). + * \param dst_addr The destination hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11Ack(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - PDU* child = 0); + Dot11Ack(const address_type &dst_addr = address_type(), + PDU* child = 0); /** * \brief Constructor which creates an 802.11 Ack frame object from a buffer and @@ -3145,17 +3117,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Block Ack request frame PDU * - * Constructor that builds a 802.11 PDU 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_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. + * + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11BlockAckRequest(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11BlockAckRequest(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 @@ -3268,17 +3239,16 @@ namespace Tins { /** * \brief Constructor for creating a 802.11 Block Ack frame PDU * - * Constructor that builds a 802.11 PDU 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_addr uint8_t array of 6 bytes containing the destination's MAC(optional). - * \param target_addr uint8_t array of 6 bytes containing the source's MAC(optional). + * Constructs a 802.11 PDU taking the destination and source + * hardware addresses. + * + * \param dst_addr The destination hardware address. + * \param target_addr The source hardware address. * \param child PDU* with the PDU contained by the 802.11 PDU (optional). */ - Dot11BlockAck(const NetworkInterface& iface = NetworkInterface(), - const address_type &dst_addr = address_type(), - const address_type &target_addr = address_type(), - PDU* child = 0); + Dot11BlockAck(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 diff --git a/include/tcp_stream.h b/include/tcp_stream.h index 963e5c2..40189a0 100644 --- a/include/tcp_stream.h +++ b/include/tcp_stream.h @@ -218,11 +218,16 @@ public: * \brief Starts following TCP streams. * * This overload takes a range of iterators containing the PDUs - * in which TCP streams will be looked up and followed. + * in which TCP streams will be looked up and followed. The iterators + * will be dereferenced until a PDU& is found, so iterators can hold + * not only PDUs, but also smart pointers, etc. * * The template functors must accept a TCPStream& as argument, which * will point to the stream which has been modified. * + * The state of the PDUs stored in the iterator range provided might + * be modified internally. + * * \param start The start of the range of PDUs. * \param end The start of the range of PDUs. * \param data_fun The function which will be called whenever one of @@ -252,11 +257,16 @@ public: * \brief Starts following TCP streams. * * This overload takes a range of iterators containing the PDUs - * in which TCP streams will be looked up and followed. + * in which TCP streams will be looked up and followed. The iterators + * will be dereferenced until a PDU& is found, so iterators can hold + * not only PDUs, but also smart pointers, etc. * * The template functors must accept a TCPStream& as argument, which * will point to the stream which has been modified. * + * The state of the PDUs stored in the iterator range provided might + * be modified internally. + * * \param start The start of the range of PDUs. * \param end The start of the range of PDUs. * \param data_fun The function which will be called whenever one of diff --git a/src/dot11.cpp b/src/dot11.cpp index 4f5a33b..253b876 100644 --- a/src/dot11.cpp +++ b/src/dot11.cpp @@ -45,9 +45,8 @@ using std::runtime_error; namespace Tins { const Dot11::address_type Dot11::BROADCAST = "ff:ff:ff:ff:ff:ff"; -Dot11::Dot11(const NetworkInterface &iface, - const address_type &dst_hw_addr, PDU* child) -: PDU(ETHERTYPE_IP, child), _iface(iface), _options_size(0) +Dot11::Dot11(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); @@ -273,9 +272,9 @@ Dot11ManagementFrame::Dot11ManagementFrame(const uint8_t *buffer, uint32_t total } } -Dot11ManagementFrame::Dot11ManagementFrame(const NetworkInterface &iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11(iface, dst_hw_addr) +Dot11ManagementFrame::Dot11ManagementFrame(const address_type &dst_hw_addr, +const address_type &src_hw_addr) +: Dot11(dst_hw_addr) { type(Dot11::MANAGEMENT); memset(&_ext_header, 0, sizeof(_ext_header)); @@ -808,9 +807,9 @@ std::string Dot11ManagementFrame::challenge_text() const { /* Dot11Beacon */ -Dot11Beacon::Dot11Beacon(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -851,9 +850,10 @@ uint32_t Dot11Beacon::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz) /* Diassoc */ -Dot11Disassoc::Dot11Disassoc(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr){ +Dot11Disassoc::Dot11Disassoc(const address_type &dst_hw_addr, + const address_type &src_hw_addr) +: Dot11ManagementFrame(dst_hw_addr, src_hw_addr) +{ this->subtype(Dot11::DISASSOC); memset(&_body, 0, sizeof(_body)); } @@ -888,9 +888,9 @@ uint32_t Dot11Disassoc::write_fixed_parameters(uint8_t *buffer, uint32_t total_s /* Assoc request. */ -Dot11AssocRequest::Dot11AssocRequest(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -925,9 +925,9 @@ uint32_t Dot11AssocRequest::write_fixed_parameters(uint8_t *buffer, uint32_t tot /* Assoc response. */ -Dot11AssocResponse::Dot11AssocResponse(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -968,9 +968,9 @@ uint32_t Dot11AssocResponse::write_fixed_parameters(uint8_t *buffer, uint32_t to /* ReAssoc request. */ -Dot11ReAssocRequest::Dot11ReAssocRequest(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -1011,9 +1011,9 @@ uint32_t Dot11ReAssocRequest::write_fixed_parameters(uint8_t *buffer, uint32_t t /* ReAssoc response. */ -Dot11ReAssocResponse::Dot11ReAssocResponse(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -1054,9 +1054,9 @@ uint32_t Dot11ReAssocResponse::write_fixed_parameters(uint8_t *buffer, uint32_t /* Auth */ -Dot11Authentication::Dot11Authentication(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -1101,9 +1101,9 @@ uint32_t Dot11Authentication::write_fixed_parameters(uint8_t *buffer, uint32_t t /* Deauth */ -Dot11Deauthentication::Dot11Deauthentication(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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)); @@ -1139,9 +1139,9 @@ uint32_t Dot11Deauthentication::write_fixed_parameters(uint8_t *buffer, uint32_t /* Probe Request */ -Dot11ProbeRequest::Dot11ProbeRequest(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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); } @@ -1157,9 +1157,9 @@ Dot11ProbeRequest::Dot11ProbeRequest(const uint8_t *buffer, uint32_t total_sz) /* Probe Response */ -Dot11ProbeResponse::Dot11ProbeResponse(const NetworkInterface& iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr) -: Dot11ManagementFrame(iface, dst_hw_addr, src_hw_addr) +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(&_body, 0, sizeof(_body)); @@ -1222,10 +1222,9 @@ Dot11Data::Dot11Data(const uint8_t *buffer, uint32_t total_sz) } -Dot11Data::Dot11Data(const NetworkInterface &iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr, - PDU* child) -: Dot11(iface, dst_hw_addr, child) +Dot11Data::Dot11Data(const address_type &dst_hw_addr, + const address_type &src_hw_addr, PDU* child) +: Dot11(dst_hw_addr, child) { type(Dot11::DATA); memset(&_ext_header, 0, sizeof(_ext_header)); @@ -1273,10 +1272,9 @@ uint32_t Dot11Data::write_ext_header(uint8_t *buffer, uint32_t total_sz) { /* QoS data. */ -Dot11QoSData::Dot11QoSData(const NetworkInterface &iface, - const address_type &dst_hw_addr, const address_type &src_hw_addr, - PDU* child) -: Dot11Data(iface, dst_hw_addr, src_hw_addr, child) +Dot11QoSData::Dot11QoSData(const address_type &dst_hw_addr, + const address_type &src_hw_addr, PDU* child) +: Dot11Data(dst_hw_addr, src_hw_addr, child) { subtype(Dot11::QOS_DATA_DATA); _qos_control = 0; @@ -1315,9 +1313,8 @@ uint32_t Dot11QoSData::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz /* Dot11Control */ -Dot11Control::Dot11Control(const NetworkInterface &iface, - const address_type &dst_addr, PDU* child) -: Dot11(iface, dst_addr, child) +Dot11Control::Dot11Control(const address_type &dst_addr, PDU* child) +: Dot11(dst_addr, child) { type(CONTROL); } @@ -1329,9 +1326,9 @@ Dot11Control::Dot11Control(const uint8_t *buffer, uint32_t total_sz) /* Dot11ControlTA */ -Dot11ControlTA::Dot11ControlTA(const NetworkInterface &iface, - const address_type &dst_addr, const address_type &target_address, PDU* child) -: Dot11Control(iface, dst_addr, child) +Dot11ControlTA::Dot11ControlTA(const address_type &dst_addr, + const address_type &target_address, PDU* child) +: Dot11Control(dst_addr, child) { target_addr(target_address); } @@ -1362,9 +1359,9 @@ void Dot11ControlTA::target_addr(const address_type &addr) { /* Dot11RTS */ -Dot11RTS::Dot11RTS(const NetworkInterface &iface, const address_type &dst_addr, +Dot11RTS::Dot11RTS(const address_type &dst_addr, const address_type &target_addr, PDU* child) -: Dot11ControlTA(iface, dst_addr, target_addr, child) +: Dot11ControlTA(dst_addr, target_addr, child) { subtype(RTS); } @@ -1376,9 +1373,9 @@ Dot11RTS::Dot11RTS(const uint8_t *buffer, uint32_t total_sz) /* Dot11PSPoll */ -Dot11PSPoll::Dot11PSPoll(const NetworkInterface &iface, - const address_type &dst_addr, const address_type &target_addr, PDU* child) -: Dot11ControlTA(iface, dst_addr, target_addr, child) +Dot11PSPoll::Dot11PSPoll(const address_type &dst_addr, + const address_type &target_addr, PDU* child) +: Dot11ControlTA(dst_addr, target_addr, child) { subtype(PS); } @@ -1390,9 +1387,9 @@ Dot11PSPoll::Dot11PSPoll(const uint8_t *buffer, uint32_t total_sz) /* Dot11CFEnd */ -Dot11CFEnd::Dot11CFEnd(const NetworkInterface &iface, - const address_type &dst_addr, const address_type &target_addr, PDU* child) -: Dot11ControlTA(iface, dst_addr, target_addr, child) +Dot11CFEnd::Dot11CFEnd(const address_type &dst_addr, + const address_type &target_addr, PDU* child) +: Dot11ControlTA(dst_addr, target_addr, child) { subtype(CF_END); } @@ -1404,9 +1401,9 @@ Dot11CFEnd::Dot11CFEnd(const uint8_t *buffer, uint32_t total_sz) /* Dot11EndCFAck */ -Dot11EndCFAck::Dot11EndCFAck(const NetworkInterface &iface, - const address_type &dst_addr, const address_type &target_addr, PDU* child) -: Dot11ControlTA(iface, dst_addr, target_addr, child) +Dot11EndCFAck::Dot11EndCFAck(const address_type &dst_addr, + const address_type &target_addr, PDU* child) +: Dot11ControlTA(dst_addr, target_addr, child) { subtype(CF_END_ACK); } @@ -1418,9 +1415,8 @@ Dot11EndCFAck::Dot11EndCFAck(const uint8_t *buffer, uint32_t total_sz) /* Dot11Ack */ -Dot11Ack::Dot11Ack(const NetworkInterface &iface, - const address_type &dst_addr, PDU* child) -: Dot11Control(iface, dst_addr, child) +Dot11Ack::Dot11Ack(const address_type &dst_addr, PDU* child) +: Dot11Control(dst_addr, child) { subtype(ACK); } @@ -1431,9 +1427,9 @@ Dot11Ack::Dot11Ack(const uint8_t *buffer, uint32_t total_sz) : Dot11Control(buff /* Dot11BlockAck */ -Dot11BlockAckRequest::Dot11BlockAckRequest(const NetworkInterface &iface, - const address_type &dst_addr, const address_type &target_addr, PDU* child) -: Dot11ControlTA(iface, dst_addr, target_addr, child) +Dot11BlockAckRequest::Dot11BlockAckRequest(const address_type &dst_addr, + const address_type &target_addr, PDU* child) +: Dot11ControlTA(dst_addr, target_addr, child) { init_block_ack(); } @@ -1484,9 +1480,9 @@ uint32_t Dot11BlockAckRequest::header_size() const { /* Dot11BlockAck */ -Dot11BlockAck::Dot11BlockAck(const NetworkInterface &iface, - const address_type &dst_addr, const address_type &target_addr, PDU* child) -: Dot11ControlTA(iface, dst_addr, target_addr, child) +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)); diff --git a/tests/src/dot11/dot11.cpp b/tests/src/dot11/dot11.cpp index a2be284..205fa3d 100644 --- a/tests/src/dot11/dot11.cpp +++ b/tests/src/dot11/dot11.cpp @@ -73,7 +73,7 @@ TEST_F(Dot11Test, ConstructorFromBuffer) { } TEST_F(Dot11Test, SrcAddrConstructor) { - Dot11 dot11("lo", hwaddr); + Dot11 dot11(hwaddr); EXPECT_EQ(dot11.addr1(), hwaddr); }