PcapPlusPlus  Next
pcpp::CiscoHdlcLayer Class Reference

#include <CiscoHdlcLayer.h>

Inheritance diagram for pcpp::CiscoHdlcLayer:
pcpp::Layer pcpp::IDataContainer

Public Types

enum class  AddressType { Unicast = 0x0f , Multicast = 0x8f , Unknown }
 

Public Member Functions

 CiscoHdlcLayer (uint8_t *data, size_t dataLen, Packet *packet)
 
 CiscoHdlcLayer (AddressType address)
 
 ~CiscoHdlcLayer () override=default
 Default destructor for this layer.
 
AddressType getAddress () const
 
uint8_t getAddressValue () const
 
void setAddress (AddressType address)
 
void setAddressValue (uint8_t address)
 
uint16_t getNextProtocol () const
 
size_t getHeaderLen () const override
 
void computeCalculateFields () override
 Calculate the Next Protocol when possible.
 
void parseNextLayer () override
 Parses the next layer. Currently, supports IPv4 and IPv6.
 
std::string toString () const override
 
OsiModelLayer getOsiModelLayer () const override
 
- Public Member Functions inherited from pcpp::Layer
 ~Layer () override
 
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 override
 

Static Public Member Functions

static bool isDataValid (const uint8_t *data, size_t dataLen)
 

Detailed Description

Represents a Cisco HDLC protocol layer

Member Enumeration Documentation

◆ AddressType

Represents Cisco HDLC address types

Enumerator
Unicast 

Unicast.

Multicast 

Multicast.

Unknown 

Unknown address type.

Constructor & Destructor Documentation

◆ CiscoHdlcLayer() [1/2]

pcpp::CiscoHdlcLayer::CiscoHdlcLayer ( uint8_t *  data,
size_t  dataLen,
Packet packet 
)
inline

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

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

◆ CiscoHdlcLayer() [2/2]

pcpp::CiscoHdlcLayer::CiscoHdlcLayer ( AddressType  address)
explicit

A constructor that creates a new Cisco HDLC layer

Parameters
[in]addressThe address field value

Member Function Documentation

◆ getAddress()

AddressType pcpp::CiscoHdlcLayer::getAddress ( ) const
Returns
The address field enum value

◆ getAddressValue()

uint8_t pcpp::CiscoHdlcLayer::getAddressValue ( ) const
Returns
The address field raw value

◆ getHeaderLen()

size_t pcpp::CiscoHdlcLayer::getHeaderLen ( ) const
inlineoverridevirtual
Returns
The size of the HDLC header which is 4 bytes

Implements pcpp::Layer.

◆ getNextProtocol()

uint16_t pcpp::CiscoHdlcLayer::getNextProtocol ( ) const
Returns
The protocol type value

◆ getOsiModelLayer()

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

Implements pcpp::Layer.

◆ isDataValid()

static bool pcpp::CiscoHdlcLayer::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 a byte stream of a Cisco HDLC packet
[in]dataLenThe length of the byte stream
Returns
True if the data is valid and can represent a Cisco HDLC packet

◆ setAddress()

void pcpp::CiscoHdlcLayer::setAddress ( AddressType  address)

Set the address field enum value

Parameters
[in]addressThe address enum value to set

◆ setAddressValue()

void pcpp::CiscoHdlcLayer::setAddressValue ( uint8_t  address)

Set the address field value

Parameters
[in]addressThe address value to set

◆ toString()

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

Implements pcpp::Layer.