PcapPlusPlus  23.09
pcpp::CotpLayer Class Reference

#include <CotpLayer.h>

Inheritance diagram for pcpp::CotpLayer:
pcpp::Layer pcpp::IDataContainer

Public Member Functions

 CotpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 CotpLayer (uint8_t tpduNumber)
 
uint8_t getLength () const
 
uint8_t getPduType () const
 
uint8_t getTpduNumber () const
 
size_t getHeaderLen () const override
 
void setLength (uint8_t length) const
 
void setPduType (uint8_t pduType) const
 
void setTpduNumber (uint8_t tpduNumber) const
 
void computeCalculateFields () override
 
void parseNextLayer () override
 
std::string toString () const override
 
OsiModelLayer getOsiModelLayer () const override
 
- 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 dataSize)
 

Detailed Description

Represents a COTP (Connection Oriented Transport Protocol)

Constructor & Destructor Documentation

◆ CotpLayer() [1/2]

pcpp::CotpLayer::CotpLayer ( 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 cotphdr)
[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

◆ CotpLayer() [2/2]

pcpp::CotpLayer::CotpLayer ( uint8_t  tpduNumber)
explicit

A constructor that allocates a new COTP header

Parameters
[in]tpduNumberProtocol TPDU number

Member Function Documentation

◆ computeCalculateFields()

void pcpp::CotpLayer::computeCalculateFields ( )
inlineoverridevirtual

Does nothing for this layer

Implements pcpp::Layer.

◆ getHeaderLen()

size_t pcpp::CotpLayer::getHeaderLen ( ) const
inlineoverridevirtual
Returns
Size of cotphdr

Implements pcpp::Layer.

◆ getLength()

uint8_t pcpp::CotpLayer::getLength ( ) const
Returns
COTP length

◆ getOsiModelLayer()

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

Implements pcpp::Layer.

◆ getPduType()

uint8_t pcpp::CotpLayer::getPduType ( ) const
Returns
COTP PDU type

◆ getTpduNumber()

uint8_t pcpp::CotpLayer::getTpduNumber ( ) const
Returns
COTP TPDU number

◆ isDataValid()

static bool pcpp::CotpLayer::isDataValid ( const uint8_t *  data,
size_t  dataSize 
)
static

A static method that takes a byte array and detects whether it is a COTP

Parameters
[in]dataA byte array
[in]dataSizeThe byte array size (in bytes)
Returns
True if the data looks like a valid COTP layer

◆ parseNextLayer()

void pcpp::CotpLayer::parseNextLayer ( )
overridevirtual

Currently parses the rest of the packet as a generic payload (PayloadLayer)

Implements pcpp::Layer.

◆ setLength()

void pcpp::CotpLayer::setLength ( uint8_t  length) const

Set the value of the length

Parameters
[in]lengthThe value of the length

◆ setPduType()

void pcpp::CotpLayer::setPduType ( uint8_t  pduType) const

Set the value of the version

Parameters
[in]pduTypeThe number of the PDU type

◆ setTpduNumber()

void pcpp::CotpLayer::setTpduNumber ( uint8_t  tpduNumber) const

Set the value of the version

Parameters
[in]tpduNumberThe value of the TPDU number

◆ toString()

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

Implements pcpp::Layer.