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
Inter-Process Communication

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

Files

file  include/rte/oal/ipc/rte_ipc_pubsub.h
 IPC Publish-Subscribe Pattern (one-to-many broadcasting).
file  include/rte/oal/ipc/rte_ipc_request_reply.h
 IPC Request-Reply Pattern (RPC-style communication).
file  src/oal/ipc/rte_ipc.c
 IPC service: validates parameters, then dispatches to the OSAdapter registered via rte_osadapter_ipc_register() (ADR-005).
file  src/oal/ipc/rte_ipc_pubsub.c
 IPC Publish-Subscribe implementation.
file  src/oal/ipc/rte_ipc_request_reply.c
 IPC Request-Reply implementation.

Data Structures

struct  rte_ipc_config_t
 Configuration for rte_ipc_create(). More...

Typedefs

typedef struct rte_ipc_impl_s * rte_ipc_handle_t
 Opaque handle to a created IPC channel, returned by rte_ipc_create().

Functions

 RTE_DECLARE_STORAGE (rte_ipc_storage_t, 64U)
 Caller-owned, fixed-size storage backing one rte_ipc_handle_t.
rte_status_t rte_ipc_create (rte_ipc_storage_t *storage, const rte_ipc_config_t *config, rte_ipc_handle_t *out_handle)
 Creates a bounded message channel.
rte_status_t rte_ipc_send (rte_ipc_handle_t handle, const void *message, size_t message_size, rte_duration_ms_t timeout_ms)
 Sends one message, blocking at most timeout_ms.
rte_status_t rte_ipc_receive (rte_ipc_handle_t handle, void *out_message, size_t buffer_size, rte_duration_ms_t timeout_ms)
 Receives one message, blocking at most timeout_ms.
rte_status_t rte_ipc_destroy (rte_ipc_handle_t handle)
 Destroys a message channel.

Detailed Description

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

Typedef Documentation

◆ rte_ipc_handle_t

typedef struct rte_ipc_impl_s* rte_ipc_handle_t

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

Definition at line 34 of file rte_ipc.h.

Function Documentation

◆ rte_ipc_create()

rte_status_t rte_ipc_create ( rte_ipc_storage_t * storage,
const rte_ipc_config_t * config,
rte_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
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM for a bad argument; RTE_STATUS_NOT_INITIALIZED if no OSAdapter is registered (rte_osadapter_ipc_register()); RTE_STATUS_NOT_SUPPORTED if the registered OSAdapter does not implement create, or cannot move a message of config->message_size whole (POSIX: above PIPE_BUF); RTE_STATUS_RESOURCE_EXHAUSTED if the OSAdapter cannot hold config->queue_depth messages (POSIX: the pipe cannot be made large enough); RTE_STATUS_INTERNAL_ERROR if creating the OS resource failed (POSIX: pipe(), or setting O_NONBLOCK); RTE_STATUS_INVALID_STATE if the application's setup phase is already locked (ADR-026) - a channel is a setup-only resource. REQ-OAL-IPC-010

Definition at line 44 of file rte_ipc.c.

◆ rte_ipc_send()

rte_status_t rte_ipc_send ( rte_ipc_handle_t handle,
const void * message,
size_t message_size,
rte_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
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM for a bad argument or a message_size other than the config->message_size fixed at rte_ipc_create(); RTE_STATUS_TIMEOUT if the queue stays full for the whole timeout; RTE_STATUS_INTERNAL_ERROR if an OS call or the clock fails (POSIX: ioctl(FIONREAD), write() or clock_gettime()); RTE_STATUS_NOT_INITIALIZED/RTE_STATUS_NOT_SUPPORTED as in rte_ipc_create() (no OSAdapter registered / send not implemented). REQ-OAL-IPC-011

Definition at line 77 of file rte_ipc.c.

◆ rte_ipc_receive()

rte_status_t rte_ipc_receive ( rte_ipc_handle_t handle,
void * out_message,
size_t buffer_size,
rte_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
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM for a bad argument or a buffer_size smaller than the config->message_size fixed at rte_ipc_create(); RTE_STATUS_TIMEOUT if no message arrives within the timeout; RTE_STATUS_INTERNAL_ERROR if an OS call or the clock fails (POSIX: poll(), read(), a closed write end or clock_gettime()); RTE_STATUS_NOT_INITIALIZED/RTE_STATUS_NOT_SUPPORTED as in rte_ipc_create() (no OSAdapter registered / receive not implemented). REQ-OAL-IPC-012

Definition at line 97 of file rte_ipc.c.

◆ rte_ipc_destroy()

rte_status_t rte_ipc_destroy ( rte_ipc_handle_t handle)

Destroys a message channel.

Parameters
handleChannel handle. 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_ipc_create() (no OSAdapter registered / destroy not implemented). REQ-OAL-IPC-013

Definition at line 117 of file rte_ipc.c.