|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Application-facing named channel service. More...
#include <stddef.h>#include <stdint.h>#include "rte/utils/status/rte_status.h"#include "rte/utils/types/rte_types.h"Go to the source code of this file.
Data Structures | |
| struct | rte_channel_service_storage_t |
| Caller-owned storage for one named channel service instance. More... | |
| struct | rte_osadapter_channel_service_t |
| OSAdapter implementation for named channel operations. More... | |
Macros | |
| #define | RTE_CHANNEL_SERVICE_NAME_SIZE (32U) |
Typedefs | |
| typedef rte_channel_service_storage_t | rte_channel_service_t |
| Opaque handle to a named channel service instance. | |
Functions | |
| rte_status_t | rte_osadapter_channel_service_register (const rte_osadapter_channel_service_t *osadapter) |
| Registers the OSAdapter that implements named channels (ADR-005). | |
| rte_status_t | rte_channel_service_setup (rte_channel_service_t *storage, const char *channel_name) |
| rte_status_t | rte_channel_service_setup_by_id (rte_channel_service_t *storage, uint32_t channel_id) |
| rte_status_t | rte_channel_service_read (rte_channel_service_t *storage, void *data, size_t data_size, rte_duration_ms_t timeout_ms) |
| rte_status_t | rte_channel_service_read_ex (rte_channel_service_t *storage, void *data, size_t data_size, rte_duration_ms_t timeout_ms, size_t *out_actual_size) |
Same as rte_channel_service_read, but also reports the actual number of bytes received into data (never more than data_size). Use this instead of rte_channel_service_read whenever a channel may carry messages shorter than its configured buffer size - a caller that only has the plain read can't tell a short message from one that filled the buffer exactly, and forwarding data_size bytes verbatim would forward trailing garbage. out_actual_size must not be NULL. On any non-OK return its value is unspecified - the caller does not have a valid message to look at anyway. | |
| rte_status_t | rte_channel_service_send (rte_channel_service_t *storage, const void *data, size_t data_size, rte_duration_ms_t timeout_ms) |
Sends data_size bytes of data on the named channel in storage through the registered OSAdapter's send. | |
| rte_status_t | rte_channel_service_close (rte_channel_service_t *storage) |
Application-facing named channel service.
The application addresses a channel by its configured name and performs setup, read, and send operations from its own execution thread. Transport lifecycle, reconnect, buffering, and synchronization belong to the registered OSAdapter.
Definition in file rte_channel_service.h.
| #define RTE_CHANNEL_SERVICE_NAME_SIZE (32U) |
Definition at line 24 of file rte_channel_service.h.
Opaque handle to a named channel service instance.
Definition at line 33 of file rte_channel_service.h.
| rte_status_t rte_osadapter_channel_service_register | ( | const rte_osadapter_channel_service_t * | osadapter | ) |
Registers the OSAdapter that implements named channels (ADR-005).
Definition at line 22 of file rte_channel_service.c.
| rte_status_t rte_channel_service_setup | ( | rte_channel_service_t * | storage, |
| const char * | channel_name ) |
Definition at line 33 of file rte_channel_service.c.
| rte_status_t rte_channel_service_setup_by_id | ( | rte_channel_service_t * | storage, |
| uint32_t | channel_id ) |
Definition at line 58 of file rte_channel_service.c.
| rte_status_t rte_channel_service_read | ( | rte_channel_service_t * | storage, |
| void * | data, | ||
| size_t | data_size, | ||
| rte_duration_ms_t | timeout_ms ) |
Definition at line 80 of file rte_channel_service.c.
| rte_status_t rte_channel_service_read_ex | ( | rte_channel_service_t * | storage, |
| void * | data, | ||
| size_t | data_size, | ||
| rte_duration_ms_t | timeout_ms, | ||
| size_t * | out_actual_size ) |
Same as rte_channel_service_read, but also reports the actual number of bytes received into data (never more than data_size). Use this instead of rte_channel_service_read whenever a channel may carry messages shorter than its configured buffer size - a caller that only has the plain read can't tell a short message from one that filled the buffer exactly, and forwarding data_size bytes verbatim would forward trailing garbage. out_actual_size must not be NULL. On any non-OK return its value is unspecified - the caller does not have a valid message to look at anyway.
Definition at line 99 of file rte_channel_service.c.
| rte_status_t rte_channel_service_send | ( | rte_channel_service_t * | storage, |
| const void * | data, | ||
| size_t | data_size, | ||
| rte_duration_ms_t | timeout_ms ) |
Sends data_size bytes of data on the named channel in storage through the registered OSAdapter's send.
| storage | Channel set up by rte_channel_service_setup; must not be NULL. |
| data | Bytes to send; must not be NULL. |
| data_size | Number of bytes to send; must not be 0. |
| timeout_ms | Upper bound for the OSAdapter's send. |
RTE_STATUS_INVALID_PARAM for a NULL storage / data or a zero data_size; RTE_STATUS_NOT_INITIALIZED with no complete OSAdapter registered; RTE_STATUS_NOT_CONNECTED when a listen-role link has no peer yet and nothing was sent (REQ-CHANSVC-001); otherwise the OSAdapter's own result, unchanged. Definition at line 130 of file rte_channel_service.c.
| rte_status_t rte_channel_service_close | ( | rte_channel_service_t * | storage | ) |
Definition at line 149 of file rte_channel_service.c.