PcapPlusPlus  21.11
pcpp::PPPoESessionLayer Class Reference

#include <PPPoELayer.h>

Inheritance diagram for pcpp::PPPoESessionLayer:
pcpp::PPPoELayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 PPPoESessionLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 PPPoESessionLayer (uint8_t version, uint8_t type, uint16_t sessionId, uint16_t pppNextProtocol)
 
uint16_t getPPPNextProtocol () const
 
void setPPPNextProtocol (uint16_t nextProtocol)
 
virtual void parseNextLayer ()
 
virtual size_t getHeaderLen () const
 
virtual std::string toString () const
 
- Public Member Functions inherited from pcpp::PPPoELayer
pppoe_headergetPPPoEHeader () const
 
virtual void computeCalculateFields ()
 
OsiModelLayer getOsiModelLayer () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () 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 bool isDataValid (const uint8_t *data, size_t dataLen)
 

Additional Inherited Members

- Public Types inherited from pcpp::PPPoELayer
enum  PPPoECode {
  PPPOE_CODE_SESSION = 0x00, PPPOE_CODE_PADO = 0x07, PPPOE_CODE_PADI = 0x09, PPPOE_CODE_PADG = 0x0a,
  PPPOE_CODE_PADC = 0x0b, PPPOE_CODE_PADQ = 0x0c, PPPOE_CODE_PADR = 0x19, PPPOE_CODE_PADS = 0x65,
  PPPOE_CODE_PADT = 0xa7, PPPOE_CODE_PADM = 0xd3, PPPOE_CODE_PADN = 0xd4
}
 

Detailed Description

Describes the PPPoE session protocol

Constructor & Destructor Documentation

◆ PPPoESessionLayer() [1/2]

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

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

Parameters
[in]dataA pointer to the raw data (will be casted to pppoe_header)
[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 in

◆ PPPoESessionLayer() [2/2]

pcpp::PPPoESessionLayer::PPPoESessionLayer ( uint8_t  version,
uint8_t  type,
uint16_t  sessionId,
uint16_t  pppNextProtocol 
)
inline

A constructor that allocates a new PPPoE Session header with version, type and session ID

Parameters
[in]versionPPPoE version
[in]typePPPoE type
[in]sessionIdPPPoE session ID
[in]pppNextProtocolThe next protocol to come after the PPPoE session header. Should be one of the PPP_* macros listed below

Member Function Documentation

◆ getHeaderLen()

virtual size_t pcpp::PPPoESessionLayer::getHeaderLen ( ) const
inlinevirtual
Returns
Size of pppoe_header

Implements pcpp::Layer.

◆ getPPPNextProtocol()

uint16_t pcpp::PPPoESessionLayer::getPPPNextProtocol ( ) const
Returns
The protocol after the PPPoE session header. The return value is one of the PPP_* macros listed below. This method is also used when parsing a packet (this way we know which layer comes after the PPPoE session)

◆ isDataValid()

bool pcpp::PPPoESessionLayer::isDataValid ( const uint8_t *  data,
size_t  dataLen 
)
inlinestatic

A static method that validates the input data

Parameters
[in]dataThe pointer to the beginning of byte stream of a packet
[in]dataLenThe length of the byte stream
Returns
True if the data is valid and can represent a PPPoES packet

◆ parseNextLayer()

virtual void pcpp::PPPoESessionLayer::parseNextLayer ( )
virtual

Currently identifies the following next layers: IPv4Layer, IPv6Layer. Otherwise sets PayloadLayer

Implements pcpp::Layer.

◆ setPPPNextProtocol()

void pcpp::PPPoESessionLayer::setPPPNextProtocol ( uint16_t  nextProtocol)

Set the field that describes which header comes after the PPPoE session header

Parameters
[in]nextProtocolThe protocol value. Should be one of the PPP_* macros listed below

◆ toString()

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

Implements pcpp::Layer.