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
Point-to-Point Network Link

Connection-oriented link between independent processes (ADR-001). More...

Files

Data Structures

 Configuration for rte_netlink_open(). More...

Typedefs

typedef struct rte_netlink_impl_s * rte_netlink_handle_t
 Opaque handle to an established link, returned by rte_netlink_open().

Enumerations

enum  rte_netlink_role_t { RTE_NETLINK_ROLE_LISTEN = 0 , RTE_NETLINK_ROLE_CONNECT = 1 }
 Which side of the connection this link instance plays. More...

Functions

 RTE_DECLARE_STORAGE (rte_netlink_storage_t, 64U)
 Caller-owned, fixed-size storage backing one rte_netlink_handle_t.
rte_status_t rte_netlink_open (rte_netlink_storage_t *storage, const rte_netlink_config_t *config, rte_netlink_handle_t *out_handle)
 Establishes a point-to-point link: binds+accepts (LISTEN) or dials (CONNECT), per config->role.
rte_status_t rte_netlink_send (rte_netlink_handle_t handle, const void *message, size_t message_size, rte_duration_ms_t timeout_ms)
 Sends one fixed-size message, blocking at most timeout_ms.
rte_status_t rte_netlink_receive (rte_netlink_handle_t handle, void *out_message, size_t buffer_size, rte_duration_ms_t timeout_ms)
 Receives one fixed-size message, blocking at most timeout_ms.
rte_status_t rte_netlink_close (rte_netlink_handle_t handle)
 Closes a link.

Detailed Description

Connection-oriented link between independent processes (ADR-001).

Typedef Documentation

◆ rte_netlink_handle_t

typedef struct rte_netlink_impl_s* rte_netlink_handle_t

Opaque handle to an established link, returned by rte_netlink_open().

Definition at line 58 of file rte_netlink.h.

Enumeration Type Documentation

◆ rte_netlink_role_t

Which side of the connection this link instance plays.

A TCP-style OSAdapter needs exactly one LISTEN side (binds, accepts one peer) and one CONNECT side (dials the listener) per link; which role a given process/role/site plays is an application-level decision (e.g. "site West listens, site East connects"), not something this service decides on its own.

Enumerator
RTE_NETLINK_ROLE_LISTEN 

Bind config->port and accept one peer.

RTE_NETLINK_ROLE_CONNECT 

Dial config->host:config->port.

Definition at line 69 of file rte_netlink.h.

Function Documentation

◆ rte_netlink_open()

rte_status_t rte_netlink_open ( rte_netlink_storage_t * storage,
const rte_netlink_config_t * config,
rte_netlink_handle_t * out_handle )

Establishes a point-to-point link: binds+accepts (LISTEN) or dials (CONNECT), per config->role.

Parameters
storageCaller-owned storage for the handle's state. Must not be NULL.
configLink configuration. Must not be NULL; config->message_size must be > 0; config->host must not be NULL for CONNECT.
out_handleReceives the established link's handle. Must not be NULL.
Returns
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM for a bad argument; RTE_STATUS_TIMEOUT if the link is not established within config->connect_timeout_ms; RTE_STATUS_INTERNAL_ERROR if the OSAdapter fails to create the link, including a refused non-zero config->rcvbuf_bytes/sndbuf_bytes (REQ-OAL-NETLINK-015); no handle is returned (*out_handle is NULL); RTE_STATUS_NOT_INITIALIZED if no OSAdapter is registered (rte_osadapter_netlink_register()); RTE_STATUS_NOT_SUPPORTED if the registered OSAdapter does not implement open. REQ-OAL-NETLINK-010, REQ-OAL-NETLINK-015

Definition at line 45 of file rte_netlink.c.

◆ rte_netlink_send()

rte_status_t rte_netlink_send ( rte_netlink_handle_t handle,
const void * message,
size_t message_size,
rte_duration_ms_t timeout_ms )

Sends one fixed-size message, blocking at most timeout_ms.

Parameters
handleLink handle. Must not be NULL.
messageMessage data to send. Must not be NULL.
message_sizeSize of message in bytes; must be > 0.
timeout_msMaximum time to wait for the send to complete.
Returns
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM; RTE_STATUS_TIMEOUT if the send does not complete in time; RTE_STATUS_HARDWARE_FAULT if the OSAdapter can positively confirm the peer is gone (e.g. a TCP disconnect, or an unreliable-transport OSAdapter's own best-effort signal - not guaranteed on every OSAdapter, see REQ-OAL-NETLINK-014); RTE_STATUS_NOT_INITIALIZED/ RTE_STATUS_NOT_SUPPORTED as in rte_netlink_open(). REQ-OAL-NETLINK-011

Definition at line 73 of file rte_netlink.c.

◆ rte_netlink_receive()

rte_status_t rte_netlink_receive ( rte_netlink_handle_t handle,
void * out_message,
size_t buffer_size,
rte_duration_ms_t timeout_ms )

Receives one fixed-size message, blocking at most timeout_ms.

Parameters
handleLink handle. Must not be NULL.
out_messageDestination buffer. Must not be NULL.
buffer_sizeUsable size of out_message in bytes; must be > 0.
timeout_msMaximum time to wait for a message to arrive.
Returns
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM; RTE_STATUS_TIMEOUT if no message arrives in time; RTE_STATUS_HARDWARE_FAULT per rte_netlink_send()'s own note above; RTE_STATUS_DATA_CORRUPTION if an OSAdapter can detect the received message violated this link's wire contract (e.g. wrong length) but not necessarily its content (content integrity, if needed, is the caller's job - see REQ-OAL-NETLINK-014); RTE_STATUS_NOT_INITIALIZED/ RTE_STATUS_NOT_SUPPORTED as in rte_netlink_open(). REQ-OAL-NETLINK-012

Definition at line 93 of file rte_netlink.c.

◆ rte_netlink_close()

rte_status_t rte_netlink_close ( rte_netlink_handle_t handle)

Closes a link.

Parameters
handleHandle to close. Must not be NULL. Invalid to use after this call.
Returns
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM; RTE_STATUS_NOT_INITIALIZED/ RTE_STATUS_NOT_SUPPORTED as in rte_netlink_open(). REQ-OAL-NETLINK-013

Definition at line 113 of file rte_netlink.c.