PcapPlusPlus  19.12
pcpp::IPv6RoutingHeader Class Reference

#include <IPv6Extensions.h>

Inheritance diagram for pcpp::IPv6RoutingHeader:
pcpp::IPv6Extension

Classes

struct  ipv6_routing_header
 

Public Member Functions

 IPv6RoutingHeader (uint8_t routingType, uint8_t segmentsLeft, const uint8_t *additionalRoutingData, size_t additionalRoutingDataLen)
 
ipv6_routing_headergetRoutingHeader () const
 
uint8_t * getRoutingAdditionalData () const
 
size_t getRoutingAdditionalDataLength () const
 
IPv6Address getRoutingAdditionalDataAsIPv6Address (size_t offset=0) const
 
- Public Member Functions inherited from pcpp::IPv6Extension
virtual size_t getExtensionLen () const
 
IPv6ExtensionType getExtensionType () const
 
virtual ~IPv6Extension ()
 
IPv6ExtensiongetNextHeader () const
 

Additional Inherited Members

- Public Types inherited from pcpp::IPv6Extension
enum  IPv6ExtensionType {
  IPv6HopByHop = 0, IPv6Routing = 43, IPv6Fragmentation = 44, IPv6AuthenticationHdr = 51,
  IPv6Destination = 60, IPv6ExtensionUnknown = 255
}
 

Detailed Description

Represents IPv6 routing extension header and allows easy access to all of its data

Constructor & Destructor Documentation

◆ IPv6RoutingHeader()

pcpp::IPv6RoutingHeader::IPv6RoutingHeader ( uint8_t  routingType,
uint8_t  segmentsLeft,
const uint8_t *  additionalRoutingData,
size_t  additionalRoutingDataLen 
)

A c'tor for creating a new IPv6 routing extension object not bounded to a packet. Useful for adding new extensions to an IPv6 layer with IPv6Layer::addExtension()

Parameters
[in]routingTypeRouting type value (will be written to ipv6_routing_header::routingType field)
[in]segmentsLeftSegments left value (will be written to ipv6_routing_header::segmentsLeft field)
[in]additionalRoutingDataA pointer to a buffer containing the additional routing data for this extension. Notice this buffer is read-only and its content isn't modified
[in]additionalRoutingDataLenThe length of the additional routing data buffer

Member Function Documentation

◆ getRoutingAdditionalData()

uint8_t* pcpp::IPv6RoutingHeader::getRoutingAdditionalData ( ) const
Returns
A pointer to the buffer containing the additional routing data for this extension. Notice that any change in this buffer will lead to a change in the extension data

◆ getRoutingAdditionalDataAsIPv6Address()

IPv6Address pcpp::IPv6RoutingHeader::getRoutingAdditionalDataAsIPv6Address ( size_t  offset = 0) const

In many cases the additional routing data is actually IPv6 address(es). This method converts the raw buffer data into an IPv6 address

Parameters
[in]offsetAn offset in the additional routing buffer pointing to where the IPv6 address begins. In some cases there are multiple IPv6 addresses in the additional routing data buffer so this offset points to where the request IPv6 address begins. Also, even if there is only one IPv6 address in this buffer, sometimes it isn't written in the beginning of the buffer, so the offset points to where the IPv6 address begins. This is an optional parameter and the default offset is 0
Returns
The IPv6 address stored in the additional routing data buffer from the offset defined by the user. If offset is out-of-bounds of the extension of doesn't have 16 bytes (== the length of IPv6 address) until the end of the buffer - IPv6Address::Zero is returned

◆ getRoutingAdditionalDataLength()

size_t pcpp::IPv6RoutingHeader::getRoutingAdditionalDataLength ( ) const
Returns
The length of the additional routing parameters buffer

◆ getRoutingHeader()

ipv6_routing_header* pcpp::IPv6RoutingHeader::getRoutingHeader ( ) const
inline

Get a pointer to the fixed part of the routing header. Notice the return pointer points directly to the data, so every change will modify the actual packet data

Returns
A pointer to the ipv6_routing_header