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. More...
|
|
Class that represents an ICMP extensions structure.
The type used to store the list of ICMP extensions in this structure
The type that will be returned when serializing an extensions structure object
Tins::ICMPExtensionsStructure::ICMPExtensionsStructure |
( |
| ) |
|
Default constructor.
This sets the version to 2, as specified in RFC 4884
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.
void Tins::ICMPExtensionsStructure::add_extension |
( |
const ICMPExtension & |
extension | ) |
|
Adds an extension to this structure.
- Parameters
-
extension | The extension to be added |
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 |
uint16_t Tins::ICMPExtensionsStructure::checksum |
( |
| ) |
const |
|
inline |
Getter for the checksum field.
- Returns
- The checksum field value
Getter for the extensions stored by this structure.
- Returns
- The extensions stored in this structure
void Tins::ICMPExtensionsStructure::reserved |
( |
small_uint< 12 > |
value | ) |
|
Setter for the reserved field.
- Parameters
-
value | The new reserved field value |
small_uint<12> Tins::ICMPExtensionsStructure::reserved |
( |
| ) |
const |
|
inline |
Getter for the reserved field.
- Returns
- The reserved field value
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 |
Serializes this extension structure.
- Returns
- The serialized extension structure
uint32_t Tins::ICMPExtensionsStructure::size |
( |
| ) |
const |
Gets the size of this ICMP extensions structure.
- Returns
- The size of this structure
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
void Tins::ICMPExtensionsStructure::version |
( |
small_uint< 4 > |
value | ) |
|
Setter for the version field.
- Parameters
-
value | The new version field value |
small_uint<4> Tins::ICMPExtensionsStructure::version |
( |
| ) |
const |
|
inline |
Getter for the version field.
- Returns
- The version field value
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:
- /home/matias/Projects/libtins/code/include/tins/icmp_extension.h
- /home/matias/Projects/libtins/code/src/icmp_extension.cpp