PcapPlusPlus  Next
pcpp::DoIpDiagnosticMessage Class Reference

Represents a DoIP Diagnostic message sent between tester and ECU. More...

#include <DoIpLayer.h>

Inheritance diagram for pcpp::DoIpDiagnosticMessage:
pcpp::DoIpDiagnosticBase pcpp::DoIpLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 DoIpDiagnosticMessage (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 Constructs the DiagnosticMessage from raw packet data. More...
 
 DoIpDiagnosticMessage (uint16_t sourceAddress, uint16_t targetAddress, const std::vector< uint8_t > &diagnosticData)
 Constructs a DiagnosticMessage from specified field values. More...
 
void setDiagnosticData (const std::vector< uint8_t > &data)
 Set the diagnostic data payload. More...
 
std::vector< uint8_t > getDiagnosticData () const
 Get the diagnostic data payload. More...
 
std::string getSummary () const override
 Returns a human-readable summary of the message content. More...
 
DoIpPayloadTypes getPayloadType () const override
 Returns the DoIP payload type. More...
 
size_t getHeaderLen () const override
 
- Public Member Functions inherited from pcpp::DoIpDiagnosticBase
uint16_t getSourceAddress () const
 Gets the source logical address of the message. More...
 
void setSourceAddress (uint16_t sourceAddress)
 Sets the source logical address. More...
 
uint16_t getTargetAddress () const
 Gets the target logical address of the message. More...
 
void setTargetAddress (uint16_t targetAddress)
 Sets the target logical address. More...
 
- Public Member Functions inherited from pcpp::DoIpLayer
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
 
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 bool isDataLenValid (size_t dataLen)
 Checks if the diagnostic data length is valid. More...
 
- Static Public Member Functions inherited from pcpp::DoIpLayer
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 a DoIP Diagnostic message sent between tester and ECU.

This message includes source and target addresses and carries diagnostic service data.

Constructor & Destructor Documentation

◆ DoIpDiagnosticMessage() [1/2]

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

Constructs the DiagnosticMessage from raw packet data.

Parameters
[in]dataPointer to the raw payload data.
[in]dataLenLength of the data buffer.
[in]prevLayerPointer to the previous protocol layer.
[in]packetPointer to the parent packet.

◆ DoIpDiagnosticMessage() [2/2]

pcpp::DoIpDiagnosticMessage::DoIpDiagnosticMessage ( uint16_t  sourceAddress,
uint16_t  targetAddress,
const std::vector< uint8_t > &  diagnosticData 
)

Constructs a DiagnosticMessage from specified field values.

Parameters
[in]sourceAddressAddress of the sending ECU/tester.
[in]targetAddressAddress of the target ECU.
[in]diagnosticDataVector containing UDS diagnostic service data.

Member Function Documentation

◆ getDiagnosticData()

std::vector<uint8_t> pcpp::DoIpDiagnosticMessage::getDiagnosticData ( ) const

Get the diagnostic data payload.

Returns
A vector containing the diagnostic data bytes.

◆ getHeaderLen()

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

Reimplemented from pcpp::DoIpLayer.

◆ getPayloadType()

DoIpPayloadTypes pcpp::DoIpDiagnosticMessage::getPayloadType ( ) const
inlineoverridevirtual

Returns the DoIP payload type.

Returns
DoIpPayloadTypes::DIAGNOSTIC_MESSAGE

Implements pcpp::DoIpLayer.

◆ getSummary()

std::string pcpp::DoIpDiagnosticMessage::getSummary ( ) const
overridevirtual

Returns a human-readable summary of the message content.

Returns
A string summarizing the diagnostic message.

Implements pcpp::DoIpDiagnosticBase.

◆ isDataLenValid()

static bool pcpp::DoIpDiagnosticMessage::isDataLenValid ( size_t  dataLen)
inlinestatic

Checks if the diagnostic data length is valid.

Returns
true if the data length is valid, false otherwise.

◆ setDiagnosticData()

void pcpp::DoIpDiagnosticMessage::setDiagnosticData ( const std::vector< uint8_t > &  data)

Set the diagnostic data payload.

Parameters
[in]dataA vector containing the diagnostic data bytes to be stored.