|
Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Connection-oriented link between independent processes (ADR-001). More...
Files | |
| file | src/oal/netlink/sapi_netlink.c |
| Network link service: validates parameters, then dispatches to the backend registered via sapi_netlink_register_backend() (ADR-005). See sapi_ipc.c for the pattern this follows. | |
Data Structures | |
| struct | sapi_netlink_config_t |
| Configuration for sapi_netlink_open(). More... | |
Typedefs | |
| typedef struct sapi_netlink_impl_s * | sapi_netlink_handle_t |
| Opaque handle to an established link, returned by sapi_netlink_open(). | |
Enumerations | |
| enum | sapi_netlink_role_t { SAPI_NETLINK_ROLE_LISTEN = 0 , SAPI_NETLINK_ROLE_CONNECT = 1 } |
| Which side of the connection this link instance plays. More... | |
Functions | |
| SAFEAPI_DECLARE_STORAGE (sapi_netlink_storage_t, 64U) | |
| Caller-owned, fixed-size storage backing one sapi_netlink_handle_t. | |
| sapi_status_t | sapi_netlink_open (sapi_netlink_storage_t *storage, const sapi_netlink_config_t *config, sapi_netlink_handle_t *out_handle) |
| Establishes a point-to-point link: binds+accepts (LISTEN) or dials (CONNECT), per config->role. | |
| sapi_status_t | sapi_netlink_send (sapi_netlink_handle_t handle, const void *message, size_t message_size, sapi_duration_ms_t timeout_ms) |
| Sends one fixed-size message, blocking at most timeout_ms. | |
| sapi_status_t | sapi_netlink_receive (sapi_netlink_handle_t handle, void *out_message, size_t buffer_size, sapi_duration_ms_t timeout_ms) |
| Receives one fixed-size message, blocking at most timeout_ms. | |
| sapi_status_t | sapi_netlink_close (sapi_netlink_handle_t handle) |
| Closes a link. | |
Connection-oriented link between independent processes (ADR-001).
| typedef struct sapi_netlink_impl_s* sapi_netlink_handle_t |
Opaque handle to an established link, returned by sapi_netlink_open().
Definition at line 55 of file sapi_netlink.h.
| enum sapi_netlink_role_t |
Which side of the connection this link instance plays.
A TCP-style backend 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 | |
|---|---|
| SAPI_NETLINK_ROLE_LISTEN | Bind config->port and accept one peer. |
| SAPI_NETLINK_ROLE_CONNECT | Dial config->host:config->port. |
Definition at line 66 of file sapi_netlink.h.
| sapi_status_t sapi_netlink_open | ( | sapi_netlink_storage_t * | storage, |
| const sapi_netlink_config_t * | config, | ||
| sapi_netlink_handle_t * | out_handle ) |
Establishes a point-to-point link: binds+accepts (LISTEN) or dials (CONNECT), per config->role.
| storage | Caller-owned storage for the handle's state. Must not be NULL. |
| config | Link configuration. Must not be NULL; config->message_size must be > 0; config->host must not be NULL for CONNECT. |
| out_handle | Receives the established link's handle. Must not be NULL. |
Definition at line 45 of file sapi_netlink.c.
| sapi_status_t sapi_netlink_send | ( | sapi_netlink_handle_t | handle, |
| const void * | message, | ||
| size_t | message_size, | ||
| sapi_duration_ms_t | timeout_ms ) |
Sends one fixed-size message, blocking at most timeout_ms.
| handle | Link handle. Must not be NULL. |
| message | Message data to send. Must not be NULL. |
| message_size | Size of message in bytes; must be > 0. |
| timeout_ms | Maximum time to wait for the send to complete. |
Definition at line 73 of file sapi_netlink.c.
| sapi_status_t sapi_netlink_receive | ( | sapi_netlink_handle_t | handle, |
| void * | out_message, | ||
| size_t | buffer_size, | ||
| sapi_duration_ms_t | timeout_ms ) |
Receives one fixed-size message, blocking at most timeout_ms.
| handle | Link handle. Must not be NULL. |
| out_message | Destination buffer. Must not be NULL. |
| buffer_size | Usable size of out_message in bytes; must be > 0. |
| timeout_ms | Maximum time to wait for a message to arrive. |
Definition at line 93 of file sapi_netlink.c.
| sapi_status_t sapi_netlink_close | ( | sapi_netlink_handle_t | handle | ) |
Closes a link.
| handle | Handle to close. Must not be NULL. Invalid to use after this call. |
Definition at line 113 of file sapi_netlink.c.