PcapPlusPlus  Next
pcpp::DoIpLayer Class Referenceabstract

#include <DoIpLayer.h>

Inheritance diagram for pcpp::DoIpLayer:
pcpp::Layer pcpp::IDataContainer pcpp::DoIpAliveCheckRequest pcpp::DoIpAliveCheckResponse pcpp::DoIpDiagnosticBase pcpp::DoIpDiagnosticPowerModeRequest pcpp::DoIpDiagnosticPowerModeResponse pcpp::DoIpEntityStatusRequest pcpp::DoIpEntityStatusResponse pcpp::DoIpGenericHeaderNack pcpp::DoIpRoutingActivationRequest pcpp::DoIpRoutingActivationResponse pcpp::DoIpVehicleAnnouncementMessage pcpp::DoIpVehicleIdentificationRequest pcpp::DoIpVehicleIdentificationRequestWithEID pcpp::DoIpVehicleIdentificationRequestWithVIN

Public Member Functions

virtual DoIpPayloadTypes getPayloadType () const =0
 
std::string getPayloadTypeAsStr () const
 
DoIpProtocolVersion getProtocolVersion () const
 
std::string getProtocolVersionAsStr () const
 
void setProtocolVersion (DoIpProtocolVersion version)
 
void setProtocolVersion (uint8_t rawVersion)
 
uint8_t getInvertProtocolVersion () const
 
void setInvertProtocolVersion (uint8_t iVersion)
 
uint32_t getPayloadLength () const
 
void setPayloadLength (uint32_t length)
 
void parseNextLayer () override
 parse UDS layer
 
size_t getHeaderLen () const override
 
std::string toString () const override
 
void computeCalculateFields () override
 Each layer can compute field values automatically using this method. This is an abstract method.
 
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 DoIpLayerparseDoIpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
static bool isDoIpPort (uint16_t port)
 
static bool isDataValid (uint8_t *data, size_t dataLen)
 

Additional Inherited Members

- Protected Member Functions inherited from pcpp::Layer
template<typename T , typename... Args>
LayerconstructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename T , typename TFallback , typename... Args>
LayertryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
- Static Protected Member Functions inherited from pcpp::Layer
template<typename T >
static bool canReinterpretAs (const uint8_t *data, size_t dataLen)
 Check if the data is large enough to reinterpret as a type. More...
 

Detailed Description

Represents an DoIP protocol layer. Currently only IPv4 DoIP messages are supported

Member Function Documentation

◆ getHeaderLen()

size_t pcpp::DoIpLayer::getHeaderLen ( ) const
inlineoverridevirtual
Returns
The size of doiphdr + attached fields length

Implements pcpp::Layer.

Reimplemented in pcpp::DoIpDiagnosticMessage.

◆ getInvertProtocolVersion()

uint8_t pcpp::DoIpLayer::getInvertProtocolVersion ( ) const

Get the invert version of DOIP protocol

Returns
A uint8_t presenting the used protocol invert version (DOIPV)

◆ getOsiModelLayer()

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

Implements pcpp::Layer.

◆ getPayloadLength()

uint32_t pcpp::DoIpLayer::getPayloadLength ( ) const

Get the doip payload length

Returns
uint32_t presenting the length of doip paylad not including the header

◆ getPayloadType()

◆ getPayloadTypeAsStr()

std::string pcpp::DoIpLayer::getPayloadTypeAsStr ( ) const

Get the doip payload type as string

Returns
uint16_t presenting the message doip payload type as string

◆ getProtocolVersion()

DoIpProtocolVersion pcpp::DoIpLayer::getProtocolVersion ( ) const

Get the version of DOIP protocol

Returns
DoIpProtocolVersion presenting the used protocol version (DOIPV)

◆ getProtocolVersionAsStr()

std::string pcpp::DoIpLayer::getProtocolVersionAsStr ( ) const

Get the version of DOIP protocol

Returns
string presentation the used protocol version (DOIPV)

◆ isDataValid()

static bool pcpp::DoIpLayer::isDataValid ( uint8_t *  data,
size_t  dataLen 
)
static

A static method that validates the input data

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

◆ isDoIpPort()

bool pcpp::DoIpLayer::isDoIpPort ( uint16_t  port)
inlinestatic

A static method that checks whether a port is considered as a DOIP port

Parameters
[in]portThe port number to check
Returns
True if this is a DOIP port number, false otherwise

◆ parseDoIpLayer()

static DoIpLayer* pcpp::DoIpLayer::parseDoIpLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
static

A method that creates a DoIP layer from packet raw data

Parameters
[in]dataA pointer to the raw data
[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
Returns
A newly allocated DoIP layer of one of the declared types (according to the message type)

◆ setInvertProtocolVersion()

void pcpp::DoIpLayer::setInvertProtocolVersion ( uint8_t  iVersion)

Set the invert protocol version of DOIP protocol

Parameters
[in]iVersionthe invert version of DOIP protocol to set

◆ setPayloadLength()

void pcpp::DoIpLayer::setPayloadLength ( uint32_t  length)

Set the doip payload length

Parameters
[in]lengththe doip payload length to set

◆ setProtocolVersion() [1/2]

void pcpp::DoIpLayer::setProtocolVersion ( DoIpProtocolVersion  version)

Set the version of DOIP protocol

Parameters
[in]versionthe version of DOIP protocol to set, restricted to existent doip version

◆ setProtocolVersion() [2/2]

void pcpp::DoIpLayer::setProtocolVersion ( uint8_t  rawVersion)

Additional setter for raw protocol version (for testing/fuzzing/debugging)

Parameters
[in]rawVersionthe raw version of DOIP protocol to set

◆ toString()

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

Implements pcpp::Layer.