34 #include <tins/macros.h> 35 #include <tins/endianness.h> 36 #include <tins/small_uint.h> 57 static metadata extract_metadata(
const uint8_t *buffer, uint32_t total_sz);
77 Dot1Q(
const uint8_t* buffer, uint32_t total_sz);
86 uint32_t header_size()
const;
92 uint32_t trailer_size()
const;
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_;
225 #endif // TINS_DOT1Q_H small_uint< 1 > cfi() const
Getter for the Canonical Format Identifier field.
Definition: dot1q.h:106
Dot1Q * clone() const
Definition: dot1q.h:141
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
bool append_padding() const
Retrieves the flag indicating whether padding will be appended at the end of this packet...
Definition: dot1q.h:149
small_uint< 3 > priority() const
Getter for the priority field.
Definition: dot1q.h:98
The Tins namespace.
Definition: address_range.h:38
small_uint< 12 > id() const
Getter for the VLAN ID field.
Definition: dot1q.h:114
PDUType pdu_type() const
Getter for the PDU's type.
Definition: dot1q.h:134
uint16_t payload_type() const
Getter for the payload type field.
Definition: dot1q.h:126
Base class for protocol data units.
Definition: pdu.h:107