libtins 4.5
Loading...
Searching...
No Matches
Tins::ICMPExtension Class Reference

Class that represents an ICMP extension object. More...

#include <icmp_extension.h>

Public Types

typedef std::vector< uint8_t > payload_type
 
typedef std::vector< uint8_t > serialization_type
 

Public Member Functions

 ICMPExtension ()
 Default constructor.
 
 ICMPExtension (uint8_t ext_class, uint8_t ext_type)
 Constructor taking class and type.
 
 ICMPExtension (const uint8_t *buffer, uint32_t total_sz)
 Constructs an ICMP extension from a buffer.
 
void extension_class (uint8_t value)
 Setter for the extension class field.
 
void extension_type (uint8_t value)
 Setter for the extension sub-type field.
 
void payload (const payload_type &value)
 Setter for the payload field.
 
uint8_t extension_class () const
 Getter for the extension class field.
 
uint8_t extension_type () const
 Getter for the extension sub-type field.
 
const payload_typepayload () const
 Getter for the extension payload field.
 
uint32_t size () const
 Gets the size of this ICMP extension.
 
void serialize (uint8_t *buffer, uint32_t buffer_size) const
 Serializes this extension into a buffer.
 
serialization_type serialize () const
 Serializes this extension object.
 

Detailed Description

Class that represents an ICMP extension object.

Member Typedef Documentation

◆ payload_type

std::vector<uint8_t> Tins::ICMPExtension::payload_type

The type used to store the payload

◆ serialization_type

The type that will be returned when serializing an extensions structure object

Constructor & Destructor Documentation

◆ ICMPExtension() [1/2]

Tins::ICMPExtension::ICMPExtension ( uint8_t ext_class,
uint8_t ext_type )

Constructor taking class and type.

Parameters
ext_classThe extension class
ext_typeThe extension sub-type

◆ ICMPExtension() [2/2]

Tins::ICMPExtension::ICMPExtension ( const uint8_t * buffer,
uint32_t total_sz )

Constructs an ICMP extension from a buffer.

Parameters
bufferThe input buffer
total_szThe input buffer size

Member Function Documentation

◆ extension_class() [1/2]

uint8_t Tins::ICMPExtension::extension_class ( ) const
inline

Getter for the extension class field.

Returns
The extension class field value

◆ extension_class() [2/2]

void Tins::ICMPExtension::extension_class ( uint8_t value)

Setter for the extension class field.

Parameters
valueThe new extension class field value

◆ extension_type() [1/2]

uint8_t Tins::ICMPExtension::extension_type ( ) const
inline

Getter for the extension sub-type field.

Returns
The extension sub-type field value

◆ extension_type() [2/2]

void Tins::ICMPExtension::extension_type ( uint8_t value)

Setter for the extension sub-type field.

Parameters
valueThe new extension sub-type field value

◆ payload() [1/2]

const payload_type & Tins::ICMPExtension::payload ( ) const
inline

Getter for the extension payload field.

Returns
The extension payload field value

◆ payload() [2/2]

void Tins::ICMPExtension::payload ( const payload_type & value)

Setter for the payload field.

Parameters
valueThe new payload field value

◆ serialize() [1/2]

ICMPExtension::serialization_type Tins::ICMPExtension::serialize ( ) const

Serializes this extension object.

Returns
The serialized extension

◆ serialize() [2/2]

void Tins::ICMPExtension::serialize ( uint8_t * buffer,
uint32_t buffer_size ) const

Serializes this extension into a buffer.

Parameters
bufferThe output buffer in which to store the serialization
buffer_sizeThe size of the output buffer

◆ size()

uint32_t Tins::ICMPExtension::size ( ) const

Gets the size of this ICMP extension.

This returns the basic header size + the payload size

Returns
The size of this extension

The documentation for this class was generated from the following files: