Class that represents an ICMP extensions structure.
More...
#include <icmp_extension.h>
|
static bool | validate_extensions (const uint8_t *buffer, uint32_t total_sz) |
| Validates if the given input contains a valid extension structure.
|
|
Class that represents an ICMP extensions structure.
◆ extensions_type
The type used to store the list of ICMP extensions in this structure
◆ serialization_type
The type that will be returned when serializing an extensions structure object
◆ ICMPExtensionsStructure() [1/2]
Tins::ICMPExtensionsStructure::ICMPExtensionsStructure |
( |
| ) |
|
Default constructor.
This sets the version to 2, as specified in RFC 4884
◆ ICMPExtensionsStructure() [2/2]
Tins::ICMPExtensionsStructure::ICMPExtensionsStructure |
( |
const uint8_t * | buffer, |
|
|
uint32_t | total_sz ) |
Constructor from a buffer.
This constructor will find, parse and store the extension stack in the buffer.
◆ add_extension() [1/2]
void Tins::ICMPExtensionsStructure::add_extension |
( |
const ICMPExtension & | extension | ) |
|
Adds an extension to this structure.
- Parameters
-
extension | The extension to be added |
◆ add_extension() [2/2]
void Tins::ICMPExtensionsStructure::add_extension |
( |
MPLS & | mpls | ) |
|
Adds an MPLS extension to this structure.
This will construct an extension using the provided MPLS packet as its payload. The class and type fields will be set appropriately.
- Parameters
-
extension | The MPLS payload to be used for the new extension |
◆ checksum()
uint16_t Tins::ICMPExtensionsStructure::checksum |
( |
| ) |
const |
|
inline |
Getter for the checksum field.
- Returns
- The checksum field value
◆ extensions()
const extensions_type & Tins::ICMPExtensionsStructure::extensions |
( |
| ) |
const |
|
inline |
Getter for the extensions stored by this structure.
- Returns
- The extensions stored in this structure
◆ reserved() [1/2]
small_uint< 12 > Tins::ICMPExtensionsStructure::reserved |
( |
| ) |
const |
|
inline |
Getter for the reserved field.
- Returns
- The reserved field value
◆ reserved() [2/2]
void Tins::ICMPExtensionsStructure::reserved |
( |
small_uint< 12 > | value | ) |
|
Setter for the reserved field.
- Parameters
-
value | The new reserved field value |
◆ serialize() [1/2]
Serializes this extension structure.
- Returns
- The serialized extension structure
◆ serialize() [2/2]
void Tins::ICMPExtensionsStructure::serialize |
( |
uint8_t * | buffer, |
|
|
uint32_t | buffer_size ) |
Serializes this extension structure into a buffer.
- Parameters
-
buffer | The output buffer in which to store the serialization |
buffer_size | The size of the output buffer |
◆ size()
uint32_t Tins::ICMPExtensionsStructure::size |
( |
| ) |
const |
Gets the size of this ICMP extensions structure.
- Returns
- The size of this structure
◆ validate_extensions()
bool Tins::ICMPExtensionsStructure::validate_extensions |
( |
const uint8_t * | buffer, |
|
|
uint32_t | total_sz ) |
|
static |
Validates if the given input contains a valid extension structure.
The validation is performed by calculating the checksum of the input and comparing to the checksum value in the input buffer.
- Parameters
-
buffer | The input buffer |
total_sz | The size of the input buffer |
- Returns
- true iff the buffer contains a valid ICMP extensions structure
◆ version() [1/2]
small_uint< 4 > Tins::ICMPExtensionsStructure::version |
( |
| ) |
const |
|
inline |
Getter for the version field.
- Returns
- The version field value
◆ version() [2/2]
void Tins::ICMPExtensionsStructure::version |
( |
small_uint< 4 > | value | ) |
|
Setter for the version field.
- Parameters
-
value | The new version field value |
◆ MINIMUM_ICMP_PAYLOAD
const uint32_t Tins::ICMPExtensionsStructure::MINIMUM_ICMP_PAYLOAD = 128 |
|
static |
The minimum ICMP payload size that has to be present when the PDU contains extensions.
The documentation for this class was generated from the following files:
- /builddir/build/BUILD/libtins-4.5-build/libtins-4.5/include/tins/icmp_extension.h
- /builddir/build/BUILD/libtins-4.5-build/libtins-4.5/src/icmp_extension.cpp