PcapPlusPlus  24.09
pcpp::IcmpV6Layer Class Reference

#include <IcmpV6Layer.h>

Inheritance diagram for pcpp::IcmpV6Layer:
pcpp::Layer pcpp::IDataContainer pcpp::ICMPv6EchoLayer pcpp::NDPLayerBase pcpp::NDPNeighborAdvertisementLayer pcpp::NDPNeighborSolicitationLayer

Public Member Functions

 IcmpV6Layer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 IcmpV6Layer (ICMPv6MessageType msgType, uint8_t code, const uint8_t *data, size_t dataLen)
 
bool isMessageOfType (ICMPv6MessageType type) const
 
ICMPv6MessageType getMessageType () const
 
uint8_t getCode () const
 
uint16_t getChecksum () const
 
void parseNextLayer ()
 
size_t getHeaderLen () const
 
void computeCalculateFields ()
 
OsiModelLayer getOsiModelLayer () const
 
std::string toString () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
bool isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const
 
uint8_t * getData () const
 
size_t getDataLen () const
 
uint8_t * getLayerPayload () const
 
size_t getLayerPayloadSize () const
 
bool isAllocatedToPacket () const
 
void copyData (uint8_t *toArr) const
 
uint8_t * getDataPtr (size_t offset=0) const
 

Static Public Member Functions

static LayerparseIcmpV6Layer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 

Detailed Description

Base class for ICMPv6 protocol layers which provides common logic for ICMPv6 messages.

Constructor & Destructor Documentation

◆ IcmpV6Layer() [1/2]

pcpp::IcmpV6Layer::IcmpV6Layer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
inline

A constructor that creates the layer from an existing packet raw data

Parameters
dataA pointer to the raw data
dataLenSize of the data in bytes
prevLayerA pointer to the previous layer
packetA pointer to the Packet instance where layer will be stored in

◆ IcmpV6Layer() [2/2]

pcpp::IcmpV6Layer::IcmpV6Layer ( ICMPv6MessageType  msgType,
uint8_t  code,
const uint8_t *  data,
size_t  dataLen 
)

A constructor that allocates a new ICMPv6 layer with type, code and data

Parameters
[in]msgTypeMessage type of the ICMPv6 layer
[in]codeCode field of the ICMPv6 layer
[in]dataA pointer to the payload to set
[in]dataLenThe length of the payload

Member Function Documentation

◆ computeCalculateFields()

void pcpp::IcmpV6Layer::computeCalculateFields ( )
virtual

Calculate ICMPv6 checksum field

Implements pcpp::Layer.

◆ getChecksum()

uint16_t pcpp::IcmpV6Layer::getChecksum ( ) const
Returns
Get the checksum header field in host representation

◆ getCode()

uint8_t pcpp::IcmpV6Layer::getCode ( ) const
Returns
Get the code header field

◆ getHeaderLen()

size_t pcpp::IcmpV6Layer::getHeaderLen ( ) const
inlinevirtual
Returns
The size of the ICMPv6 message

Implements pcpp::Layer.

◆ getMessageType()

ICMPv6MessageType pcpp::IcmpV6Layer::getMessageType ( ) const
Returns
Get the ICMPv6 Message Type

◆ getOsiModelLayer()

OsiModelLayer pcpp::IcmpV6Layer::getOsiModelLayer ( ) const
inlinevirtual
Returns
The OSI Model layer this protocol belongs to

Implements pcpp::Layer.

◆ isMessageOfType()

bool pcpp::IcmpV6Layer::isMessageOfType ( ICMPv6MessageType  type) const
inline
Parameters
[in]typeType to check
Returns
True if the layer if of the given type, false otherwise

◆ parseIcmpV6Layer()

static Layer* pcpp::IcmpV6Layer::parseIcmpV6Layer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
static

A static method that creates an ICMPv6 layer from packet raw data

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored
Returns
Layer* A newly allocated ICMPv6 layer

◆ parseNextLayer()

void pcpp::IcmpV6Layer::parseNextLayer ( )
inlinevirtual

Does nothing for this layer. ICMPv6 is the last layer.

Implements pcpp::Layer.

◆ toString()

std::string pcpp::IcmpV6Layer::toString ( ) const
virtual
Returns
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.

Reimplemented in pcpp::NDPNeighborAdvertisementLayer, pcpp::NDPNeighborSolicitationLayer, and pcpp::ICMPv6EchoLayer.