libdoip  0.1.0
DoIP (Diagnostics over Internet Protocol) ISO 13400 C++17 Library
doip Namespace Reference

Namespaces

 ansi
 
 message
 Factory functions for creating specific DoIP message types.
 
 times
 
 uds
 
 util
 

Classes

struct  ByteArray
 A dynamic array of bytes with utility methods for network protocol handling. More...
 
class  DoIPClient
 
class  DoIPConnection
 
class  DoIPDefaultConnection
 Default implementation of IConnectionContext. More...
 
class  GenericFixedId
 Generic fixed-length identifier class template. More...
 
class  DoIPMessage
 Represents a complete DoIP message with internal ByteArray representation. More...
 
struct  ServerConfig
 Server configuration structure used to initialize a DoIP server. More...
 
class  DoIPServer
 DoIP Server class to handle incoming DoIP connections and UDP messages. More...
 
struct  DoIPServerModel
 DoIP Server Model - Configuration and callbacks for a DoIP server connection. More...
 
struct  DefaultDoIPServerModel
 Default DoIP Server Model with no-op callbacks. More...
 
class  IConnectionContext
 Interface between DoIPServerStateMachine and DoIPConnection. More...
 
class  Logger
 Centralized logger for the DoIP library. More...
 
class  TimerManager
 

Typedefs

using ByteArrayRef = std::pair< const uint8_t *, size_t >
 Reference to raw array of bytes. More...
 
using DoIPAddress = uint16_t
 Represents a 16-bit DoIP address consisting of high and low significant bytes. More...
 
using DoIPRequest = std::pair< size_t, const uint8_t * >
 
using StateChangeHandler = std::function< void()>
 
using MessageHandler = std::function< void(std::optional< DoIPMessage >)>
 
using TimeOutHandler = std::function< void(ConnectionTimers)>
 
using DoIpVin = GenericFixedId< 17, true, '0'>
 Vehicle Identification Number (VIN) - 17 bytes according to ISO 3779 Padded with ASCII '0' characters when shorter than 17 bytes. More...
 
using DoIpEid = GenericFixedId< 6, false >
 Entity Identifier (EID) - 6 bytes for unique entity identification. More...
 
using DoIpGid = GenericFixedId< 6, false >
 Group Identifier (GID) - 6 bytes for group identification. More...
 
using OptDoIPMessage = std::optional< DoIPMessage >
 
using DoIPDiagnosticAck = std::optional< DoIPNegativeDiagnosticAck >
 Alias for diagnostic acknowledgment type. More...
 
using ConnectionAcceptedHandler = std::function< std::optional< DoIPServerModel >(DoIPConnection *)>
 Callback invoked when a new TCP connection is established. More...
 
using ServerModelOpenHandler = std::function< void(IConnectionContext &)>
 
using ServerModelCloseHandler = std::function< void(IConnectionContext &, DoIPCloseReason)>
 
using ServerModelDiagnosticHandler = std::function< DoIPDiagnosticAck(IConnectionContext &, const DoIPMessage &)>
 
using ServerModelDiagnosticNotificationHandler = std::function< void(IConnectionContext &, DoIPDiagnosticAck)>
 
using ServerModelDownstreamResponseHandler = std::function< void(const ByteArray &response, DoIPDownstreamResult result)>
 Callback for downstream response notification. More...
 
using ServerModelDownstreamHandler = std::function< DoIPDownstreamResult(IConnectionContext &ctx, const DoIPMessage &msg, ServerModelDownstreamResponseHandler callback)>
 Callback for downstream (subnet) request handling. More...
 
using UniqueServerModelPtr = std::unique_ptr< DoIPServerModel >
 
using MacAddress = std::array< uint8_t, 6 >
 Type alias for MAC address (6 bytes) More...
 

Enumerations

enum class  DoIPCloseReason : uint8_t {
  None ,
  InitialInactivityTimeout ,
  GeneralInactivityTimeout ,
  AliveCheckTimeout ,
  SocketError ,
  InvalidMessage ,
  ApplicationRequest ,
  RoutingActivationDenied
}
 Reason for connection closure. More...
 
enum class  ConnectionTimers : uint8_t {
  InitialInactivity ,
  GeneralInactivity ,
  AliveCheck ,
  DownstreamResponse ,
  UserDefined
}
 
enum class  DoIPDownstreamResult {
  Pending ,
  Handled ,
  Error
}
 Result of a downstream request initiation. More...
 
enum class  DoIPFurtherAction : uint8_t {
  NoFurtherAction = 0x00 ,
  RoutingActivationForCentralSecurity = 0x10
}
 
enum class  DoIPNegativeDiagnosticAck : uint8_t {
  InvalidSourceAddress = 2 ,
  UnknownTargetAddress = 3 ,
  DiagnosticMessageTooLarge = 4 ,
  OutOfMemory = 5 ,
  TargetUnreachable = 6 ,
  UnknownNetwork = 7 ,
  TransportProtocolError = 8 ,
  TargetBusy = 9
}
 
enum class  DoIPPayloadType : uint16_t {
  NegativeAck = 0x0000 ,
  VehicleIdentificationRequest = 0x0001 ,
  VehicleIdentificationRequestWithEid = 0x0002 ,
  VehicleIdentificationRequestWithVin = 0x0003 ,
  VehicleIdentificationResponse = 0x0004 ,
  RoutingActivationRequest = 0x0005 ,
  RoutingActivationResponse = 0x0006 ,
  AliveCheckRequest = 0x0007 ,
  AliveCheckResponse = 0x0008 ,
  EntityStatusRequest = 0x4001 ,
  EntityStatusResponse = 0x4002 ,
  DiagnosticPowerModeRequest = 0x4003 ,
  DiagnosticPowerModeResponse = 0x4004 ,
  DiagnosticMessage = 0x8001 ,
  DiagnosticMessageAck = 0x8002 ,
  DiagnosticMessageNegativeAck = 0x8003 ,
  PeriodicDiagnosticMessage = 0x8004
}
 DoIP Payload Type identifiers according to ISO 13400-2. More...
 
enum class  DoIPRoutingActivationResult : uint8_t {
  UnknownSourceAddress = 0x00 ,
  NoMoreRoutingSlotsAvailable = 0x01 ,
  InvalidAddressOrRoutingType = 0x02 ,
  SourceAddressAlreadyRegistered = 0x03 ,
  Unauthorized = 0x04 ,
  MissingConfirmation = 0x05 ,
  InvalidRoutingType = 0x06 ,
  SecuredConnectionRequired = 0x07 ,
  VehicleNotReadyForRouting = 0x08 ,
  RouteActivated = 0x10 ,
  RouteActivatedConfirmationRequired = 0x11
}
 
enum class  DoIPServerEvent {
  RoutingActivationReceived ,
  AliveCheckResponseReceived ,
  DiagnosticMessageReceived ,
  DiagnosticMessageReceivedDownstream ,
  CloseRequestReceived ,
  Initial_inactivity_timeout ,
  GeneralInactivityTimeout ,
  AliveCheckTimeout ,
  DownstreamTimeout ,
  InvalidMessage ,
  SocketError
}
 
enum class  DoIPServerState {
  SocketInitialized ,
  WaitRoutingActivation ,
  RoutingActivated ,
  WaitAliveCheckResponse ,
  WaitDownstreamResponse ,
  Finalize ,
  Closed
}
 
enum class  DoIPSyncStatus : uint8_t {
  GidVinSynchronized = 0x00 ,
  GidVinNotSynchronized = 0x10
}
 

Functions

std::ostream & operator<< (std::ostream &os, const ByteArray &arr)
 Stream operator for ByteArray. More...
 
bool isValidSourceAddress (const uint8_t *data, size_t offset=0)
 Check if source address is valid. More...
 
bool tryReadAddressFrom (const uint8_t *data, size_t offset, DoIPAddress &address)
 Try read the DoIP address from a byte array. More...
 
DoIPAddress readAddressFrom (const uint8_t *data, size_t offset=0)
 Reads the DoIP address from a byte array. More...
 
std::ostream & operator<< (std::ostream &os, DoIPCloseReason event)
 
std::ostream & operator<< (std::ostream &os, ConnectionTimers tid)
 
std::ostream & operator<< (std::ostream &os, DoIPDownstreamResult result)
 
std::ostream & operator<< (std::ostream &os, const DoIPFurtherAction far)
 
std::ostream & operator<< (std::ostream &os, const DoIpVin &vin)
 Stream output operator for DoIpVin, DoIpEid, and DoIpGid. More...
 
std::ostream & operator<< (std::ostream &os, const DoIpEid &eid)
 Stream output operator for DoIpEid/DoIpGid. More...
 
std::ostream & operator<< (std::ostream &os, const DoIPMessage &msg)
 Stream operator for DoIPMessage. More...
 
std::ostream & operator<< (std::ostream &os, doip::DoIPNegativeDiagnosticAck nack)
 Stream output operator for DoIPNegativeDiagnosticAck. More...
 
std::ostream & operator<< (std::ostream &os, doip::DoIPDiagnosticAck ack)
 Stream output operator for DoIPNegativeDiagnosticAck. More...
 
constexpr bool isValidPayloadType (uint16_t value) noexcept
 Validates if a uint16_t value represents a valid DoIPPayloadType. More...
 
constexpr std::optional< DoIPPayloadTypetoPayloadType (uint16_t value) noexcept
 Safely converts uint16_t to DoIPPayloadType with validation. More...
 
constexpr std::optional< DoIPPayloadTypetoPayloadType (uint8_t hsb, uint8_t lsb) noexcept
 
std::ostream & operator<< (std::ostream &os, DoIPPayloadType type)
 Stream operator for DoIPPayloadType enum. More...
 
bool closeSocketOnRoutingActivationResult (DoIPRoutingActivationResult result)
 Check if the socket should be closed based on the routing activation result. More...
 
std::ostream & operator<< (std::ostream &os, DoIPRoutingActivationResult result)
 
std::ostream & operator<< (std::ostream &os, DoIPServerEvent event)
 
std::ostream & operator<< (std::ostream &os, DoIPServerState state)
 
bool getMacAddress (const char *ifname, MacAddress &mac)
 
bool getFirstMacAddress (MacAddress &mac)
 Retrieves the MAC address of the first available network interface. More...
 

Variables

constexpr size_t DOIP_ADDRESS_SIZE = 2
 
constexpr DoIPAddress ZERO_ADDRESS = 0x0000
 
constexpr DoIPAddress MIN_SOURCE_ADDRESS = 0xE000
 
constexpr DoIPAddress MAX_SOURCE_ADDRESS = 0xE3FF
 
const int _maxDataSize = 64
 
constexpr uint8_t ISO_13400_2010 = 1
 ISO/DIS 13400-2:2010. More...
 
constexpr uint8_t ISO_13400_2012 = 2
 ISO 13400-2:2012. More...
 
constexpr uint8_t ISO_13400_2019 = 3
 ISO 13400-2:2019. More...
 
constexpr uint8_t ISO_13400_2025 = 4
 ISO 13400-2:2019/Amd1, ISO 13400-2:2025. More...
 
constexpr uint8_t PROTOCOL_VERSION = ISO_13400_2025
 Current protocol version (table 16) More...
 
constexpr uint8_t PROTOCOL_VERSION_INV = static_cast<uint8_t>(~ISO_13400_2025)
 
constexpr uint8_t DIAGNOSTIC_MESSAGE_ACK = 0
 Positive ack for diagnostic message (table 24) More...
 
constexpr size_t DOIP_HEADER_SIZE = 8
 Size of the DoIP header. More...
 
constexpr size_t DOIP_DIAG_HEADER_SIZE = DOIP_HEADER_SIZE + 4
 Size of the DoIP diagnostic message header. More...
 
const ServerConfig DefaultServerConfig {}
 
constexpr int DOIP_SERVER_TCP_PORT = 13400
 
constexpr const char * DEFAULT_PATTERN = "[%H:%M:%S.%e] [%n] [%^%l%$] %v"
 
constexpr const char * SHORT_PATTERN = "[%n] [%^%l%$] %v"
 Pattern for short output without timestamp. More...
 

Typedef Documentation

◆ ByteArrayRef

using doip::ByteArrayRef = typedef std::pair<const uint8_t *, size_t>

Reference to raw array of bytes.

A pair containing a pointer to a byte array and its size. Useful for passing byte array references without copying.

Examples
/home/runner/work/libdoip/libdoip/inc/ByteArray.h.

Definition at line 291 of file ByteArray.h.

◆ ConnectionAcceptedHandler

using doip::ConnectionAcceptedHandler = typedef std::function<std::optional<DoIPServerModel>(DoIPConnection *)>

Callback invoked when a new TCP connection is established.

Returns
DoIPServerModel to use for this connection, or std::nullopt to reject

Definition at line 63 of file DoIPServer.h.

◆ DoIPAddress

using doip::DoIPAddress = typedef uint16_t

Represents a 16-bit DoIP address consisting of high and low significant bytes.

This structure encapsulates a 16-bit address used in DoIP (Diagnostic over Internet Protocol) communication. The address is stored as two separate bytes (HSB and LSB) and provides convenient methods for construction, access, and manipulation.

Note
The address follows big-endian byte ordering (HSB first, then LSB).

Definition at line 26 of file DoIPAddress.h.

◆ DoIPDiagnosticAck

using doip::DoIPDiagnosticAck = typedef std::optional<DoIPNegativeDiagnosticAck>

Alias for diagnostic acknowledgment type.

This type represents either a successful acknowledgment (std::nullopt) or a negative acknowledgment (DoIPNegativeDiagnosticAck). This is to circumvent the reserved value '0' in DoIPNegativeDiagnosticAck.

Definition at line 31 of file DoIPNegativeDiagnosticAck.h.

◆ DoIpEid

using doip::DoIpEid = typedef GenericFixedId<6, false>

Entity Identifier (EID) - 6 bytes for unique entity identification.

Definition at line 354 of file DoIPIdentifiers.h.

◆ DoIpGid

using doip::DoIpGid = typedef GenericFixedId<6, false>

Group Identifier (GID) - 6 bytes for group identification.

Definition at line 359 of file DoIPIdentifiers.h.

◆ DoIPRequest

using doip::DoIPRequest = typedef std::pair<size_t, const uint8_t *>

Definition at line 20 of file DoIPClient.h.

◆ DoIpVin

using doip::DoIpVin = typedef GenericFixedId<17, true, '0'>

Vehicle Identification Number (VIN) - 17 bytes according to ISO 3779 Padded with ASCII '0' characters when shorter than 17 bytes.

Definition at line 349 of file DoIPIdentifiers.h.

◆ MacAddress

using doip::MacAddress = typedef std::array<uint8_t, 6>

Type alias for MAC address (6 bytes)

Examples
/home/runner/work/libdoip/libdoip/inc/MacAddress.h.

Definition at line 12 of file MacAddress.h.

◆ MessageHandler

using doip::MessageHandler = typedef std::function<void(std::optional<DoIPMessage>)>

Definition at line 44 of file DoIPDefaultConnection.h.

◆ OptDoIPMessage

using doip::OptDoIPMessage = typedef std::optional<DoIPMessage>

Definition at line 65 of file DoIPMessage.h.

◆ ServerModelCloseHandler

using doip::ServerModelCloseHandler = typedef std::function<void(IConnectionContext &, DoIPCloseReason)>

Definition at line 22 of file DoIPServerModel.h.

◆ ServerModelDiagnosticHandler

Definition at line 23 of file DoIPServerModel.h.

◆ ServerModelDiagnosticNotificationHandler

Definition at line 24 of file DoIPServerModel.h.

◆ ServerModelDownstreamHandler

Callback for downstream (subnet) request handling.

This callback is invoked when a diagnostic message needs to be forwarded to a downstream device (e.g., via CAN, LIN, or another transport).

The implementation is responsible for:

  1. Sending the diagnostic message to the appropriate downstream device
  2. When a response is received, calling ctx.receiveDownstreamResponse(response)

The state machine will handle timeout management internally.

Parameters
ctxThe connection context (use for receiveDownstreamResponse callback)
msgThe diagnostic message to forward downstream
callbackthe callback method to call when the downstream response arrived
Returns
DoIPDownstreamResult indicating the result of the request initiation
  • Pending: Async request initiated, response will come via receiveDownstreamResponse
  • Handled: Message was handled synchronously, no state transition needed
  • Error: Failed to initiate request, connection should handle error

Definition at line 54 of file DoIPServerModel.h.

◆ ServerModelDownstreamResponseHandler

using doip::ServerModelDownstreamResponseHandler = typedef std::function<void(const ByteArray &response, DoIPDownstreamResult result)>

Callback for downstream response notification.

Parameters
responsethe downstream response (maybe empty)
resultthe downstream result

Definition at line 32 of file DoIPServerModel.h.

◆ ServerModelOpenHandler

using doip::ServerModelOpenHandler = typedef std::function<void(IConnectionContext &)>

Definition at line 21 of file DoIPServerModel.h.

◆ StateChangeHandler

using doip::StateChangeHandler = typedef std::function<void()>

Definition at line 43 of file DoIPDefaultConnection.h.

◆ TimeOutHandler

using doip::TimeOutHandler = typedef std::function<void(ConnectionTimers)>

Definition at line 45 of file DoIPDefaultConnection.h.

◆ UniqueServerModelPtr

using doip::UniqueServerModelPtr = typedef std::unique_ptr<DoIPServerModel>

Definition at line 103 of file DoIPServerModel.h.

Enumeration Type Documentation

◆ ConnectionTimers

enum doip::ConnectionTimers : uint8_t
strong
Enumerator
InitialInactivity 
GeneralInactivity 
AliveCheck 
DownstreamResponse 
UserDefined 

Definition at line 18 of file DoIPDefaultConnection.h.

◆ DoIPCloseReason

enum doip::DoIPCloseReason : uint8_t
strong

Reason for connection closure.

Enumerator
None 
InitialInactivityTimeout 
GeneralInactivityTimeout 
AliveCheckTimeout 
SocketError 
InvalidMessage 
ApplicationRequest 
RoutingActivationDenied 

Definition at line 12 of file DoIPCloseReason.h.

◆ DoIPDownstreamResult

Result of a downstream request initiation.

Enumerator
Pending 

Request was sent, waiting for async response.

Handled 

Request was handled synchronously (no downstream needed)

Error 

Failed to initiate downstream request.

Definition at line 11 of file DoIPDownstreamResult.h.

◆ DoIPFurtherAction

enum doip::DoIPFurtherAction : uint8_t
strong
Enumerator
NoFurtherAction 
RoutingActivationForCentralSecurity 

Definition at line 8 of file DoIPFurtherAction.h.

◆ DoIPNegativeDiagnosticAck

enum doip::DoIPNegativeDiagnosticAck : uint8_t
strong
Enumerator
InvalidSourceAddress 
UnknownTargetAddress 
DiagnosticMessageTooLarge 
OutOfMemory 
TargetUnreachable 
UnknownNetwork 
TransportProtocolError 
TargetBusy 

Definition at line 12 of file DoIPNegativeDiagnosticAck.h.

◆ DoIPPayloadType

enum doip::DoIPPayloadType : uint16_t
strong

DoIP Payload Type identifiers according to ISO 13400-2.

This enumeration contains all payload types used in the DoIP protocol. The values correspond to the message types specified in ISO 13400-2.

Enumerator
NegativeAck 

Generic Negative Acknowledgement (NACK) Sent when a message cannot be processed.

VehicleIdentificationRequest 

Vehicle Identification Request Request for vehicle identification.

VehicleIdentificationRequestWithEid 

Vehicle Identification Request with EID Request with EID (Entity Identifier).

VehicleIdentificationRequestWithVin 

Vehicle Identification Request with VIN Request with VIN (Vehicle Identification Number).

VehicleIdentificationResponse 

Vehicle Identification Response (Vehicle Announcement) Response to a Vehicle Identification Request or periodic announcement.

RoutingActivationRequest 

Routing Activation Request Request to activate routing for a diagnostic connection.

RoutingActivationResponse 

Routing Activation Response Response to a Routing Activation Request.

AliveCheckRequest 

Alive Check Request Request to check if the connection is still alive.

AliveCheckResponse 

Alive Check Response Response to an Alive Check Request.

EntityStatusRequest 

Entity Status Request Request for the status of a DoIP entity.

EntityStatusResponse 

Entity Status Response Response to an Entity Status Request.

DiagnosticPowerModeRequest 

Diagnostic Power Mode Request Request for the current power mode.

DiagnosticPowerModeResponse 

Diagnostic Power Mode Response Response to a Diagnostic Power Mode Request.

DiagnosticMessage 

Diagnostic Message Payload for diagnostic communication (UDS, KWP, etc.).

DiagnosticMessageAck 

Diagnostic Message Positive Acknowledgement Positive acknowledgement of a diagnostic message.

DiagnosticMessageNegativeAck 

Diagnostic Message Negative Acknowledgement Negative acknowledgement of a diagnostic message.

PeriodicDiagnosticMessage 

Periodic Diagnostic Message Periodically sent diagnostic message.

Definition at line 19 of file DoIPPayloadType.h.

◆ DoIPRoutingActivationResult

enum doip::DoIPRoutingActivationResult : uint8_t
strong
Enumerator
UnknownSourceAddress 
NoMoreRoutingSlotsAvailable 
InvalidAddressOrRoutingType 
SourceAddressAlreadyRegistered 
Unauthorized 
MissingConfirmation 
InvalidRoutingType 
SecuredConnectionRequired 
VehicleNotReadyForRouting 
RouteActivated 
RouteActivatedConfirmationRequired 

Definition at line 7 of file DoIPRoutingActivationResult.h.

◆ DoIPServerEvent

enum doip::DoIPServerEvent
strong
Enumerator
RoutingActivationReceived 
AliveCheckResponseReceived 
DiagnosticMessageReceived 
DiagnosticMessageReceivedDownstream 
CloseRequestReceived 
Initial_inactivity_timeout 
GeneralInactivityTimeout 
AliveCheckTimeout 
DownstreamTimeout 
InvalidMessage 
SocketError 

Definition at line 9 of file DoIPServerEvent.h.

◆ DoIPServerState

enum doip::DoIPServerState
strong
Enumerator
SocketInitialized 
WaitRoutingActivation 
RoutingActivated 
WaitAliveCheckResponse 
WaitDownstreamResponse 
Finalize 
Closed 

Definition at line 9 of file DoIPServerState.h.

◆ DoIPSyncStatus

enum doip::DoIPSyncStatus : uint8_t
strong
Enumerator
GidVinSynchronized 
GidVinNotSynchronized 

Definition at line 8 of file DoIPSyncStatus.h.

Function Documentation

◆ closeSocketOnRoutingActivationResult()

bool doip::closeSocketOnRoutingActivationResult ( DoIPRoutingActivationResult  result)
inline

Check if the socket should be closed based on the routing activation result.

Parameters
resultthe routing activation result code
Returns
true if the socket should be closed, false otherwise

Definition at line 28 of file DoIPRoutingActivationResult.h.

References InvalidAddressOrRoutingType, InvalidRoutingType, MissingConfirmation, NoMoreRoutingSlotsAvailable, RouteActivated, RouteActivatedConfirmationRequired, SecuredConnectionRequired, SourceAddressAlreadyRegistered, Unauthorized, UnknownSourceAddress, and VehicleNotReadyForRouting.

◆ getFirstMacAddress()

bool doip::getFirstMacAddress ( MacAddress mac)

Retrieves the MAC address of the first available network interface.

This is a convenience function that attempts to find and return the MAC address of the first available network interface on the system.

Parameters
macReference to a MacAddress where the result will be stored
Returns
true if a MAC address was successfully retrieved, false otherwise
Examples
/home/runner/work/libdoip/libdoip/inc/MacAddress.h.

Referenced by doip::DoIPServer::setDefaultEid().

◆ getMacAddress()

bool doip::getMacAddress ( const char *  ifname,
MacAddress mac 
)

◆ isValidPayloadType()

constexpr bool doip::isValidPayloadType ( uint16_t  value)
constexprnoexcept

Validates if a uint16_t value represents a valid DoIPPayloadType.

Parameters
valueThe value to validate
Returns
true if valid, false otherwise

Definition at line 136 of file DoIPPayloadType.h.

Referenced by toPayloadType().

◆ isValidSourceAddress()

bool doip::isValidSourceAddress ( const uint8_t *  data,
size_t  offset = 0 
)
inline

Check if source address is valid.

Parameters
datathe data array containing the address
offsetthe offset in the data array where the address starts
Returns
true the source address is valid
false the source address is NOT valid

Definition at line 39 of file DoIPAddress.h.

◆ operator<<() [1/14]

std::ostream& doip::operator<< ( std::ostream &  os,
ConnectionTimers  tid 
)
inline

◆ operator<<() [2/14]

std::ostream& doip::operator<< ( std::ostream &  os,
const ByteArray arr 
)
inline

Stream operator for ByteArray.

Prints each byte as a two-digit hex value separated by dots. Example: {0x01, 0x02, 0xFF} prints as "01.02.FF"

Parameters
osOutput stream
arrByteArray to print
Returns
std::ostream& Reference to the output stream
Examples
/home/runner/work/libdoip/libdoip/inc/ByteArray.h.

Definition at line 303 of file ByteArray.h.

◆ operator<<() [3/14]

std::ostream& doip::operator<< ( std::ostream &  os,
const DoIpEid eid 
)
inline

Stream output operator for DoIpEid/DoIpGid.

Parameters
osthe operation stream
eidthe DoIpEid/DoIpGid to output
Returns
std::ostream& {type} ["{type}"] //
Returns true in the case of success, false otherwise.

Definition at line 380 of file DoIPIdentifiers.h.

References doip::GenericFixedId< IdLength, zeroPadding, padChar >::toHexString().

◆ operator<<() [4/14]

std::ostream& doip::operator<< ( std::ostream &  os,
const DoIPFurtherAction  far 
)
inline

Definition at line 15 of file DoIPFurtherAction.h.

References NoFurtherAction, and RoutingActivationForCentralSecurity.

◆ operator<<() [5/14]

◆ operator<<() [6/14]

std::ostream& doip::operator<< ( std::ostream &  os,
const DoIpVin vin 
)
inline

Stream output operator for DoIpVin, DoIpEid, and DoIpGid.

Parameters
osthe operation stream
vinthe DoIpVin to output
Returns
std::ostream& the operation stream

Definition at line 368 of file DoIPIdentifiers.h.

References doip::GenericFixedId< IdLength, zeroPadding, padChar >::toString().

◆ operator<<() [7/14]

std::ostream& doip::operator<< ( std::ostream &  os,
doip::DoIPDiagnosticAck  ack 
)
inline

Stream output operator for DoIPNegativeDiagnosticAck.

Parameters
osthe output stream
ackthe negative acknowledgment code
Returns
std::ostream& the output stream

Definition at line 84 of file DoIPNegativeDiagnosticAck.h.

◆ operator<<() [8/14]

std::ostream& doip::operator<< ( std::ostream &  os,
doip::DoIPNegativeDiagnosticAck  nack 
)
inline

Stream output operator for DoIPNegativeDiagnosticAck.

Parameters
osthe output stream
nackthe negative acknowledgment code
Returns
std::ostream& the output stream

Definition at line 40 of file DoIPNegativeDiagnosticAck.h.

References DiagnosticMessageTooLarge, InvalidSourceAddress, OutOfMemory, TargetBusy, TargetUnreachable, TransportProtocolError, UnknownNetwork, and UnknownTargetAddress.

◆ operator<<() [9/14]

std::ostream& doip::operator<< ( std::ostream &  os,
DoIPCloseReason  event 
)
inline

◆ operator<<() [10/14]

std::ostream& doip::operator<< ( std::ostream &  os,
DoIPDownstreamResult  result 
)
inline

◆ operator<<() [11/14]

std::ostream& doip::operator<< ( std::ostream &  os,
DoIPPayloadType  type 
)
inline

Stream operator for DoIPPayloadType enum.

Prints the payload type name and its hex value. Example: "DiagnosticMessage (0x8001)"

Parameters
osOutput stream
typePayload type to print
Returns
std::ostream& Reference to the output stream

Definition at line 187 of file DoIPPayloadType.h.

References AliveCheckRequest, AliveCheckResponse, DiagnosticMessage, DiagnosticMessageAck, DiagnosticMessageNegativeAck, DiagnosticPowerModeRequest, DiagnosticPowerModeResponse, EntityStatusRequest, EntityStatusResponse, NegativeAck, PeriodicDiagnosticMessage, RoutingActivationRequest, RoutingActivationResponse, VehicleIdentificationRequest, VehicleIdentificationRequestWithEid, VehicleIdentificationRequestWithVin, and VehicleIdentificationResponse.

◆ operator<<() [12/14]

◆ operator<<() [13/14]

◆ operator<<() [14/14]

std::ostream& doip::operator<< ( std::ostream &  os,
DoIPServerState  state 
)
inline

◆ readAddressFrom()

DoIPAddress doip::readAddressFrom ( const uint8_t *  data,
size_t  offset = 0 
)
inline

Reads the DoIP address from a byte array.

Note
No bounds checking
Parameters
datathe pointer to the data array
offsetthe offset in bytes
Returns
DoIPAddress the parsed DoIP address. If data is nullptr, then ZERO_ADDRESS is returned.

Definition at line 69 of file DoIPAddress.h.

References ZERO_ADDRESS.

Referenced by doip::DoIPMessage::getLogicalAddress(), doip::DoIPMessage::getSourceAddress(), and doip::DoIPMessage::getTargetAddress().

◆ toPayloadType() [1/2]

constexpr std::optional<DoIPPayloadType> doip::toPayloadType ( uint16_t  value)
constexprnoexcept

Safely converts uint16_t to DoIPPayloadType with validation.

Parameters
valueThe value to convert
Returns
Optional containing the payload type if valid, nullopt otherwise

Definition at line 166 of file DoIPPayloadType.h.

References isValidPayloadType().

Referenced by toPayloadType(), and doip::DoIPMessage::tryParseHeader().

◆ toPayloadType() [2/2]

constexpr std::optional<DoIPPayloadType> doip::toPayloadType ( uint8_t  hsb,
uint8_t  lsb 
)
constexprnoexcept

Definition at line 173 of file DoIPPayloadType.h.

References toPayloadType().

◆ tryReadAddressFrom()

bool doip::tryReadAddressFrom ( const uint8_t *  data,
size_t  offset,
DoIPAddress address 
)
inline

Try read the DoIP address from a byte array.

Note
No bounds checking
Parameters
datathe pointer to the data array
offsetthe offset in bytes
addressthe address read
Returns
true address was read successfully
false invalid arguments

Definition at line 54 of file DoIPAddress.h.

Variable Documentation

◆ _maxDataSize

const int doip::_maxDataSize = 64

◆ DEFAULT_PATTERN

constexpr const char* doip::DEFAULT_PATTERN = "[%H:%M:%S.%e] [%n] [%^%l%$] %v"
constexpr

Definition at line 59 of file Logger.h.

Referenced by doip::Logger::get().

◆ DefaultServerConfig

const ServerConfig doip::DefaultServerConfig {}

Definition at line 55 of file DoIPServer.h.

◆ DIAGNOSTIC_MESSAGE_ACK

constexpr uint8_t doip::DIAGNOSTIC_MESSAGE_ACK = 0
constexpr

Positive ack for diagnostic message (table 24)

Definition at line 52 of file DoIPMessage.h.

Referenced by doip::message::makeDiagnosticPositiveResponse().

◆ DOIP_ADDRESS_SIZE

constexpr size_t doip::DOIP_ADDRESS_SIZE = 2
constexpr

Definition at line 15 of file DoIPAddress.h.

◆ DOIP_DIAG_HEADER_SIZE

constexpr size_t doip::DOIP_DIAG_HEADER_SIZE = DOIP_HEADER_SIZE + 4
constexpr

Size of the DoIP diagnostic message header.

Definition at line 62 of file DoIPMessage.h.

Referenced by doip::DoIPMessage::getDiagnosticMessagePayload().

◆ DOIP_HEADER_SIZE

◆ DOIP_SERVER_TCP_PORT

constexpr int doip::DOIP_SERVER_TCP_PORT = 13400
constexpr

Definition at line 57 of file DoIPServer.h.

Referenced by doip::DoIPServer::setupTcpSocket().

◆ ISO_13400_2010

constexpr uint8_t doip::ISO_13400_2010 = 1
constexpr

ISO/DIS 13400-2:2010.

Definition at line 26 of file DoIPMessage.h.

Referenced by doip::DoIPMessage::isValidProtocolVersion().

◆ ISO_13400_2012

constexpr uint8_t doip::ISO_13400_2012 = 2
constexpr

ISO 13400-2:2012.

Definition at line 31 of file DoIPMessage.h.

◆ ISO_13400_2019

constexpr uint8_t doip::ISO_13400_2019 = 3
constexpr

ISO 13400-2:2019.

Definition at line 36 of file DoIPMessage.h.

◆ ISO_13400_2025

constexpr uint8_t doip::ISO_13400_2025 = 4
constexpr

ISO 13400-2:2019/Amd1, ISO 13400-2:2025.

Definition at line 41 of file DoIPMessage.h.

Referenced by doip::DoIPMessage::isValidProtocolVersion().

◆ MAX_SOURCE_ADDRESS

constexpr DoIPAddress doip::MAX_SOURCE_ADDRESS = 0xE3FF
constexpr

Definition at line 30 of file DoIPAddress.h.

◆ MIN_SOURCE_ADDRESS

constexpr DoIPAddress doip::MIN_SOURCE_ADDRESS = 0xE000
constexpr

Definition at line 29 of file DoIPAddress.h.

◆ PROTOCOL_VERSION

constexpr uint8_t doip::PROTOCOL_VERSION = ISO_13400_2025
constexpr

Current protocol version (table 16)

Definition at line 46 of file DoIPMessage.h.

Referenced by doip::DoIPMessage::buildMessage(), and operator<<().

◆ PROTOCOL_VERSION_INV

constexpr uint8_t doip::PROTOCOL_VERSION_INV = static_cast<uint8_t>(~ISO_13400_2025)
constexpr

Definition at line 47 of file DoIPMessage.h.

Referenced by doip::DoIPMessage::buildMessage().

◆ SHORT_PATTERN

constexpr const char* doip::SHORT_PATTERN = "[%n] [%^%l%$] %v"
constexpr

Pattern for short output without timestamp.

Definition at line 65 of file Logger.h.

◆ ZERO_ADDRESS

constexpr DoIPAddress doip::ZERO_ADDRESS = 0x0000
constexpr