File syn_uds.h¶
Go to the source code of this file
ISO 14229 Unified Diagnostic Services (UDS) Server Implementation. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_UDS_DIDEntry Data Identifier (DID) Registry Entry. |
| struct | SYN_UDS_DTCEntry Diagnostic Trouble Code (DTC) Registry Entry. |
| struct | SYN_UDS_Server UDS Server Instance Context. |
Public Types¶
| Type | Name |
|---|---|
| typedef bool(* | SYN_UDS_AccessTimingHandler AccessTimingParameter (0x83) callback function signature. |
| enum | SYN_UDS_AccessTimingType UDS AccessTimingParameter (0x83) Subfunctions. |
| enum | SYN_UDS_AddrMode UDS Addressing Modes (ISO 14229-1) |
| typedef bool(* | SYN_UDS_AuthHandler Authentication (0x29) callback function signature. |
| typedef bool(* | SYN_UDS_CommControlHandler CommunicationControl (0x28) callback function signature. |
| enum | SYN_UDS_CommControlType UDS CommunicationControl (0x28) Subfunctions. |
| typedef bool(* | SYN_UDS_DTCHandler ReadDTCInformation (0x19) callback function signature. |
| typedef bool(* | SYN_UDS_DynamicDIDHandler DynamicallyDefineDataIdentifier (0x2C) callback function signature. |
| typedef bool(* | SYN_UDS_FileTransferHandler RequestFileTransfer (0x38) callback function signature. |
| typedef bool(* | SYN_UDS_IOControlHandler InputOutputControlByIdentifier (0x2F) callback function signature. |
| typedef bool(* | SYN_UDS_LinkControlHandler LinkControl (0x87) callback function signature. |
| typedef bool(* | SYN_UDS_MemoryHandler ReadMemoryByAddress (0x23) and WriteMemoryByAddress (0x3D) callback function signature. |
| typedef bool(* | SYN_UDS_PeriodicDataHandler ReadDataByPeriodicIdentifier (0x2A) callback function signature. |
| typedef void(* | SYN_UDS_ResetHandler ECUReset (0x11) deferred post-TX reset callback function signature. |
| typedef bool(* | SYN_UDS_ResponseOnEventHandler ResponseOnEvent (0x86) callback function signature. |
| typedef bool(* | SYN_UDS_RoutineControlHandler RoutineControl (0x31) callback function signature. |
| typedef bool(* | SYN_UDS_ScalingDataHandler ReadScalingDataByIdentifier (0x24) callback function signature. |
| typedef bool(* | SYN_UDS_SecuredDataHandler SecuredDataTransmission (0x84) callback function signature. |
| enum | SYN_UDS_SecurityState UDS Security Access Unlock States. |
| enum | SYN_UDS_Session UDS Diagnostic Session Types (ISO 14229-1) |
| typedef bool(* | SYN_UDS_SessionTransitionHandler DiagnosticSessionControl (0x10) session transition rule callback signature. |
| enum | SYN_UDS_TransferState UDS Data Transfer States. |
Public Functions¶
| Type | Name |
|---|---|
| void | syn_uds_clear_pending_reset (SYN_UDS_Server * server) Clear pending ECU reset flag after executing reset or transmitting response. |
| bool | syn_uds_disable_aes128_security (SYN_UDS_Server * server) Disable AES-128 security mode and revert to standard XOR security key calculation. |
| bool | syn_uds_dtc_get_status (SYN_UDS_Server * server, uint32_t dtc, uint8_t * out_status) Get current 8-bit status byte for a registered DTC. |
| bool | syn_uds_dtc_report_test_result (SYN_UDS_Server * server, uint32_t dtc, bool failed) Report diagnostic test result for a registered DTC according to ISO 14229-1 state transitions. |
| bool | syn_uds_dtc_start_operation_cycle (SYN_UDS_Server * server) Advance server state to a new operation cycle. Clears testFailedThisOperationCycle and sets testNotCompletedThisOperationCycle for all registered DTCs. |
| bool | syn_uds_enable_aes128_security (SYN_UDS_Server * server, const uint8_t key) Enable AES-128 algorithm for UDS SecurityAccess (0x27) seed/key unlock. |
| uint8_t | syn_uds_get_pending_reset (const SYN_UDS_Server * server) Get pending ECU reset sub-function requested by 0x11 service. |
| uint8_t | syn_uds_get_security_level (const SYN_UDS_Server * server) Get currently unlocked security level (0 = locked, 1 = level 1, 2 = level 2...). |
| bool | syn_uds_init (SYN_UDS_Server * server) Initialize UDS Server context. |
| bool | syn_uds_is_sid_functional_supported (uint8_t sid) Check if Service Identifier (SID) supports Functional Addressing (1:N Broadcast). |
| bool | syn_uds_process_request (SYN_UDS_Server * server, const uint8_t * req, uint16_t req_len, uint8_t * resp_buf, uint16_t max_resp_len, uint16_t * resp_len, SYN_UDS_AddrMode addr_mode) Process incoming UDS request diagnostic payload and format response. |
| bool | syn_uds_register_access_timing (SYN_UDS_Server * server, SYN_UDS_AccessTimingHandler handler, void * ctx) Register AccessTimingParameter (0x83) callback handler. |
| bool | syn_uds_register_auth_handler (SYN_UDS_Server * server, SYN_UDS_AuthHandler handler, void * ctx) Register Authentication (0x29) handler. |
| bool | syn_uds_register_comm_control (SYN_UDS_Server * server, SYN_UDS_CommControlHandler handler, void * ctx) Register CommunicationControl (0x28) callback handler. |
| bool | syn_uds_register_did (SYN_UDS_Server * server, uint16_t did, uint8_t * data, uint16_t len, bool writable) Register Data Identifier (DID) mapping in UDS Server table. |
| bool | syn_uds_register_did_ext (SYN_UDS_Server * server, uint16_t did, uint8_t * data, uint16_t len, bool writable, uint8_t session_mask, uint16_t security_mask) Register Data Identifier (DID) with custom session & security permission bitmask. |
| bool | syn_uds_register_dtc (SYN_UDS_Server * server, uint32_t dtc, uint8_t status, uint8_t severity) Register Diagnostic Trouble Code (DTC) in UDS Server table. |
| bool | syn_uds_register_dtc_handler (SYN_UDS_Server * server, SYN_UDS_DTCHandler handler, void * ctx) Register ReadDTCInformation (0x19) callback handler. |
| bool | syn_uds_register_dynamic_did_handler (SYN_UDS_Server * server, SYN_UDS_DynamicDIDHandler handler, void * ctx) Register DynamicallyDefineDataIdentifier (0x2C) callback handler. |
| bool | syn_uds_register_file_transfer (SYN_UDS_Server * server, SYN_UDS_FileTransferHandler handler, void * ctx) Register RequestFileTransfer (0x38) handler. |
| bool | syn_uds_register_io_control (SYN_UDS_Server * server, SYN_UDS_IOControlHandler handler, void * ctx) Register InputOutputControlByIdentifier (0x2F) callback handler. |
| bool | syn_uds_register_link_control (SYN_UDS_Server * server, SYN_UDS_LinkControlHandler handler, void * ctx) Register LinkControl (0x87) callback handler. |
| bool | syn_uds_register_memory_handler (SYN_UDS_Server * server, SYN_UDS_MemoryHandler handler, void * ctx) Register ReadMemoryByAddress (0x23) and WriteMemoryByAddress (0x3D) handler. |
| bool | syn_uds_register_periodic_data_handler (SYN_UDS_Server * server, SYN_UDS_PeriodicDataHandler handler, void * ctx) Register ReadDataByPeriodicIdentifier (0x2A) callback handler. |
| bool | syn_uds_register_roe_handler (SYN_UDS_Server * server, SYN_UDS_ResponseOnEventHandler handler, void * ctx) Register ResponseOnEvent (0x86) callback handler. |
| bool | syn_uds_register_routine_control (SYN_UDS_Server * server, SYN_UDS_RoutineControlHandler handler, void * ctx) Register RoutineControl (0x31) callback handler. |
| bool | syn_uds_register_scaling_data_handler (SYN_UDS_Server * server, SYN_UDS_ScalingDataHandler handler, void * ctx) Register ReadScalingDataByIdentifier (0x24) callback handler. |
| bool | syn_uds_register_secured_data (SYN_UDS_Server * server, SYN_UDS_SecuredDataHandler handler, void * ctx) Register SecuredDataTransmission (0x84) callback handler. |
| void | syn_uds_set_reset_handler (SYN_UDS_Server * server, SYN_UDS_ResetHandler cb, void * ctx) Register deferred post-TX ECU reset handler callback. |
| void | syn_uds_set_reset_wait_ms (SYN_UDS_Server * server, uint16_t wait_ms) Set post-TX ECU reset delay window duration in milliseconds. |
| bool | syn_uds_set_security_seed_bytes (SYN_UDS_Server * server, const uint8_t seed) Set custom 16-byte seed for AES-128 SecurityAccess. |
| bool | syn_uds_set_service_security_mask (SYN_UDS_Server * server, uint8_t sid, uint16_t security_mask) Configure required security level mask for a specific Service Identifier. |
| bool | syn_uds_set_service_session_mask (SYN_UDS_Server * server, uint8_t sid, uint8_t session_mask) Configure allowed diagnostic session mask for a specific Service Identifier. |
| void | syn_uds_set_session_transition_handler (SYN_UDS_Server * server, SYN_UDS_SessionTransitionHandler cb, void * ctx) Register optional session transition policy callback. |
| void | syn_uds_tick (SYN_UDS_Server * server, uint32_t dt_ms) Advance periodic S3 server timer by dt_ms milliseconds. Reverts session to DEFAULT and locks security state if S3 timer expires (5000ms). |
Macros¶
Detailed Description¶
Provides a zero-allocation, lightweight UDS server protocol stack for automotive diagnostic session management, Data Identifier (DID) read/write, security access seed/key unlocks, routine controls, and ECU reset over ISO-TP.
Public Types Documentation¶
typedef SYN_UDS_AccessTimingHandler¶
AccessTimingParameter (0x83) callback function signature.
typedef bool(* SYN_UDS_AccessTimingHandler) (SYN_UDS_AccessTimingType timing_type, uint16_t *p2_max_ms, uint16_t *p2_star_max_10ms, void *ctx);
enum SYN_UDS_AccessTimingType¶
UDS AccessTimingParameter (0x83) Subfunctions.
enum SYN_UDS_AccessTimingType {
SYN_UDS_TIMING_READ_EXTENDED = 0x01U,
SYN_UDS_TIMING_SET_TO_DEFAULT = 0x02U,
SYN_UDS_TIMING_READ_ACTIVE = 0x03U,
SYN_UDS_TIMING_SET_TO_GIVEN = 0x04U
};
enum SYN_UDS_AddrMode¶
UDS Addressing Modes (ISO 14229-1)
typedef SYN_UDS_AuthHandler¶
Authentication (0x29) callback function signature.
typedef bool(* SYN_UDS_AuthHandler) (uint8_t subfunction, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_CommControlHandler¶
CommunicationControl (0x28) callback function signature.
typedef bool(* SYN_UDS_CommControlHandler) (SYN_UDS_CommControlType control_type, uint8_t comm_type, void *ctx);
enum SYN_UDS_CommControlType¶
UDS CommunicationControl (0x28) Subfunctions.
enum SYN_UDS_CommControlType {
SYN_UDS_COMM_ENABLE_RX_AND_TX = 0x00U,
SYN_UDS_COMM_ENABLE_RX_DISABLE_TX = 0x01U,
SYN_UDS_COMM_DISABLE_RX_ENABLE_TX = 0x02U,
SYN_UDS_COMM_DISABLE_RX_AND_TX = 0x03U,
SYN_UDS_COMM_ENABLE_RX_TX_ENHANCED = 0x04U,
SYN_UDS_COMM_ENABLE_RX_ENHANCED = 0x05U
};
typedef SYN_UDS_DTCHandler¶
ReadDTCInformation (0x19) callback function signature.
typedef bool(* SYN_UDS_DTCHandler) (uint8_t subfunction, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_DynamicDIDHandler¶
DynamicallyDefineDataIdentifier (0x2C) callback function signature.
typedef bool(* SYN_UDS_DynamicDIDHandler) (uint8_t subfunction, uint16_t dyn_did, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_FileTransferHandler¶
RequestFileTransfer (0x38) callback function signature.
typedef bool(* SYN_UDS_FileTransferHandler) (uint8_t mode, const char *file_path, uint16_t path_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_IOControlHandler¶
InputOutputControlByIdentifier (0x2F) callback function signature.
typedef bool(* SYN_UDS_IOControlHandler) (uint16_t did, uint8_t control_opt, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_LinkControlHandler¶
LinkControl (0x87) callback function signature.
typedef bool(* SYN_UDS_LinkControlHandler) (uint8_t subfunction, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_MemoryHandler¶
ReadMemoryByAddress (0x23) and WriteMemoryByAddress (0x3D) callback function signature.
typedef bool(* SYN_UDS_MemoryHandler) (bool is_write, uint32_t address, uint32_t size, uint8_t *data_buf, void *ctx);
typedef SYN_UDS_PeriodicDataHandler¶
ReadDataByPeriodicIdentifier (0x2A) callback function signature.
typedef bool(* SYN_UDS_PeriodicDataHandler) (uint8_t mode, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_ResetHandler¶
ECUReset (0x11) deferred post-TX reset callback function signature.
typedef SYN_UDS_ResponseOnEventHandler¶
ResponseOnEvent (0x86) callback function signature.
typedef bool(* SYN_UDS_ResponseOnEventHandler) (uint8_t subfunction, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_RoutineControlHandler¶
RoutineControl (0x31) callback function signature.
typedef bool(* SYN_UDS_RoutineControlHandler) (uint8_t subfunction, uint16_t routine_id, const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_ScalingDataHandler¶
ReadScalingDataByIdentifier (0x24) callback function signature.
typedef bool(* SYN_UDS_ScalingDataHandler) (uint16_t did, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
typedef SYN_UDS_SecuredDataHandler¶
SecuredDataTransmission (0x84) callback function signature.
typedef bool(* SYN_UDS_SecuredDataHandler) (const uint8_t *in_data, uint16_t in_len, uint8_t *out_buf, uint16_t max_out_len, uint16_t *out_len, void *ctx);
enum SYN_UDS_SecurityState¶
UDS Security Access Unlock States.
enum SYN_UDS_SecurityState {
SYN_UDS_SECURITY_LOCKED = 0x00U,
SYN_UDS_SECURITY_SEED_SENT = 0x01U,
SYN_UDS_SECURITY_UNLOCKED = 0x02U
};
enum SYN_UDS_Session¶
UDS Diagnostic Session Types (ISO 14229-1)
enum SYN_UDS_Session {
SYN_UDS_SESSION_DEFAULT = 0x01U,
SYN_UDS_SESSION_PROGRAMMING = 0x02U,
SYN_UDS_SESSION_EXTENDED = 0x03U,
SYN_UDS_SESSION_SAFETY_SYSTEM = 0x04U
};
typedef SYN_UDS_SessionTransitionHandler¶
DiagnosticSessionControl (0x10) session transition rule callback signature.
typedef bool(* SYN_UDS_SessionTransitionHandler) (SYN_UDS_Session from_session, SYN_UDS_Session to_session, void *ctx);
enum SYN_UDS_TransferState¶
UDS Data Transfer States.
enum SYN_UDS_TransferState {
SYN_UDS_TRANSFER_IDLE = 0U,
SYN_UDS_TRANSFER_DOWNLOAD = 1U,
SYN_UDS_TRANSFER_UPLOAD = 2U
};
Public Functions Documentation¶
function syn_uds_clear_pending_reset¶
Clear pending ECU reset flag after executing reset or transmitting response.
Parameters:
serverPointer to UDS server instance.
function syn_uds_disable_aes128_security¶
Disable AES-128 security mode and revert to standard XOR security key calculation.
Parameters:
serverPointer to UDS server instance.
Returns:
true on success, false if server is NULL.
function syn_uds_dtc_get_status¶
Get current 8-bit status byte for a registered DTC.
Parameters:
serverPointer to UDS server instance.dtc24-bit Diagnostic Trouble Code.out_statusOutput pointer to store DTC status byte.
Returns:
true if DTC found, false otherwise.
function syn_uds_dtc_report_test_result¶
Report diagnostic test result for a registered DTC according to ISO 14229-1 state transitions.
Updates DTC status bits (testFailed, testFailedThisOperationCycle, pendingDTC, confirmedDTC, etc.) and fault detection counter.
Parameters:
serverPointer to UDS server instance.dtc24-bit Diagnostic Trouble Code.failedTrue if test failed, false if test passed.
Returns:
true if DTC found and updated, false otherwise.
function syn_uds_dtc_start_operation_cycle¶
Advance server state to a new operation cycle. Clears testFailedThisOperationCycle and sets testNotCompletedThisOperationCycle for all registered DTCs.
Parameters:
serverPointer to UDS server instance.
Returns:
true on success, false if server is NULL.
function syn_uds_enable_aes128_security¶
Enable AES-128 algorithm for UDS SecurityAccess (0x27) seed/key unlock.
Parameters:
serverPointer to UDS server instance.key16-byte AES-128 secret key.
Returns:
true on success, false if server or key is NULL.
function syn_uds_get_pending_reset¶
Get pending ECU reset sub-function requested by 0x11 service.
Parameters:
serverPointer to UDS server instance.
Returns:
Pending reset type (e.g. 0x01 = hard, 0x02 = keyOffOn, 0x03 = soft), or 0 if none.
function syn_uds_get_security_level¶
Get currently unlocked security level (0 = locked, 1 = level 1, 2 = level 2...).
Parameters:
serverPointer to UDS server instance.
Returns:
Active security level uint8_t.
function syn_uds_init¶
Initialize UDS Server context.
Parameters:
serverPointer to UDS server instance.
Returns:
true on success, false if server is NULL.
function syn_uds_is_sid_functional_supported¶
Check if Service Identifier (SID) supports Functional Addressing (1:N Broadcast).
Parameters:
sidService Identifier (SID).
Returns:
true if service supports functional addressing, false if physical addressing only.
function syn_uds_process_request¶
Process incoming UDS request diagnostic payload and format response.
bool syn_uds_process_request (
SYN_UDS_Server * server,
const uint8_t * req,
uint16_t req_len,
uint8_t * resp_buf,
uint16_t max_resp_len,
uint16_t * resp_len,
SYN_UDS_AddrMode addr_mode
)
Parameters:
serverPointer to UDS server instance.reqPointer to input request bytes.req_lenLength of request payload in bytes.resp_bufOutput buffer for response bytes.max_resp_lenCapacity of output response buffer.resp_lenPointer to store generated response byte length.addr_modeAddressing mode (SYN_UDS_ADDR_PHYSICAL or SYN_UDS_ADDR_FUNCTIONAL).
Returns:
true if response frame generated, false on invalid parameters.
function syn_uds_register_access_timing¶
Register AccessTimingParameter (0x83) callback handler.
bool syn_uds_register_access_timing (
SYN_UDS_Server * server,
SYN_UDS_AccessTimingHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x83 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_auth_handler¶
Register Authentication (0x29) handler.
bool syn_uds_register_auth_handler (
SYN_UDS_Server * server,
SYN_UDS_AuthHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x29 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_comm_control¶
Register CommunicationControl (0x28) callback handler.
bool syn_uds_register_comm_control (
SYN_UDS_Server * server,
SYN_UDS_CommControlHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x28 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_did¶
Register Data Identifier (DID) mapping in UDS Server table.
bool syn_uds_register_did (
SYN_UDS_Server * server,
uint16_t did,
uint8_t * data,
uint16_t len,
bool writable
)
Parameters:
serverPointer to UDS server instance.did16-bit Data Identifier code (e.g., 0xF190 for VIN).dataPointer to data memory buffer.lenData byte length.writableTrue if DID allows WriteDataByIdentifier (0x2E).
Returns:
true on success, false if table full or invalid params.
function syn_uds_register_did_ext¶
Register Data Identifier (DID) with custom session & security permission bitmask.
bool syn_uds_register_did_ext (
SYN_UDS_Server * server,
uint16_t did,
uint8_t * data,
uint16_t len,
bool writable,
uint8_t session_mask,
uint16_t security_mask
)
Parameters:
serverPointer to UDS server instance.did16-bit Data Identifier code (e.g., 0xF190 for VIN).dataPointer to data memory buffer.lenData byte length.writableTrue if DID allows WriteDataByIdentifier (0x2E).session_maskPermitted session bitmask (SYN_UDS_SESSION_MASK_*).security_maskPermitted security level bitmask (SYN_UDS_SECURITY_MASK_*).
Returns:
true on success, false if table full or invalid params.
function syn_uds_register_dtc¶
Register Diagnostic Trouble Code (DTC) in UDS Server table.
bool syn_uds_register_dtc (
SYN_UDS_Server * server,
uint32_t dtc,
uint8_t status,
uint8_t severity
)
Parameters:
serverPointer to UDS server instance.dtc24-bit Diagnostic Trouble Code (e.g., 0x012345).statusInitial DTCStatusByte bitmask.severityDTCSeverityByte (severity & class).
Returns:
true on success, false if table full or invalid params.
function syn_uds_register_dtc_handler¶
Register ReadDTCInformation (0x19) callback handler.
bool syn_uds_register_dtc_handler (
SYN_UDS_Server * server,
SYN_UDS_DTCHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked for custom DTC subfunctions.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_dynamic_did_handler¶
Register DynamicallyDefineDataIdentifier (0x2C) callback handler.
bool syn_uds_register_dynamic_did_handler (
SYN_UDS_Server * server,
SYN_UDS_DynamicDIDHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x2C is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_file_transfer¶
Register RequestFileTransfer (0x38) handler.
bool syn_uds_register_file_transfer (
SYN_UDS_Server * server,
SYN_UDS_FileTransferHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x38 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_io_control¶
Register InputOutputControlByIdentifier (0x2F) callback handler.
bool syn_uds_register_io_control (
SYN_UDS_Server * server,
SYN_UDS_IOControlHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x2F is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_link_control¶
Register LinkControl (0x87) callback handler.
bool syn_uds_register_link_control (
SYN_UDS_Server * server,
SYN_UDS_LinkControlHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x87 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_memory_handler¶
Register ReadMemoryByAddress (0x23) and WriteMemoryByAddress (0x3D) handler.
bool syn_uds_register_memory_handler (
SYN_UDS_Server * server,
SYN_UDS_MemoryHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when memory services are processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_periodic_data_handler¶
Register ReadDataByPeriodicIdentifier (0x2A) callback handler.
bool syn_uds_register_periodic_data_handler (
SYN_UDS_Server * server,
SYN_UDS_PeriodicDataHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x2A is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_roe_handler¶
Register ResponseOnEvent (0x86) callback handler.
bool syn_uds_register_roe_handler (
SYN_UDS_Server * server,
SYN_UDS_ResponseOnEventHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x86 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_routine_control¶
Register RoutineControl (0x31) callback handler.
bool syn_uds_register_routine_control (
SYN_UDS_Server * server,
SYN_UDS_RoutineControlHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x31 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_scaling_data_handler¶
Register ReadScalingDataByIdentifier (0x24) callback handler.
bool syn_uds_register_scaling_data_handler (
SYN_UDS_Server * server,
SYN_UDS_ScalingDataHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x24 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_register_secured_data¶
Register SecuredDataTransmission (0x84) callback handler.
bool syn_uds_register_secured_data (
SYN_UDS_Server * server,
SYN_UDS_SecuredDataHandler handler,
void * ctx
)
Parameters:
serverPointer to UDS server instance.handlerCallback function invoked when Service 0x84 is processed.ctxUser context passed to handler.
Returns:
true on success, false if server is NULL.
function syn_uds_set_reset_handler¶
Register deferred post-TX ECU reset handler callback.
Parameters:
serverPointer to UDS server instance.cbCallback function to execute after post-TX reset delay.ctxContext pointer passed to callback function.
function syn_uds_set_reset_wait_ms¶
Set post-TX ECU reset delay window duration in milliseconds.
Parameters:
serverPointer to UDS server instance.wait_msDelay duration in ms before executing reset callback.
function syn_uds_set_security_seed_bytes¶
Set custom 16-byte seed for AES-128 SecurityAccess.
Parameters:
serverPointer to UDS server instance.seed16-byte seed buffer.
Returns:
true on success, false if server or seed is NULL.
function syn_uds_set_service_security_mask¶
Configure required security level mask for a specific Service Identifier.
bool syn_uds_set_service_security_mask (
SYN_UDS_Server * server,
uint8_t sid,
uint16_t security_mask
)
Parameters:
serverPointer to UDS server instance.sidService Identifier (e.g. 0x27, 0x34).security_maskRequired security level bitmask (SYN_UDS_SECURITY_MASK_*).
Returns:
true on success, false if server is NULL.
function syn_uds_set_service_session_mask¶
Configure allowed diagnostic session mask for a specific Service Identifier.
bool syn_uds_set_service_session_mask (
SYN_UDS_Server * server,
uint8_t sid,
uint8_t session_mask
)
Parameters:
serverPointer to UDS server instance.sidService Identifier (e.g. 0x27, 0x34).session_maskAllowed session bitmask (SYN_UDS_SESSION_MASK_*).
Returns:
true on success, false if server is NULL.
function syn_uds_set_session_transition_handler¶
Register optional session transition policy callback.
void syn_uds_set_session_transition_handler (
SYN_UDS_Server * server,
SYN_UDS_SessionTransitionHandler cb,
void * ctx
)
Parameters:
serverPointer to UDS server instance.cbCallback function to validate session transition graph permissions.ctxContext pointer passed to callback function.
function syn_uds_tick¶
Advance periodic S3 server timer by dt_ms milliseconds. Reverts session to DEFAULT and locks security state if S3 timer expires (5000ms).
Parameters:
serverPointer to UDS server instance.dt_msMilliseconds elapsed since last tick.
Macro Definition Documentation¶
define SYN_UDS_DEFAULT_RESET_TX_WAIT_MS¶
Default post-TX ECU reset wait time in ms
define SYN_UDS_DTC_CLASS_MASK¶
DTC class mask
define SYN_UDS_DTC_FORMAT_ISO14229_1¶
ISO 14229-1 DTC format
define SYN_UDS_DTC_FORMAT_ISO15031_6¶
ISO 15031-6 DTC format
define SYN_UDS_DTC_FORMAT_ISO27145_4¶
ISO 27145-4 DTC format
define SYN_UDS_DTC_FORMAT_SAE_J1939_73¶
SAE J1939-73 DTC format
define SYN_UDS_DTC_GROUP_ALL¶
All DTC groups
define SYN_UDS_DTC_GROUP_BODY¶
Body DTC group
define SYN_UDS_DTC_GROUP_CHASSIS¶
Chassis DTC group
define SYN_UDS_DTC_GROUP_EMISSIONS¶
Emissions-related systems DTC group
define SYN_UDS_DTC_GROUP_NETWORK¶
Network DTC group
define SYN_UDS_DTC_GROUP_POWERTRAIN¶
Powertrain DTC group
define SYN_UDS_DTC_REPORT_BY_SEVERITY_MASK¶
Report DTCs by severity mask
define SYN_UDS_DTC_REPORT_BY_STATUS_MASK¶
Report DTCs by status mask
define SYN_UDS_DTC_REPORT_EMISSIONS_OBD_BY_STATUS_MASK¶
Report OBD DTCs
define SYN_UDS_DTC_REPORT_EXT_DATA_RECORD_BY_DTC¶
Report extended data record by DTC
define SYN_UDS_DTC_REPORT_EXT_DATA_RECORD_BY_RECORD_NUM¶
Report extended data by record num
define SYN_UDS_DTC_REPORT_FAULT_DETECTION_COUNTER¶
Report fault detection counter
define SYN_UDS_DTC_REPORT_FIRST_CONFIRMED¶
Report first confirmed DTC
define SYN_UDS_DTC_REPORT_FIRST_TEST_FAILED¶
Report first test failed DTC
define SYN_UDS_DTC_REPORT_MIRROR_MEMORY_BY_STATUS_MASK¶
Report mirror memory by status mask
define SYN_UDS_DTC_REPORT_MIRROR_MEMORY_EXT_DATA¶
Report mirror memory extended data
define SYN_UDS_DTC_REPORT_MOST_RECENT_CONFIRMED¶
Report most recent confirmed DTC
define SYN_UDS_DTC_REPORT_MOST_RECENT_TEST_FAILED¶
Report most recent test failed DTC \
define SYN_UDS_DTC_REPORT_NUMBER_BY_SEVERITY_MASK¶
Report number of DTCs by severity mask
define SYN_UDS_DTC_REPORT_NUMBER_BY_STATUS_MASK¶
Report number of DTCs by status mask \
define SYN_UDS_DTC_REPORT_NUMBER_EMISSIONS_OBD_BY_STATUS_MASK¶
Report number of OBD DTCs
define SYN_UDS_DTC_REPORT_NUMBER_MIRROR_MEMORY_BY_STATUS_MASK¶
Report number of mirror memory DTCs
define SYN_UDS_DTC_REPORT_SEVERITY_INFO¶
Report DTC severity info
define SYN_UDS_DTC_REPORT_SNAPSHOT_IDENTIFICATION¶
Report DTC snapshot identification \
define SYN_UDS_DTC_REPORT_SNAPSHOT_RECORD_BY_DTC¶
Report DTC snapshot record by DTC
define SYN_UDS_DTC_REPORT_STORED_DATA_BY_RECORD_NUM¶
Report stored data by record number
define SYN_UDS_DTC_REPORT_SUPPORTED¶
Report supported DTCs
define SYN_UDS_DTC_REPORT_USER_DEF_MEMORY_BY_STATUS_MASK¶
Report user-def memory by status mask
define SYN_UDS_DTC_REPORT_USER_DEF_MEMORY_EXT_DATA_BY_DTC¶
Report user-def ext data by DTC
define SYN_UDS_DTC_REPORT_USER_DEF_MEMORY_SNAPSHOT_BY_DTC¶
Report user-def snapshot by DTC
define SYN_UDS_DTC_REPORT_WITH_PERMANENT_STATUS¶
Report DTCs with permanent status
define SYN_UDS_DTC_REPORT_WWH_OBD_BY_MASK_RECORD¶
Report WWH-OBD by mask record
define SYN_UDS_DTC_REPORT_WWH_OBD_WITH_PERMANENT_STATUS¶
Report WWH-OBD with permanent status
define SYN_UDS_DTC_SEVERITY_CHECK_AT_NEXT_HALT¶
Check at next halt
define SYN_UDS_DTC_SEVERITY_CHECK_IMMEDIATELY¶
Check immediately
define SYN_UDS_DTC_SEVERITY_MAINTENANCE_REQUIRED¶
Maintenance required
define SYN_UDS_DTC_SEVERITY_MASK¶
DTC severity mask
define SYN_UDS_DTC_SEVERITY_NO_SEVERITY¶
No severity
define SYN_UDS_DTC_STATUS_AVAILABILITY_MASK¶
DTC status availability bitmask
define SYN_UDS_DTC_STATUS_CONFIRMED_DTC¶
Confirmed DTC bit
define SYN_UDS_DTC_STATUS_PENDING_DTC¶
Pending DTC bit
define SYN_UDS_DTC_STATUS_TEST_FAILED¶
Test failed bit
define SYN_UDS_DTC_STATUS_TEST_FAILED_SINCE_LAST_CLEAR¶
Test failed since clear
define SYN_UDS_DTC_STATUS_TEST_FAILED_THIS_OP_CYCLE¶
Test failed this operation cycle
define SYN_UDS_DTC_STATUS_TEST_NOT_COMPLETED_SINCE_LAST_CLEAR¶
Test not completed since clear
define SYN_UDS_DTC_STATUS_TEST_NOT_COMPLETED_THIS_OP_CYCLE¶
Test not completed this op cycle
define SYN_UDS_DTC_STATUS_WARNING_INDICATOR_REQUESTED¶
Warning indicator requested \
define SYN_UDS_MAX_DIDS¶
Maximum supported DIDs
define SYN_UDS_MAX_DTCS¶
Maximum stored DTC count
define SYN_UDS_MAX_SERVICE_OVERRIDES¶
Maximum supported per-service policy overrides (default: 8)
define SYN_UDS_NRC_CONDITIONS_NOT_CORRECT¶
Conditions not correct (0x22)
define SYN_UDS_NRC_EXCEEDED_NUMBER_OF_ATTEMPTS¶
Exceeded number of attempts (0x36)
define SYN_UDS_NRC_GENERAL_PROGRAMMING_FAILURE¶
General programming failure (0x72)
define SYN_UDS_NRC_INCORRECT_MESSAGE_LENGTH¶
Incorrect message length or invalid format (0x13)
define SYN_UDS_NRC_INVALID_KEY¶
Invalid key (0x35)
define SYN_UDS_NRC_REQUEST_OUT_OF_RANGE¶
Request out of range (0x31)
define SYN_UDS_NRC_REQUEST_SEQUENCE_ERROR¶
Request sequence error (0x24)
define SYN_UDS_NRC_REQUIRED_TIME_DELAY_NOT_EXPIRED¶
Required time delay not expired (0x37)
define SYN_UDS_NRC_RESPONSE_TOO_LONG¶
Response too long (0x14)
define SYN_UDS_NRC_SECURITY_ACCESS_DENIED¶
Security access denied (0x33)
define SYN_UDS_NRC_SERVICE_NOT_SUPPORTED¶
Service not supported (0x11)
define SYN_UDS_NRC_SUBFUNCTION_NOT_SUPPORTED¶
Sub-function not supported (0x12)
define SYN_UDS_NRC_SUBFUNCTION_NOT_SUPPORTED_IN_ACTIVE_SESSION¶
Sub-function not supported in active session (0x7E)
define SYN_UDS_NRC_SUCCESS¶
Positive response (0x00)
define SYN_UDS_NRC_TRANSFER_DATA_SUSPENDED¶
Transfer data suspended (0x71)
define SYN_UDS_NRC_WRONG_BLOCK_SEQUENCE_COUNTER¶
Wrong block sequence counter (0x73)
define SYN_UDS_RESET_DISABLE_RAPID_POWER_SHUTDOWN¶
Disable rapid power shutdown
define SYN_UDS_RESET_ENABLE_RAPID_POWER_SHUTDOWN¶
Enable rapid power shutdown
define SYN_UDS_RESET_HARD¶
Hard reset
define SYN_UDS_RESET_KEY_OFF_ON¶
Key off/on reset
define SYN_UDS_RESET_SOFT¶
Soft reset
define SYN_UDS_RESPONSE_NEGATIVE¶
Negative response code header
define SYN_UDS_S3_TIMEOUT_MS¶
S3 session timeout in ms
define SYN_UDS_SECURITY_DELAY_MS¶
Security delay penalty in ms
define SYN_UDS_SECURITY_MASK_ALL¶
Allowed in all security states
define SYN_UDS_SECURITY_MASK_LEVEL_1¶
Security Level 1 required
define SYN_UDS_SECURITY_MASK_LEVEL_2¶
Security Level 2 required
define SYN_UDS_SECURITY_MASK_LEVEL_3¶
Security Level 3 required
define SYN_UDS_SECURITY_MASK_NONE¶
Unlocked without security (Level 0 / Locked)
define SYN_UDS_SECURITY_MAX_ATTEMPTS¶
Max security unlock attempts
define SYN_UDS_SESSION_MASK_ALL¶
Allowed in all sessions
define SYN_UDS_SESSION_MASK_DEFAULT¶
Default Session
define SYN_UDS_SESSION_MASK_EXTENDED¶
Extended Diagnostic Session
define SYN_UDS_SESSION_MASK_PROGRAMMING¶
Programming Session
define SYN_UDS_SESSION_MASK_SAFETY¶
Safety System Session
define SYN_UDS_SID_ACCESS_TIMING_PARAMETER¶
AccessTimingParameter
define SYN_UDS_SID_AUTHENTICATION¶
Authentication
define SYN_UDS_SID_CLEAR_DIAGNOSTIC_INFORMATION¶
ClearDiagnosticInformation
define SYN_UDS_SID_COMMUNICATION_CONTROL¶
CommunicationControl
define SYN_UDS_SID_CONTROL_DTC_SETTING¶
ControlDTCSetting
define SYN_UDS_SID_DIAGNOSTIC_SESSION_CONTROL¶
DiagnosticSessionControl
define SYN_UDS_SID_DYNAMICALLY_DEFINE_DATA_IDENTIFIER¶
DynamicallyDefineDataIdentifier \
define SYN_UDS_SID_ECU_RESET¶
ECUReset
define SYN_UDS_SID_INPUT_OUTPUT_CONTROL_BY_IDENTIFIER¶
InputOutputControlByIdentifier \
define SYN_UDS_SID_LINK_CONTROL¶
LinkControl
define SYN_UDS_SID_READ_DATA_BY_IDENTIFIER¶
ReadDataByIdentifier
define SYN_UDS_SID_READ_DATA_BY_PERIODIC_IDENTIFIER¶
ReadDataByPeriodicIdentifier
define SYN_UDS_SID_READ_DTC_INFORMATION¶
ReadDTCInformation
define SYN_UDS_SID_READ_MEMORY_BY_ADDRESS¶
ReadMemoryByAddress
define SYN_UDS_SID_READ_SCALING_DATA_BY_IDENTIFIER¶
ReadScalingDataByIdentifier
define SYN_UDS_SID_REQUEST_DOWNLOAD¶
RequestDownload
define SYN_UDS_SID_REQUEST_FILE_TRANSFER¶
RequestFileTransfer
define SYN_UDS_SID_REQUEST_TRANSFER_EXIT¶
RequestTransferExit
define SYN_UDS_SID_REQUEST_UPLOAD¶
RequestUpload
define SYN_UDS_SID_RESPONSE_ON_EVENT¶
ResponseOnEvent
define SYN_UDS_SID_ROUTINE_CONTROL¶
RoutineControl
define SYN_UDS_SID_SECURED_DATA_TRANSMISSION¶
SecuredDataTransmission
define SYN_UDS_SID_SECURITY_ACCESS¶
SecurityAccess
define SYN_UDS_SID_TESTER_PRESENT¶
TesterPresent
define SYN_UDS_SID_TRANSFER_DATA¶
TransferData
define SYN_UDS_SID_WRITE_DATA_BY_IDENTIFIER¶
WriteDataByIdentifier
define SYN_UDS_SID_WRITE_MEMORY_BY_ADDRESS¶
WriteMemoryByAddress
The documentation for this class was generated from the following file src/syntropic/proto/syn_uds.h