Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Protocol Adapter Layer

Decoupled communication protocols for Channels and Flows. More...

Data Structures

struct  rte_protocol_config_t
 Configuration passed to open a protocol adapter instance. More...
struct  rte_protocol_adapter_ops_t
 Operations vtable implemented by a concrete ProtocolAdapter. More...

Macros

#define RTE_PROTOCOL_ENDPOINT_STR_MAX   (64U)
 Maximum length of host, topic, or endpoint string.

Typedefs

typedef struct rte_protocol_impl_s * rte_protocol_handle_t
 Opaque protocol handle pointer.

Enumerations

enum  rte_protocol_type_t { RTE_PROTOCOL_TYPE_RAW_UDP = 1 , RTE_PROTOCOL_TYPE_RAW_TCP = 2 , RTE_PROTOCOL_TYPE_DDS = 3 }
 Protocol transport identifier. More...
enum  rte_protocol_role_t { RTE_PROTOCOL_ROLE_LISTEN = 1 , RTE_PROTOCOL_ROLE_CONNECT = 2 , RTE_PROTOCOL_ROLE_PUB = 3 , RTE_PROTOCOL_ROLE_SUB = 4 }
 Communication role of the protocol adapter instance. More...

Functions

rte_status_t rte_protocol_adapter_register (rte_protocol_type_t type, const rte_protocol_adapter_ops_t *ops)
 Registers a ProtocolAdapter implementation for a given protocol type.
const rte_protocol_adapter_ops_t * rte_protocol_adapter_get (rte_protocol_type_t type)
 Retrieves the registered ProtocolAdapter for a given protocol type.
const rte_protocol_adapter_ops_t * rte_protocol_adapter_get_udp (void)
 Returns the built-in raw UDP ProtocolAdapter vtable.
const rte_protocol_adapter_ops_t * rte_protocol_adapter_get_tcp (void)
 Returns the built-in raw TCP ProtocolAdapter vtable.

Detailed Description

Decoupled communication protocols for Channels and Flows.

Macro Definition Documentation

◆ RTE_PROTOCOL_ENDPOINT_STR_MAX

#define RTE_PROTOCOL_ENDPOINT_STR_MAX   (64U)

Maximum length of host, topic, or endpoint string.

Definition at line 36 of file rte_protocol_adapter.h.

Typedef Documentation

◆ rte_protocol_handle_t

typedef struct rte_protocol_impl_s* rte_protocol_handle_t

Opaque protocol handle pointer.

Definition at line 93 of file rte_protocol_adapter.h.

Enumeration Type Documentation

◆ rte_protocol_type_t

Protocol transport identifier.

Enumerator
RTE_PROTOCOL_TYPE_RAW_UDP 

Raw UDP datagram with optional handshake.

RTE_PROTOCOL_TYPE_RAW_TCP 

Raw TCP stream connection with framing.

RTE_PROTOCOL_TYPE_DDS 

DDS pub/sub flow middleware.

Definition at line 41 of file rte_protocol_adapter.h.

◆ rte_protocol_role_t

Communication role of the protocol adapter instance.

Enumerator
RTE_PROTOCOL_ROLE_LISTEN 

Passive listener / server.

RTE_PROTOCOL_ROLE_CONNECT 

Active connector / client.

RTE_PROTOCOL_ROLE_PUB 

Publisher.

RTE_PROTOCOL_ROLE_SUB 

Subscriber.

Definition at line 51 of file rte_protocol_adapter.h.

Function Documentation

◆ rte_protocol_adapter_register()

rte_status_t rte_protocol_adapter_register ( rte_protocol_type_t type,
const rte_protocol_adapter_ops_t * ops )

Registers a ProtocolAdapter implementation for a given protocol type.

Parameters
typeRTE_PROTOCOL_TYPE_RAW_UDP, RAW_TCP, or DDS.
opsVtable of protocol adapter operations. Must not be NULL.
Returns
RTE_STATUS_OK on success, RTE_STATUS_INVALID_PARAM on invalid argument.

Definition at line 14 of file rte_protocol_adapter.c.

◆ rte_protocol_adapter_get()

const rte_protocol_adapter_ops_t * rte_protocol_adapter_get ( rte_protocol_type_t type)

Retrieves the registered ProtocolAdapter for a given protocol type.

Parameters
typeRTE_PROTOCOL_TYPE_RAW_UDP, RAW_TCP, or DDS.
Returns
Pointer to operations vtable, or NULL if not registered.

Definition at line 43 of file rte_protocol_adapter.c.

◆ rte_protocol_adapter_get_udp()

const rte_protocol_adapter_ops_t * rte_protocol_adapter_get_udp ( void )

Returns the built-in raw UDP ProtocolAdapter vtable.

Its open() checks set_nonblocking(sock, true) on the socket it opened when that slot is non-NULL; on a failure it closes the socket and returns that status without writing *out_handle (REQ-OAL-SOCKET-002).

Returns
Pointer to the static UDP ProtocolAdapter vtable (never NULL).

Definition at line 253 of file rte_protocol_adapter_udp.c.

◆ rte_protocol_adapter_get_tcp()

const rte_protocol_adapter_ops_t * rte_protocol_adapter_get_tcp ( void )

Returns the built-in raw TCP ProtocolAdapter vtable.

Its open() checks set_nonblocking(sock, true) on the socket it opened when that slot is non-NULL; on a failure it closes the socket and returns that status without writing *out_handle (REQ-OAL-SOCKET-002).

Returns
Pointer to the static TCP ProtocolAdapter vtable (never NULL).

Definition at line 213 of file rte_protocol_adapter_tcp.c.