PcapPlusPlus  Next
pcpp::DoIpVehicleAnnouncementMessage Class Reference

Represents a DoIP Vehicle Announcement message. More...

#include <DoIpLayer.h>

Inheritance diagram for pcpp::DoIpVehicleAnnouncementMessage:
pcpp::DoIpLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 DoIpVehicleAnnouncementMessage (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 Constructs the layer from raw DoIP packet data. More...
 
 DoIpVehicleAnnouncementMessage (const std::array< uint8_t, DOIP_VIN_LEN > &vin, uint16_t logicalAddress, const std::array< uint8_t, DOIP_EID_LEN > &eid, const std::array< uint8_t, DOIP_GID_LEN > &gid, DoIpActionCodes actionCode)
 Constructs the message using specified field values. More...
 
std::array< uint8_t, DOIP_VIN_LEN > getVIN () const
 Gets the Vehicle Identification Number (VIN). More...
 
void setVIN (const std::array< uint8_t, DOIP_VIN_LEN > &vin)
 Sets the Vehicle Identification Number (VIN). More...
 
uint16_t getLogicalAddress () const
 Gets the logical address of the vehicle. More...
 
void setLogicalAddress (uint16_t address)
 Sets the logical address. More...
 
std::array< uint8_t, DOIP_EID_LEN > getEID () const
 Gets the Entity Identifier (EID). More...
 
void setEID (const std::array< uint8_t, DOIP_EID_LEN > &eid)
 Sets the Entity Identifier (EID). More...
 
std::array< uint8_t, DOIP_GID_LEN > getGID () const
 Gets the Group Identifier (GID). More...
 
void setGID (const std::array< uint8_t, DOIP_GID_LEN > &gid)
 Sets the Group Identifier (GID). More...
 
DoIpActionCodes getFurtherActionRequired () const
 Gets the further action required code. More...
 
void setFurtherActionRequired (DoIpActionCodes action)
 Sets the further action required code. More...
 
DoIpSyncStatus getSyncStatus () const
 Gets the optional synchronization status if available. More...
 
void setSyncStatus (DoIpSyncStatus sync)
 Sets the synchronization status. More...
 
bool hasSyncStatus () const
 Checks whether the sync status is present. More...
 
void clearSyncStatus ()
 Clears the optional sync status field.
 
std::string getSummary () const
 Returns a human-readable summary of the message.
 
DoIpPayloadTypes getPayloadType () const override
 Returns the DoIP payload type.
 
- 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
 
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 bool isDataLenValid (size_t dataLen)
 checks if the vehicle announcement 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 Vehicle Announcement message.

This message is broadcasted by a vehicle to announce its presence, including VIN, logical address, EID, GID, and optionally synchronization status.

Constructor & Destructor Documentation

◆ DoIpVehicleAnnouncementMessage() [1/2]

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

Constructs the layer from raw DoIP packet data.

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

◆ DoIpVehicleAnnouncementMessage() [2/2]

pcpp::DoIpVehicleAnnouncementMessage::DoIpVehicleAnnouncementMessage ( const std::array< uint8_t, DOIP_VIN_LEN > &  vin,
uint16_t  logicalAddress,
const std::array< uint8_t, DOIP_EID_LEN > &  eid,
const std::array< uint8_t, DOIP_GID_LEN > &  gid,
DoIpActionCodes  actionCode 
)

Constructs the message using specified field values.

Parameters
[in]vinVehicle Identification Number (VIN).
[in]logicalAddressLogical address of the vehicle.
[in]eidEntity Identifier (EID).
[in]gidGroup Identifier (GID).
[in]actionCodeFurther action code.

Member Function Documentation

◆ getEID()

std::array<uint8_t, DOIP_EID_LEN> pcpp::DoIpVehicleAnnouncementMessage::getEID ( ) const

Gets the Entity Identifier (EID).

Returns
A 6-byte Entity Identifier (EID).

◆ getFurtherActionRequired()

DoIpActionCodes pcpp::DoIpVehicleAnnouncementMessage::getFurtherActionRequired ( ) const

Gets the further action required code.

Returns
enum DoIpActionCodes representing the further action required code.

◆ getGID()

std::array<uint8_t, DOIP_GID_LEN> pcpp::DoIpVehicleAnnouncementMessage::getGID ( ) const

Gets the Group Identifier (GID).

Returns
A 6-byte Group Identifier (GID).

◆ getLogicalAddress()

uint16_t pcpp::DoIpVehicleAnnouncementMessage::getLogicalAddress ( ) const

Gets the logical address of the vehicle.

Returns
A 2-byte logical address of the vehicle.

◆ getSyncStatus()

DoIpSyncStatus pcpp::DoIpVehicleAnnouncementMessage::getSyncStatus ( ) const

Gets the optional synchronization status if available.

Exceptions
std::runtime_errorif the sync status is not present.
Note
To use this method safely, check beforehand if the sync status is present using hasSyncStatus().
Returns
A 1-byte synchronization status.

◆ getVIN()

std::array<uint8_t, DOIP_VIN_LEN> pcpp::DoIpVehicleAnnouncementMessage::getVIN ( ) const

Gets the Vehicle Identification Number (VIN).

Returns
A 17-byte Vehicle Identification Number (VIN).

◆ hasSyncStatus()

bool pcpp::DoIpVehicleAnnouncementMessage::hasSyncStatus ( ) const

Checks whether the sync status is present.

Returns
true if the sync status is present, false otherwise.

◆ isDataLenValid()

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

checks if the vehicle announcement data length is valid.

Parameters
[in]dataLenLength of the data buffer.
Returns
true if the data length is valid, false otherwise.

◆ setEID()

void pcpp::DoIpVehicleAnnouncementMessage::setEID ( const std::array< uint8_t, DOIP_EID_LEN > &  eid)

Sets the Entity Identifier (EID).

Parameters
[in]eidA 6-byte Entity Identifier (EID).

◆ setFurtherActionRequired()

void pcpp::DoIpVehicleAnnouncementMessage::setFurtherActionRequired ( DoIpActionCodes  action)

Sets the further action required code.

Parameters
[in]actionenum DoIpActionCodes representing the further action required code to set.

◆ setGID()

void pcpp::DoIpVehicleAnnouncementMessage::setGID ( const std::array< uint8_t, DOIP_GID_LEN > &  gid)

Sets the Group Identifier (GID).

Parameters
[in]gidA 6-byte Group Identifier (GID).

◆ setLogicalAddress()

void pcpp::DoIpVehicleAnnouncementMessage::setLogicalAddress ( uint16_t  address)

Sets the logical address.

Parameters
[in]addressA 2-byte logical address of the vehicle.

◆ setSyncStatus()

void pcpp::DoIpVehicleAnnouncementMessage::setSyncStatus ( DoIpSyncStatus  sync)

Sets the synchronization status.

Parameters
[in]syncenum DoIpSyncStatus representing the synchronization status to set.

◆ setVIN()

void pcpp::DoIpVehicleAnnouncementMessage::setVIN ( const std::array< uint8_t, DOIP_VIN_LEN > &  vin)

Sets the Vehicle Identification Number (VIN).

Parameters
[in]vinA 17-byte Vehicle Identification Number (VIN).