Move command registry from components/command/ into components/core/. New modules: mod_canbus, mod_honeypot, mod_fallback, mod_redteam, mod_ota. Replace mod_proxy with tun_core (multiplexed SOCKS5 tunnel). Kconfig extended with per-module settings and async worker config.
71 lines
2.0 KiB
C
71 lines
2.0 KiB
C
/*
|
|
* canbus_isotp.h
|
|
* ISO-TP (ISO 15765-2) transport layer for CAN bus.
|
|
* Handles multi-frame messaging (> 8 bytes) required by UDS and OBD-II.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
ISOTP_OK = 0,
|
|
ISOTP_TIMEOUT,
|
|
ISOTP_OVERFLOW,
|
|
ISOTP_ERROR,
|
|
} isotp_status_t;
|
|
|
|
/*
|
|
* Send an ISO-TP message (blocking).
|
|
* Handles Single Frame for len <= 7, or First Frame + Consecutive Frames.
|
|
* Waits for Flow Control frame from receiver if multi-frame.
|
|
*
|
|
* tx_id: CAN arbitration ID for outgoing frames
|
|
* rx_id: CAN arbitration ID for incoming Flow Control
|
|
* data/len: payload to send
|
|
* timeout_ms: max wait for Flow Control response
|
|
*/
|
|
isotp_status_t isotp_send(uint32_t tx_id, uint32_t rx_id,
|
|
const uint8_t *data, size_t len,
|
|
int timeout_ms);
|
|
|
|
/*
|
|
* Receive an ISO-TP message (blocking).
|
|
* Reassembles Single Frame or First Frame + Consecutive Frames.
|
|
* Sends Flow Control frame to sender if multi-frame.
|
|
*
|
|
* rx_id: CAN arbitration ID to listen for
|
|
* buf/buf_cap: output buffer
|
|
* out_len: actual received length
|
|
* timeout_ms: max wait time
|
|
*/
|
|
isotp_status_t isotp_recv(uint32_t rx_id,
|
|
uint8_t *buf, size_t buf_cap, size_t *out_len,
|
|
int timeout_ms);
|
|
|
|
/*
|
|
* Request-Response: send then receive (most common UDS pattern).
|
|
* Combines isotp_send() + isotp_recv() with proper FC handling.
|
|
*
|
|
* tx_id/rx_id: CAN ID pair (e.g. 0x7E0/0x7E8 for ECU diagnostics)
|
|
*/
|
|
isotp_status_t isotp_request(uint32_t tx_id, uint32_t rx_id,
|
|
const uint8_t *req, size_t req_len,
|
|
uint8_t *resp, size_t resp_cap, size_t *resp_len,
|
|
int timeout_ms);
|
|
|
|
/*
|
|
* Install ISO-TP RX hook into the CAN driver callback chain.
|
|
* Must be called after can_driver_set_rx_callback() so that the
|
|
* previous callback (sniff/record) is preserved in the chain.
|
|
*/
|
|
void isotp_install_hook(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|