34#include <tins/macros.h>
35#include <tins/endianness.h>
36#include <tins/small_uint.h>
77 Dot1Q(
const uint8_t* buffer, uint32_t total_sz);
99 return header_.priority;
115 #if TINS_IS_LITTLE_ENDIAN
116 return header_.idL | (header_.idH << 8);
127 return Endian::be_to_host(header_.type);
142 return new Dot1Q(*
this);
150 return append_padding_;
177 void payload_type(uint16_t new_type);
189 void append_padding(
bool value);
198 bool matches_response(
const uint8_t* ptr, uint32_t total_sz)
const;
200 void write_serialization(uint8_t* buffer, uint32_t total_sz);
203 struct dot1q_header {
204 #if TINS_IS_BIG_ENDIAN
218 static uint16_t get_id(
const dot1q_header* hdr);
220 dot1q_header header_;
221 bool append_padding_;
small_uint< 1 > cfi() const
Getter for the Canonical Format Identifier field.
Definition dot1q.h:106
Dot1Q(small_uint< 12 > tag_id=0, bool append_pad=true)
Definition dot1q.cpp:48
Dot1Q * clone() const
Definition dot1q.h:141
static const PDU::PDUType pdu_flag
Definition dot1q.h:49
small_uint< 3 > priority() const
Getter for the priority field.
Definition dot1q.h:98
small_uint< 12 > id() const
Getter for the VLAN ID field.
Definition dot1q.h:114
uint32_t trailer_size() const
Returns the frame's trailer size.
Definition dot1q.cpp:94
bool append_padding() const
Retrieves the flag indicating whether padding will be appended at the end of this packet.
Definition dot1q.h:149
static metadata extract_metadata(const uint8_t *buffer, uint32_t total_sz)
Extracts metadata for this protocol based on the buffer provided.
Definition dot1q.cpp:41
uint32_t header_size() const
Returns the header size.
Definition dot1q.cpp:90
uint16_t payload_type() const
Getter for the payload type field.
Definition dot1q.h:126
PDUType pdu_type() const
Getter for the PDU's type.
Definition dot1q.h:134
PDU()
Default constructor.
Definition pdu.cpp:50
PDUType
Enum which identifies each type of PDU.
Definition pdu.h:127
Represents a field of n bits.
Definition small_uint.h:52
The Tins namespace.
Definition address_range.h:38