1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 04:54:28 +01:00

Added some helper methods to Dot1Q.

This commit is contained in:
Matias Fontanini
2013-03-26 23:42:43 -03:00
parent dfc0498b70
commit 97049140af
4 changed files with 41 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ public:
/**
* Default constructor
*/
Dot1Q();
Dot1Q(small_uint<12> tag_id = 0, bool append_pad = true);
/**
* \brief Constructor which creates an Dot1Q object from a buffer and
@@ -120,6 +120,14 @@ public:
return new Dot1Q(*this);
}
/**
* \brief Retrieves the flag indicating whether padding will be
* appended at the end of this packet.
*/
bool append_padding() const {
return _append_padding;
}
// Setters
/**
@@ -146,6 +154,18 @@ public:
*/
void payload_type(uint16_t new_type);
/**
* \brief Indicates whether the appropriate padding will be
* at the end of the packet.
*
* This flag could be disabled in case two or more contiguous Dot1Q
* PDUs are added to a packet. In that case, only the Dot1Q which is
* closer to the link layer should add the padding at the end.
*
* \param value A boolean indicating whether padding will be appended.
*/
void append_padding(bool value);
/**
* \brief Check wether ptr points to a valid response for this PDU.
*
@@ -175,6 +195,7 @@ private:
static uint16_t get_id(const dot1q_hdr *hdr);
dot1q_hdr _header;
bool _append_padding;
};
}

View File

@@ -41,6 +41,8 @@
#include "icmp.h"
#include "icmpv6.h"
#include "dot11.h"
#include "dot1q.h"
#include "dot3.h"
#include "ip.h"
#include "ipv6.h"
#include "packet_sender.h"