29 static_assert(
sizeof(
doiphdr) == 8,
"DoIP header must be exactly 8 bytes.");
31 namespace DoIpConstants
34 static constexpr
size_t DOIP_HEADER_LEN =
sizeof(
doiphdr);
37 static constexpr
size_t DOIP_EID_LEN = 6;
40 static constexpr
size_t DOIP_GID_LEN = 6;
43 static constexpr
size_t DOIP_VIN_LEN = 17;
46 static constexpr
size_t DOIP_RESERVED_ISO_LEN = 4;
49 static constexpr
size_t DOIP_RESERVED_OEM_LEN = 4;
52 static constexpr
size_t DOIP_SOURCE_ADDRESS_LEN = 2;
55 static constexpr
size_t DOIP_TARGET_ADDRESS_LEN = 2;
555 using namespace DoIpConstants;
613 static inline bool isDoIpPort(uint16_t port);
645 static inline bool isPayloadTypeValid(uint16_t type);
647 static inline bool isProtocolVersionValid(uint8_t version, uint8_t inVersion,
DoIpPayloadTypes type);
649 static inline bool isPayloadLengthValid(uint32_t payloadLength,
size_t dataLen);
659 return reinterpret_cast<doiphdr*
>(m_Data);
668 auto portAsEnum =
static_cast<DoIpPorts>(port);
672 inline bool DoIpLayer::isProtocolVersionValid(uint8_t version, uint8_t inVersion,
DoIpPayloadTypes type)
676 switch (parsedVersion)
680 PCPP_LOG_DEBUG(
"[Malformed doip packet]: Reserved ISO DoIP protocol version detected: 0x"
681 << std::hex <<
static_cast<int>(version));
689 PCPP_LOG_DEBUG(
"[Malformed doip packet]: Invalid/unsupported DoIP version!");
697 if (version !=
static_cast<uint8_t
>(~inVersion))
699 PCPP_LOG_DEBUG(
"[Malformed doip packet]: Protocol version and inverse version mismatch! Version: 0x"
700 << std::hex <<
static_cast<int>(version) <<
", Inverted: 0x"
701 <<
static_cast<int>(inVersion));
707 PCPP_LOG_DEBUG(
"[Malformed doip packet]: Unknown DoIP protocol version: 0x" << std::hex
708 <<
static_cast<int>(version));
713 inline bool DoIpLayer::isPayloadTypeValid(uint16_t type)
738 PCPP_LOG_DEBUG(
"[Malformed doip packet]: Invalid DoIP payload type: 0x" << std::hex << type);
743 inline bool DoIpLayer::isPayloadLengthValid(uint32_t payloadLength,
size_t dataLen)
745 const size_t actualPayloadLen = dataLen - DOIP_HEADER_LEN;
747 if (payloadLength != actualPayloadLen)
749 PCPP_LOG_DEBUG(
"[Malformed doip packet]: Payload length mismatch: expected "
750 << payloadLength <<
" bytes, but got " << actualPayloadLen <<
" bytes.");
801 return (dataLen == FIXED_LEN);
805 #pragma pack(push, 1)
806 struct generic_header_nack :
doiphdr
811 generic_header_nack* getGenericHeaderNack()
const
813 return reinterpret_cast<generic_header_nack*
>(m_Data);
815 static constexpr
size_t FIXED_LEN =
sizeof(generic_header_nack);
836 :
DoIpLayer(data, dataLen, prevLayer, packet)
853 return (dataLen == DOIP_HEADER_LEN);
881 std::array<uint8_t, DOIP_EID_LEN>
getEID()
const;
885 void setEID(
const std::array<uint8_t, DOIP_EID_LEN>& eid);
901 return (dataLen == FIXED_LEN);
905 #pragma pack(push, 1)
906 struct vehicle_identification_request_with_eid :
doiphdr
908 std::array<uint8_t, DOIP_EID_LEN> eid;
911 vehicle_identification_request_with_eid* getVehicleIdentificationRequestWEID()
const
913 return reinterpret_cast<vehicle_identification_request_with_eid*
>(m_Data);
915 static constexpr
size_t FIXED_LEN =
sizeof(vehicle_identification_request_with_eid);
942 std::array<uint8_t, DOIP_VIN_LEN>
getVIN()
const;
946 void setVIN(
const std::array<uint8_t, DOIP_VIN_LEN>& vin);
962 return (dataLen == FIXED_LEN);
966 #pragma pack(push, 1)
967 struct vehicle_identification_request_with_vin :
doiphdr
969 std::array<uint8_t, DOIP_VIN_LEN> vin;
972 vehicle_identification_request_with_vin* getVehicleIdentificationRequestWVIN()
const
974 return reinterpret_cast<vehicle_identification_request_with_vin*
>(m_Data);
976 static constexpr
size_t FIXED_LEN =
sizeof(vehicle_identification_request_with_vin);
1005 const std::array<uint8_t, DOIP_EID_LEN>& eid,
1006 const std::array<uint8_t, DOIP_GID_LEN>& gid,
DoIpActionCodes actionCode);
1010 std::array<uint8_t, DOIP_VIN_LEN>
getVIN()
const;
1014 void setVIN(
const std::array<uint8_t, DOIP_VIN_LEN>& vin);
1026 std::array<uint8_t, DOIP_EID_LEN>
getEID()
const;
1030 void setEID(
const std::array<uint8_t, DOIP_EID_LEN>& eid);
1034 std::array<uint8_t, DOIP_GID_LEN>
getGID()
const;
1038 void setGID(
const std::array<uint8_t, DOIP_GID_LEN>& gid);
1079 return (dataLen == FIXED_LEN || dataLen == OPT_LEN);
1083 #pragma pack(push, 1)
1084 struct vehicle_announcement_message :
doiphdr
1086 std::array<uint8_t, DOIP_VIN_LEN> vin;
1088 uint16_t logicalAddress;
1090 std::array<uint8_t, DOIP_EID_LEN> eid;
1092 std::array<uint8_t, DOIP_GID_LEN> gid;
1098 vehicle_announcement_message* getVehicleAnnouncementMessage()
const
1100 return reinterpret_cast<vehicle_announcement_message*
>(m_Data);
1102 static constexpr
size_t FIXED_LEN =
sizeof(vehicle_announcement_message);
1103 static constexpr
size_t SYNC_STATUS_OFFSET = FIXED_LEN;
1104 static constexpr
size_t SYNC_STATUS_LEN =
sizeof(uint8_t);
1105 static constexpr
size_t OPT_LEN = FIXED_LEN + SYNC_STATUS_LEN;
1187 return (dataLen == FIXED_LEN || dataLen == OPT_LEN);
1191 #pragma pack(push, 1)
1192 struct routing_activation_request :
doiphdr
1194 uint16_t sourceAddress;
1196 uint8_t activationType;
1198 std::array<uint8_t, DOIP_RESERVED_ISO_LEN> reservedIso;
1202 routing_activation_request* getRoutingActivationRequest()
const
1204 return reinterpret_cast<routing_activation_request*
>(m_Data);
1206 static constexpr
size_t FIXED_LEN =
sizeof(routing_activation_request);
1207 static constexpr
size_t RESERVED_OEM_OFFSET = FIXED_LEN;
1208 static constexpr
size_t OPT_LEN = FIXED_LEN + DOIP_RESERVED_OEM_LEN;
1300 return (dataLen == FIXED_LEN || dataLen == OPT_LEN);
1304 #pragma pack(push, 1)
1305 struct routing_activation_response :
doiphdr
1307 uint16_t logicalAddressExternalTester;
1309 uint16_t sourceAddress;
1311 uint8_t responseCode;
1313 std::array<uint8_t, DOIP_RESERVED_ISO_LEN> reservedIso;
1316 routing_activation_response* getRoutingActivationResponse()
const
1318 return reinterpret_cast<routing_activation_response*
>(m_Data);
1320 static constexpr
size_t FIXED_LEN =
sizeof(routing_activation_response);
1321 static constexpr
size_t RESERVED_OEM_OFFSET = FIXED_LEN;
1322 static constexpr
size_t OPT_LEN = FIXED_LEN + DOIP_RESERVED_OEM_LEN;
1343 :
DoIpLayer(data, dataLen, prevLayer, packet)
1360 return (dataLen == DOIP_HEADER_LEN);
1409 return (dataLen == FIXED_LEN);
1413 #pragma pack(push, 1)
1414 struct alive_check_response :
doiphdr
1416 uint16_t sourceAddress;
1419 alive_check_response* getAliveCheckResponse()
const
1421 return reinterpret_cast<alive_check_response*
>(m_Data);
1423 static constexpr
size_t FIXED_LEN =
sizeof(alive_check_response);
1445 :
DoIpLayer(data, dataLen, prevLayer, packet)
1462 return (dataLen == DOIP_HEADER_LEN);
1490 uint8_t currentlyOpenSockets);
1549 return (dataLen == FIXED_LEN || dataLen == OPT_LEN);
1553 #pragma pack(push, 1)
1554 struct entity_status_response :
doiphdr
1558 uint8_t maxConcurrentSockets;
1560 uint8_t currentlyOpenSockets;
1564 entity_status_response* getEntityStatusResponse()
const
1566 return reinterpret_cast<entity_status_response*
>(m_Data);
1568 static constexpr
size_t FIXED_LEN =
sizeof(entity_status_response);
1569 static constexpr
size_t MAX_DATA_SIZE_OFFSET = FIXED_LEN;
1570 static constexpr
size_t MAX_DATA_SIZE_LEN =
sizeof(uint32_t);
1571 static constexpr
size_t OPT_LEN = FIXED_LEN + MAX_DATA_SIZE_LEN;
1592 :
DoIpLayer(data, dataLen, prevLayer, packet)
1609 return (dataLen == DOIP_HEADER_LEN);
1659 return (dataLen == FIXED_LEN);
1663 #pragma pack(push, 1)
1664 struct diagnostic_power_mode_response :
doiphdr
1666 uint8_t powerModeCode;
1669 diagnostic_power_mode_response* getDiagnosticPowerModeResponse()
const
1671 return reinterpret_cast<diagnostic_power_mode_response*
>(m_Data);
1673 static constexpr
size_t FIXED_LEN =
sizeof(diagnostic_power_mode_response);
1711 #pragma pack(push, 1)
1715 uint16_t sourceAddress;
1717 uint16_t targetAddress;
1749 const std::vector<uint8_t>& diagnosticData);
1773 return sizeof(
doiphdr) + 2 *
sizeof(uint16_t);
1780 return (dataLen >= MIN_LEN);
1784 static constexpr
size_t DIAGNOSTIC_DATA_OFFSET =
sizeof(common_diagnostic_header);
1785 static constexpr
size_t MIN_LEN = DIAGNOSTIC_DATA_OFFSET + 1;
1824 return (dataLen >= FIXED_LEN);
1832 #pragma pack(push, 1)
1833 struct diagnostic_response_message_base : common_diagnostic_header
1835 uint8_t diagnosticCode;
1838 diagnostic_response_message_base* getDiagnosticResponseMessageBase()
const
1840 return reinterpret_cast<diagnostic_response_message_base*
>(m_Data);
1842 static constexpr
size_t FIXED_LEN =
sizeof(diagnostic_response_message_base);
1843 static constexpr
size_t PREVIOUS_MSG_OFFSET = FIXED_LEN;
Represents an Alive Check Request message in the DoIP protocol.
Definition: DoIpLayer.h:1335
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type for this message.
Definition: DoIpLayer.h:1350
DoIpAliveCheckRequest(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs an AliveCheckRequest from raw packet data.
Definition: DoIpLayer.h:1342
DoIpAliveCheckRequest()
Default constructor to create an empty AliveCheckRequest message.
static bool isDataLenValid(size_t dataLen)
Checks if the Alive Check Request data length is valid.
Definition: DoIpLayer.h:1358
Represents a DoIP Alive Check Response message.
Definition: DoIpLayer.h:1374
DoIpAliveCheckResponse(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1400
DoIpAliveCheckResponse(uint16_t sourceAddress)
Constructs the message using the specified source address.
std::string getSummary() const
Returns a human-readable summary of the message.
uint16_t getSourceAddress() const
Gets the source address.
void setSourceAddress(uint16_t address)
Sets the source address.
static bool isDataLenValid(size_t dataLen)
Checks if the Alive Check Response data length is valid.
Definition: DoIpLayer.h:1407
Represents a DoIP Diagnostic Message sent between tester and ECU. This class includes source and targ...
Definition: DoIpLayer.h:1684
uint16_t getTargetAddress() const
Gets the target logical address of the message.
uint16_t getSourceAddress() const
Gets the source logical address of the message.
void setSourceAddress(uint16_t sourceAddress)
Sets the source logical address.
virtual std::string getSummary() const =0
Returns a human-readable summary of the message content.
void setTargetAddress(uint16_t targetAddress)
Sets the target logical address.
Represents a positive acknowledgment message in response to a DiagnosticMessage.
Definition: DoIpLayer.h:1856
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1883
DoIpDiagnosticAckCodes getAckCode() const
Gets the diagnostic acknowledgment code.
DoIpDiagnosticMessageAck(uint16_t sourceAddress, uint16_t targetAddress, DoIpDiagnosticAckCodes ackCode)
Constructs a DiagnosticAckMessage from specified field values.
void setAckCode(DoIpDiagnosticAckCodes code)
Sets the acknowledgment code.
DoIpDiagnosticMessageAck(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs a DiagnosticAckMessage from raw packet data.
std::string getSummary() const override
Returns a human-readable summary of the message.
Represents a DoIP Diagnostic message sent between tester and ECU.
Definition: DoIpLayer.h:1735
DoIpDiagnosticMessage(uint16_t sourceAddress, uint16_t targetAddress, const std::vector< uint8_t > &diagnosticData)
Constructs a DiagnosticMessage from specified field values.
DoIpDiagnosticMessage(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the DiagnosticMessage from raw packet data.
size_t getHeaderLen() const override
Definition: DoIpLayer.h:1771
std::vector< uint8_t > getDiagnosticData() const
Get the diagnostic data payload.
static bool isDataLenValid(size_t dataLen)
Checks if the diagnostic data length is valid.
Definition: DoIpLayer.h:1778
void setDiagnosticData(const std::vector< uint8_t > &data)
Set the diagnostic data payload.
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1765
std::string getSummary() const override
Returns a human-readable summary of the message content.
Represents a negative acknowledgment message in response to a DiagnosticMessage.
Definition: DoIpLayer.h:1899
std::string getSummary() const override
Returns a human-readable summary of the message.
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1927
DoIpDiagnosticMessageNackCodes getNackCode() const
Gets the negative acknowledgment code.
DoIpDiagnosticMessageNack(uint16_t sourceAddress, uint16_t targetAddress, DoIpDiagnosticMessageNackCodes nackCode)
Constructs a DiagnosticNackMessage from specified field values.
void setNackCode(DoIpDiagnosticMessageNackCodes code)
Sets the negative acknowledgment code.
DoIpDiagnosticMessageNack(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs a DiagnosticNackMessage from raw packet data.
Represents a Diagnostic Power Mode Request message in the DoIP protocol.
Definition: DoIpLayer.h:1584
DoIpDiagnosticPowerModeRequest(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs a DiagnosticPowerModeRequest from raw packet data.
Definition: DoIpLayer.h:1591
static bool isDataLenValid(size_t dataLen)
Checks if the Entity Status Request data length is valid.
Definition: DoIpLayer.h:1607
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1599
DoIpDiagnosticPowerModeRequest()
Default constructor to create an empty DiagnosticPowerModeRequest.
Represents a DoIP Diagnostic Power Mode Response message.
Definition: DoIpLayer.h:1623
DoIpDiagnosticPowerModeCodes getPowerModeCode() const
Gets the current power mode code.
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1649
static bool isDataLenValid(size_t dataLen)
Checks if the Diagnostic Power Mode Response data length is valid.
Definition: DoIpLayer.h:1657
std::string getSummary() const
Returns a human-readable summary of the message.
void setPowerModeCode(DoIpDiagnosticPowerModeCodes code)
Sets the power mode code.
DoIpDiagnosticPowerModeResponse(DoIpDiagnosticPowerModeCodes modeCode)
Constructs the message using the specified power mode code.
DoIpDiagnosticPowerModeResponse(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
Represents a Basic class for Diagnostic message (ACK/NACK) sent back to tester.
Definition: DoIpLayer.h:1794
uint8_t getResponseCode() const
Gets the acknowledgment/nack code (1-byte).
bool hasPreviousMessage() const
Checks if a previous message is attached.
static bool isDataLenValid(size_t dataLen)
Checks if data length is valid.
Definition: DoIpLayer.h:1822
std::vector< uint8_t > getPreviousMessage() const
Gets the optional previously echoed diagnostic message.
void setResponseCode(uint8_t code)
Sets the acknowledgment/nack code (1-byte).
void clearPreviousMessage()
Clears the previously stored diagnostic message.
void setPreviousMessage(const std::vector< uint8_t > &msg)
Sets the previous echoed diagnostic message.
Represents an Entity Status Request message in the DoIP protocol.
Definition: DoIpLayer.h:1437
static bool isDataLenValid(size_t dataLen)
Checks if the Entity Status Request data length is valid.
Definition: DoIpLayer.h:1460
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type for this message.
Definition: DoIpLayer.h:1452
DoIpEntityStatusRequest()
Default constructor to create an empty EntityStatusRequest message.
DoIpEntityStatusRequest(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs an EntityStatusRequest from raw packet data.
Definition: DoIpLayer.h:1444
Represents a DoIP Entity Status Response message.
Definition: DoIpLayer.h:1476
void setCurrentlyOpenSockets(uint8_t sockets)
Sets the number of currently open sockets.
void clearMaxDataSize()
Clears the optional max data size field.
uint8_t getMaxConcurrentSockets() const
Gets the maximum number of concurrent sockets supported.
DoIpEntityStatusResponse(DoIpEntityStatusResponseCode nodeType, uint8_t maxConcurrentSockets, uint8_t currentlyOpenSockets)
Constructs the message using provided field values.
void setNodeType(DoIpEntityStatusResponseCode status)
Sets the DoIP node type.
uint32_t getMaxDataSize() const
Gets the optional maximum data size field.
void setMaxDataSize(uint32_t data)
Sets the maximum data size field.
bool hasMaxDataSize() const
Checks if the optional max data size is present.
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1494
static bool isDataLenValid(size_t dataLen)
Checks if the Entity Status Response data length is valid.
Definition: DoIpLayer.h:1547
DoIpEntityStatusResponse(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
void setMaxConcurrentSockets(uint8_t sockets)
Sets the maximum number of concurrent sockets.
DoIpEntityStatusResponseCode getNodeType() const
Gets the type of the DoIP node.
uint8_t getCurrentlyOpenSockets() const
Gets the number of currently open sockets.
std::string getSummary() const
Returns a human-readable summary of the message.
Definition: DoIpLayer.h:560
size_t getHeaderLen() const override
Definition: DoIpLayer.h:627
static DoIpLayer * parseDoIpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
OsiModelLayer getOsiModelLayer() const override
Definition: DoIpLayer.h:637
void setProtocolVersion(uint8_t rawVersion)
static bool isDoIpPort(uint16_t port)
Definition: DoIpLayer.h:666
uint8_t getInvertProtocolVersion() const
uint32_t getPayloadLength() const
void setProtocolVersion(DoIpProtocolVersion version)
void computeCalculateFields() override
Each layer can compute field values automatically using this method. This is an abstract method.
Definition: DoIpLayer.h:634
virtual DoIpPayloadTypes getPayloadType() const =0
std::string getPayloadTypeAsStr() const
void setPayloadLength(uint32_t length)
std::string toString() const override
void parseNextLayer() override
parse UDS layer
static bool isDataValid(uint8_t *data, size_t dataLen)
std::string getProtocolVersionAsStr() const
void setInvertProtocolVersion(uint8_t iVersion)
DoIpProtocolVersion getProtocolVersion() const
Represents a DoIP Routing Activation Request message.
Definition: DoIpLayer.h:1118
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type for this message.
Definition: DoIpLayer.h:1177
uint16_t getSourceAddress() const
Returns the source address.
DoIpRoutingActivationRequest(uint16_t sourceAddress, DoIpActivationTypes activationType)
Constructs the message from field values.
DoIpActivationTypes getActivationType() const
Returns the activation type.
std::array< uint8_t, DOIP_RESERVED_OEM_LEN > getReservedOem() const
Gets the to reserved OEM bytes if present.
bool hasReservedOem() const
Checks if OEM reserved bytes are present.
void setReservedOem(const std::array< uint8_t, DOIP_RESERVED_OEM_LEN > &reservedOem)
Sets the reserved OEM bytes.
static bool isDataLenValid(size_t dataLen)
Checks if the routing activation request data length is valid.
Definition: DoIpLayer.h:1185
void setActivationType(DoIpActivationTypes activationType)
Sets the activation type.
DoIpRoutingActivationRequest(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
std::string getSummary() const
Returns a human-readable summary of the message.
std::array< uint8_t, DOIP_RESERVED_ISO_LEN > getReservedIso() const
Gets the reserved ISO bytes.
void setReservedIso(const std::array< uint8_t, DOIP_RESERVED_ISO_LEN > &reservedIso)
Sets the reserved ISO bytes.
void setSourceAddress(uint16_t value)
Sets the source address.
void clearReservedOem()
Clears the OEM reserved bytes.
Represents a DoIP Routing Activation Response message.
Definition: DoIpLayer.h:1221
DoIpRoutingResponseCodes getResponseCode() const
Gets the routing response code.
void clearReservedOem()
Clears the OEM reserved bytes.
static bool isDataLenValid(size_t dataLen)
Checks if the routing activation response data length is valid.
Definition: DoIpLayer.h:1298
std::string getSummary() const
Returns a human-readable summary of the message.
uint16_t getSourceAddress() const
Gets the source address.
std::array< uint8_t, DOIP_RESERVED_OEM_LEN > getReservedOem() const
Gets pointer to reserved OEM bytes if present.
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type for this message.
Definition: DoIpLayer.h:1290
std::array< uint8_t, DOIP_RESERVED_ISO_LEN > getReservedIso() const
Gets the reserved ISO bytes.
void setResponseCode(DoIpRoutingResponseCodes code)
Sets the routing response code.
DoIpRoutingActivationResponse(uint16_t logicalAddressExternalTester, uint16_t sourceAddress, DoIpRoutingResponseCodes responseCode)
Constructs the message from field values.
bool hasReservedOem() const
Checks if OEM reserved bytes are present.
void setReservedOem(const std::array< uint8_t, DOIP_RESERVED_OEM_LEN > &reservedOem)
Sets the reserved OEM bytes.
uint16_t getLogicalAddressExternalTester() const
Gets the logical address of the external tester.
void setSourceAddress(uint16_t sourceAddress)
Sets the source address.
DoIpRoutingActivationResponse(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
void setReservedIso(const std::array< uint8_t, DOIP_RESERVED_ISO_LEN > &reservedIso)
Sets the reserved ISO bytes.
void setLogicalAddressExternalTester(uint16_t addr)
Sets the logical address of the external tester.
Represents a DoIP Vehicle Announcement message.
Definition: DoIpLayer.h:989
uint16_t getLogicalAddress() const
Gets the logical address of the vehicle.
std::array< uint8_t, DOIP_EID_LEN > getEID() const
Gets the Entity Identifier (EID).
std::array< uint8_t, DOIP_GID_LEN > getGID() const
Gets the Group Identifier (GID).
std::string getSummary() const
Returns a human-readable summary of the message.
static bool isDataLenValid(size_t dataLen)
checks if the vehicle announcement data length is valid.
Definition: DoIpLayer.h:1077
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.
void setGID(const std::array< uint8_t, DOIP_GID_LEN > &gid)
Sets the Group Identifier (GID).
bool hasSyncStatus() const
Checks whether the sync status is present.
void setEID(const std::array< uint8_t, DOIP_EID_LEN > &eid)
Sets the Entity Identifier (EID).
void setVIN(const std::array< uint8_t, DOIP_VIN_LEN > &vin)
Sets the Vehicle Identification Number (VIN).
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:1069
DoIpSyncStatus getSyncStatus() const
Gets the optional synchronization status if available.
std::array< uint8_t, DOIP_VIN_LEN > getVIN() const
Gets the Vehicle Identification Number (VIN).
DoIpActionCodes getFurtherActionRequired() const
Gets the further action required code.
void setFurtherActionRequired(DoIpActionCodes action)
Sets the further action required code.
void clearSyncStatus()
Clears the optional sync status field.
void setLogicalAddress(uint16_t address)
Sets the logical address.
void setSyncStatus(DoIpSyncStatus sync)
Sets the synchronization status.
DoIpVehicleAnnouncementMessage(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
Represents a Vehicle Identification Request message in the DoIP protocol.
Definition: DoIpLayer.h:828
DoIpVehicleIdentificationRequest()
Default constructor to create an empty VehicleIdentificationRequest.
static bool isDataLenValid(size_t dataLen)
Checks if the Vehicle Identification Request data length is valid.
Definition: DoIpLayer.h:851
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type.
Definition: DoIpLayer.h:843
DoIpVehicleIdentificationRequest(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs a VehicleIdentificationRequest from raw packet data.
Definition: DoIpLayer.h:835
Represents a DoIP Vehicle Identification Request with EID.
Definition: DoIpLayer.h:866
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type for this message.
Definition: DoIpLayer.h:891
std::array< uint8_t, DOIP_EID_LEN > getEID() const
Gets the Entity ID (EID).
DoIpVehicleIdentificationRequestWithEID(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
std::string getSummary() const
Returns a human-readable summary of the message.
static bool isDataLenValid(size_t dataLen)
Checks if the EID data length is valid.
Definition: DoIpLayer.h:899
DoIpVehicleIdentificationRequestWithEID(const std::array< uint8_t, DOIP_EID_LEN > &eid={})
Constructs the message using the specified EID.
void setEID(const std::array< uint8_t, DOIP_EID_LEN > &eid)
Sets the Entity ID (EID).
Represents a DoIP Vehicle Identification Request with VIN.
Definition: DoIpLayer.h:927
DoIpPayloadTypes getPayloadType() const override
Returns the DoIP payload type for this message.
Definition: DoIpLayer.h:952
DoIpVehicleIdentificationRequestWithVIN(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Constructs the layer from raw DoIP packet data.
static bool isDataLenValid(size_t dataLen)
Checks if the VIN data length is valid.
Definition: DoIpLayer.h:960
DoIpVehicleIdentificationRequestWithVIN(const std::array< uint8_t, DOIP_VIN_LEN > &vin={})
Constructs the message using the specified VIN.
std::array< uint8_t, DOIP_VIN_LEN > getVIN() const
Gets the Vehicle Identification Number (VIN).
void setVIN(const std::array< uint8_t, DOIP_VIN_LEN > &vin)
Sets the Vehicle Identification Number (VIN).
std::string getSummary() const
Returns a human-readable summary of the message.
The main namespace for the PcapPlusPlus lib.
DoIpProtocolVersion
Represents the DoIP (Diagnostics over IP) protocol versions.
Definition: DoIpLayer.h:446
@ DEFAULT_VALUE
Default protocol version. Used for broadcast Vehicle Identification Request Messages.
@ ISO13400_2019
Protocol version 3, based on ISO 2019 specification.
@ ISO13400_2012
Protocol version 2, based on ISO 2012 specification.
@ RESERVED_VER
Reserved protocol version. This value is used when the version is not specified.
@ ISO13400_2010
Protocol version 1, based on ISO 2010 specification.
@ ISO13400_2019_AMD1
Protocol version 4, based on ISO 2019 AMD1 (Amendment 1) specification.
DoIpDiagnosticAckCodes
Enum representing DoIP diagnostic acknowledgment codes (ISO 13400). These codes are used to acknowled...
Definition: DoIpLayer.h:341
DoIpPorts
Enum representing DoIP diagnostic ports (ISO 13400). These ports are used for communication in the Do...
Definition: DoIpLayer.h:545
DoIpSyncStatus
Enum representing DoIP sync status (ISO 13400). These codes are used to indicate whether GID and VIN ...
Definition: DoIpLayer.h:372
@ VIN_AND_OR_GID_ARE_SINCHRONIZED
VIN and or GID are synchronized.
@ VIN_AND_OR_GID_ARE_NOT_SINCHRONIZED
VIN and or GID are not synchronized.
DoIpActivationTypes
Enum representing DoIP routing activation types. These values specify the type of routing activation ...
Definition: DoIpLayer.h:61
DoIpRoutingResponseCodes
Enum representing DoIP routing activation response codes (ISO 13400). These codes are used in respons...
Definition: DoIpLayer.h:190
@ ROUTING_SUCCESSFULLY_ACTIVATED
@ ENCRYPTED_CONNECTION_TLS
@ SOURCE_ADDRESS_ALREADY_REGISTERED
@ UNSUPPORTED_ACTIVATION_TYPE
DoIpGenericHeaderNackCodes
Enum representing DoIP Generic Header NACK codes (ISO 13400). These codes are used to indicate specif...
Definition: DoIpLayer.h:82
DoIpEntityStatusResponseCode
Enum representing DoIP entity status response codes (ISO 13400). These codes are used to indicate the...
Definition: DoIpLayer.h:354
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:258
@ OsiModelApplicationLayer
Application layer (layer 7)
Definition: ProtocolType.h:272
DoIpPayloadTypes
Enum representing DoIP payload types. These payload types are defined as part of theDoIP(Diagnostic o...
Definition: DoIpLayer.h:476
@ DIAGNOSTIC_POWER_MODE_RESPONSE
@ VEHICLE_IDENTIFICATION_REQUEST
@ DIAGNOSTIC_MESSAGE_NACK
@ VEHICLE_IDENTIFICATION_REQUEST_WITH_VIN
@ VEHICLE_ANNOUNCEMENT_MESSAGE
@ ROUTING_ACTIVATION_RESPONSE
@ DIAGNOSTIC_POWER_MODE_REQUEST
@ VEHICLE_IDENTIFICATION_REQUEST_WITH_EID
@ ROUTING_ACTIVATION_REQUEST
DoIpDiagnosticPowerModeCodes
Enum representing DoIP diagnostic power mode codes (ISO 13400). These codes indicate the diagnostic p...
Definition: DoIpLayer.h:319
DoIpActionCodes
Enum representing DoIP action codes for DoIP announcement messages (ISO 13400). These action codes sp...
Definition: DoIpLayer.h:112
@ ROUTING_ACTIVATION_REQUIRED
@ NO_FURTHER_ACTION_REQUIRED
DoIpDiagnosticMessageNackCodes
Enum representing DoIP diagnostic message NACK codes (ISO 13400). These codes indicate reasons for re...
Definition: DoIpLayer.h:273
@ TRANSPORT_PROTOCOL_ERROR
Definition: DoIpLayer.h:18
uint8_t protocolVersion
DoIP version (DOIPV)
Definition: DoIpLayer.h:20
uint16_t payloadType
DoIP payload type (DOIPT)
Definition: DoIpLayer.h:24
uint32_t payloadLength
DoIP content payload length (DOIPL)
Definition: DoIpLayer.h:26
uint8_t invertProtocolVersion
DoIP invert version (DOIPIV). Inverse of protocol version.
Definition: DoIpLayer.h:22