30 #ifndef TINS_ICMP_EXTENSION_H 31 #define TINS_ICMP_EXTENSION_H 35 #include <tins/macros.h> 36 #include <tins/small_uint.h> 37 #include <tins/endianness.h> 85 void extension_class(uint8_t value);
92 void extension_type(uint8_t value);
99 void payload(
const payload_type& value);
107 return extension_class_;
116 return extension_type_;
135 uint32_t size()
const;
143 void serialize(uint8_t* buffer, uint32_t buffer_size)
const;
150 serialization_type serialize()
const;
152 static const uint32_t BASE_HEADER_SIZE;
154 payload_type payload_;
155 uint8_t extension_class_, extension_type_;
215 uint16_t value = Endian::be_to_host(version_and_reserved_);
216 return (value >> 12) & 0xf;
225 uint16_t value = Endian::be_to_host(version_and_reserved_);
226 return value & 0xfff;
235 return Endian::be_to_host(checksum_);
262 void add_extension(
MPLS& mpls);
269 uint32_t size()
const;
277 void serialize(uint8_t* buffer, uint32_t buffer_size);
284 serialization_type serialize();
296 static bool validate_extensions(
const uint8_t* buffer, uint32_t total_sz);
298 static const uint32_t BASE_HEADER_SIZE;
300 uint16_t version_and_reserved_;
302 extensions_type extensions_;
307 #endif // TINS_ICMP_EXTENSION_H uint8_t extension_class() const
Getter for the extension class field.
Definition: icmp_extension.h:106
Represents an MPLS PDU.
Definition: mpls.h:46
std::vector< uint8_t > serialization_type
Definition: icmp_extension.h:57
std::vector< ICMPExtension > extensions_type
Definition: icmp_extension.h:178
Class that represents an ICMP extension object.
Definition: icmp_extension.h:46
ICMPExtension::serialization_type serialization_type
Definition: icmp_extension.h:173
uint8_t extension_type() const
Getter for the extension sub-type field.
Definition: icmp_extension.h:115
small_uint< 12 > reserved() const
Getter for the reserved field.
Definition: icmp_extension.h:224
The Tins namespace.
Definition: address_range.h:38
small_uint< 4 > version() const
Getter for the version field.
Definition: icmp_extension.h:214
const extensions_type & extensions() const
Getter for the extensions stored by this structure.
Definition: icmp_extension.h:243
std::vector< uint8_t > payload_type
Definition: icmp_extension.h:51
uint16_t checksum() const
Getter for the checksum field.
Definition: icmp_extension.h:234
Class that represents an ICMP extensions structure.
Definition: icmp_extension.h:161
const payload_type & payload() const
Getter for the extension payload field.
Definition: icmp_extension.h:124
static const uint32_t MINIMUM_ICMP_PAYLOAD
Definition: icmp_extension.h:167