Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Inter-Process Communication

Bounded message queues between safety tasks (ADR-001). More...

Files

file  include/safeapi/oal/ipc/sapi_ipc_pubsub.h
 IPC Publish-Subscribe Pattern (one-to-many broadcasting).
file  include/safeapi/oal/ipc/sapi_ipc_request_reply.h
 IPC Request-Reply Pattern (RPC-style communication).
file  src/oal/ipc/sapi_ipc.c
 IPC service: validates parameters, then dispatches to the backend registered via sapi_ipc_register_backend() (ADR-005).
file  src/oal/ipc/sapi_ipc_pubsub.c
 IPC Publish-Subscribe implementation.
file  src/oal/ipc/sapi_ipc_request_reply.c
 IPC Request-Reply implementation.

Data Structures

struct  sapi_ipc_config_t
 Configuration for sapi_ipc_create(). More...

Typedefs

typedef struct sapi_ipc_impl_s * sapi_ipc_handle_t
 Opaque handle to a created IPC channel, returned by sapi_ipc_create().

Functions

 SAFEAPI_DECLARE_STORAGE (sapi_ipc_storage_t, 64U)
 Caller-owned, fixed-size storage backing one sapi_ipc_handle_t.
sapi_status_t sapi_ipc_create (sapi_ipc_storage_t *storage, const sapi_ipc_config_t *config, sapi_ipc_handle_t *out_handle)
 Creates a bounded message channel.
sapi_status_t sapi_ipc_send (sapi_ipc_handle_t handle, const void *message, size_t message_size, sapi_duration_ms_t timeout_ms)
 Sends one message, blocking at most timeout_ms.
sapi_status_t sapi_ipc_receive (sapi_ipc_handle_t handle, void *out_message, size_t buffer_size, sapi_duration_ms_t timeout_ms)
 Receives one message, blocking at most timeout_ms.
sapi_status_t sapi_ipc_destroy (sapi_ipc_handle_t handle)
 Destroys a message channel.

Detailed Description

Bounded message queues between safety tasks (ADR-001).

Typedef Documentation

◆ sapi_ipc_handle_t

typedef struct sapi_ipc_impl_s* sapi_ipc_handle_t

Opaque handle to a created IPC channel, returned by sapi_ipc_create().

Definition at line 34 of file sapi_ipc.h.

Function Documentation

◆ sapi_ipc_create()

sapi_status_t sapi_ipc_create ( sapi_ipc_storage_t * storage,
const sapi_ipc_config_t * config,
sapi_ipc_handle_t * out_handle )

Creates a bounded message channel.

Parameters
storageCaller-owned storage for the handle's state. Must not be NULL.
configChannel configuration. Must not be NULL; config->message_size and config->queue_depth must both be > 0.
out_handleReceives the created channel's handle. Must not be NULL.
Returns
SAPI_STATUS_OK; SAPI_STATUS_INVALID_PARAM for a bad argument; SAPI_STATUS_NOT_INITIALIZED if no backend is registered (sapi_ipc_register_backend()); SAPI_STATUS_NOT_SUPPORTED if the registered backend does not implement create. REQ-OAL-IPC-010

Definition at line 44 of file sapi_ipc.c.

◆ sapi_ipc_send()

sapi_status_t sapi_ipc_send ( sapi_ipc_handle_t handle,
const void * message,
size_t message_size,
sapi_duration_ms_t timeout_ms )

Sends one message, blocking at most timeout_ms.

Parameters
handleChannel 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 queue space.
Returns
SAPI_STATUS_OK; SAPI_STATUS_INVALID_PARAM; SAPI_STATUS_TIMEOUT if the queue stays full for the whole timeout; SAPI_STATUS_NOT_INITIALIZED/ SAPI_STATUS_NOT_SUPPORTED as in sapi_ipc_create(). REQ-OAL-IPC-011

Definition at line 68 of file sapi_ipc.c.

◆ sapi_ipc_receive()

sapi_status_t sapi_ipc_receive ( sapi_ipc_handle_t handle,
void * out_message,
size_t buffer_size,
sapi_duration_ms_t timeout_ms )

Receives one message, blocking at most timeout_ms.

Parameters
handleChannel 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
SAPI_STATUS_OK; SAPI_STATUS_INVALID_PARAM; SAPI_STATUS_TIMEOUT if no message arrives within the timeout; SAPI_STATUS_NOT_INITIALIZED/ SAPI_STATUS_NOT_SUPPORTED as in sapi_ipc_create(). REQ-OAL-IPC-012

Definition at line 88 of file sapi_ipc.c.

◆ sapi_ipc_destroy()

sapi_status_t sapi_ipc_destroy ( sapi_ipc_handle_t handle)

Destroys a message channel.

Parameters
handleChannel handle. Must not be NULL. Invalid to use after this call.
Returns
SAPI_STATUS_OK; SAPI_STATUS_INVALID_PARAM; SAPI_STATUS_NOT_INITIALIZED/ SAPI_STATUS_NOT_SUPPORTED as in sapi_ipc_create(). REQ-OAL-IPC-013

Definition at line 108 of file sapi_ipc.c.