PcapPlusPlus
pcpp::PPPoEDiscoveryLayer::PPPoETag Struct Reference

#include <PPPoELayer.h>

Public Member Functions

template<typename T >
getTagDataAs (int tagDataOffset=0)
 
template<typename T >
void setTagData (T value, int tagDataOffset=0)
 
size_t getTagTotalSize () const
 
PPPoEDiscoveryLayer::PPPoETagTypes getType ()
 

Public Attributes

uint16_t tagType
 
uint16_t tagDataLength
 
uint8_t tagData []
 

Detailed Description

Represents a PPPoE tag and its data

Member Function Documentation

template<typename T >
T pcpp::PPPoEDiscoveryLayer::PPPoETag::getTagDataAs ( int  tagDataOffset = 0)
inline

A templated method to retrieve the tag data as a certain type T. For example, if tag data is 4B (integer) then this method should be used as getTagDataAs<int>() and it will return the tag data as integer.
Notice this return value is a copy of the data, not a pointer to the actual data

Parameters
[in]tagDataOffsetAn optional parameter that specifies where to start copy the tag data. For example: if tag data is 20 bytes and you need only the 4 last bytes as integer then use this method like this: getTagDataAs<int>(16). The default is 0 - start copy from the beginning of tag data
Returns
The tag data as type T
size_t pcpp::PPPoEDiscoveryLayer::PPPoETag::getTagTotalSize ( ) const
Returns
The total size in bytes of this tag which includes: 2[Bytes] (tag name) + 2[Bytes] (tag length) + X[Bytes] (tag data length)
PPPoEDiscoveryLayer::PPPoETagTypes pcpp::PPPoEDiscoveryLayer::PPPoETag::getType ( )
Returns
The tag type converted to PPPoEDiscoveryLayer::PPPoETagTypes enum
template<typename T >
void pcpp::PPPoEDiscoveryLayer::PPPoETag::setTagData ( value,
int  tagDataOffset = 0 
)
inline

A templated method to copy data of type T into the tag data. For example: if tag data is 4[Bytes] long use this method like this to set an integer "num" into tag data: setTagData<int>(num)

Parameters
[in]valueThe value of type T to copy to tag data
[in]tagDataOffsetAn optional parameter that specifies where to start set the tag data. For example: if tag data is 20 bytes and you only need to set the 4 last bytes as integer then use this method like this: setTagDataAs<int>(num, 16). The default is 0 - start copy to the beginning of tag data

Member Data Documentation

uint8_t pcpp::PPPoEDiscoveryLayer::PPPoETag::tagData[]

A pointer to the tag data. It's recommended to use getTagDataAs() to retrieve the tag data or setTagData() to set tag data

uint16_t pcpp::PPPoEDiscoveryLayer::PPPoETag::tagDataLength

The length of the tag data

uint16_t pcpp::PPPoEDiscoveryLayer::PPPoETag::tagType

The type of the data, can be converted to PPPoEDiscoveryLayer::PPPoETagTypes enum (or use getType())