File syn_doip.c¶
FileList > proto > syn_doip.c
Go to the source code of this file
SyntropicOS ISO 13400-2 Diagnostic over IP (DoIP) Implementation.
#include "syntropic/proto/syn_doip.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| uint16_t | syn_doip_encode_header (const SYN_DoIP_Header * hdr, uint8_t * buf, uint16_t max_len) Encode 8-byte DoIP Header into target buffer. |
| bool | syn_doip_init (SYN_DoIP_Server * server, uint16_t logical_address) Initialize DoIP Server instance. |
| bool | syn_doip_parse_header (const uint8_t * buf, uint16_t len, SYN_DoIP_Header * hdr) Parse 8-byte DoIP Header from raw buffer. |
| bool | syn_doip_process_msg (SYN_DoIP_Server * server, SYN_UDS_Server * uds, const uint8_t * rx_buf, uint16_t rx_len, uint8_t * tx_buf, uint16_t max_tx_len, uint16_t * tx_len) Process incoming DoIP message (UDP or TCP) and route UDS requests to syn_uds. |
| bool | syn_doip_set_identifiers (SYN_DoIP_Server * server, const uint8_t vin, const uint8_t eid, const uint8_t gid) Set VIN, EID, and GID parameters for vehicle identification responses. |
Public Static Functions¶
| Type | Name |
|---|---|
| bool | build_generic_nack (uint8_t nack_code, uint8_t * tx_buf, uint16_t max_tx, uint16_t * tx_len) Build DoIP Generic NACK response. |
| uint16_t | peek_u16_be (const uint8_t * buf) Unpack 16-bit unsigned integer from big-endian byte array. |
| uint32_t | peek_u32_be (const uint8_t * buf) Unpack 32-bit unsigned integer from big-endian byte array. |
| void | poke_u16_be (uint16_t val, uint8_t * buf) Pack 16-bit unsigned integer into big-endian byte array. |
| void | poke_u32_be (uint32_t val, uint8_t * buf) Pack 32-bit unsigned integer into big-endian byte array. |
Public Functions Documentation¶
function syn_doip_encode_header¶
Encode 8-byte DoIP Header into target buffer.
Parameters:
hdrInput header structure.bufOutput buffer.max_lenOutput buffer capacity (must be >= 8).
Returns:
Length written (8), or 0 on error.
function syn_doip_init¶
Initialize DoIP Server instance.
Parameters:
serverPointer to DoIP server instance.logical_addressECU logical address (e.g. 0x1001).
Returns:
true on success, false if server is NULL.
function syn_doip_parse_header¶
Parse 8-byte DoIP Header from raw buffer.
Parameters:
bufInput buffer.lenInput buffer length.hdrOutput header structure.
Returns:
true if header is valid, false otherwise.
function syn_doip_process_msg¶
Process incoming DoIP message (UDP or TCP) and route UDS requests to syn_uds.
bool syn_doip_process_msg (
SYN_DoIP_Server * server,
SYN_UDS_Server * uds,
const uint8_t * rx_buf,
uint16_t rx_len,
uint8_t * tx_buf,
uint16_t max_tx_len,
uint16_t * tx_len
)
Parameters:
serverPointer to DoIP server instance.udsPointer to UDS server instance.rx_bufIncoming raw DoIP packet.rx_lenIncoming packet length.tx_bufOutput buffer for DoIP response frame.max_tx_lenMaximum output buffer capacity.tx_lenOutput pointer for written response length.
Returns:
true if message was processed successfully, false on invalid request/null.
function syn_doip_set_identifiers¶
Set VIN, EID, and GID parameters for vehicle identification responses.
bool syn_doip_set_identifiers (
SYN_DoIP_Server * server,
const uint8_t vin,
const uint8_t eid,
const uint8_t gid
)
Parameters:
serverPointer to DoIP server.vin17-byte VIN buffer.eid6-byte EID (MAC) buffer.gid6-byte GID buffer.
Returns:
true on success, false on NULL pointers.
Public Static Functions Documentation¶
function build_generic_nack¶
Build DoIP Generic NACK response.
static bool build_generic_nack (
uint8_t nack_code,
uint8_t * tx_buf,
uint16_t max_tx,
uint16_t * tx_len
)
Parameters:
nack_codeNACK error code.tx_bufTarget output buffer.max_txCapacity of tx_buf.tx_lenOutput length pointer.
Returns:
true on success, false if buffer is too small.
function peek_u16_be¶
Unpack 16-bit unsigned integer from big-endian byte array.
Parameters:
bufInput byte buffer.
Returns:
16-bit integer value.
function peek_u32_be¶
Unpack 32-bit unsigned integer from big-endian byte array.
Parameters:
bufInput byte buffer.
Returns:
32-bit integer value.
function poke_u16_be¶
Pack 16-bit unsigned integer into big-endian byte array.
Parameters:
val16-bit integer value.bufTarget byte buffer.
function poke_u32_be¶
Pack 32-bit unsigned integer into big-endian byte array.
Parameters:
val32-bit integer value.bufTarget byte buffer.
The documentation for this class was generated from the following file src/syntropic/proto/syn_doip.c