Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_channel_service.h File Reference

Application-facing named channel service. More...

#include <stddef.h>
#include <stdint.h>
#include "safeapi/utils/status/sapi_status.h"
#include "safeapi/utils/types/sapi_types.h"
Include dependency graph for sapi_channel_service.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sapi_channel_service_storage_t
 Caller-owned storage for one named channel service instance. More...
struct  sapi_channel_service_backend_t
 Backend implementation for named channel operations. More...

Macros

#define SAPI_CHANNEL_SERVICE_NAME_SIZE   (32U)

Typedefs

typedef sapi_channel_service_storage_t sapi_channel_service_t
 Opaque handle to a named channel service instance.

Functions

sapi_status_t sapi_channel_service_register_backend (const sapi_channel_service_backend_t *backend)
sapi_status_t sapi_channel_service_setup (sapi_channel_service_t *storage, const char *channel_name)
sapi_status_t sapi_channel_service_read (sapi_channel_service_t *storage, void *data, size_t data_size, sapi_duration_ms_t timeout_ms)
sapi_status_t sapi_channel_service_send (sapi_channel_service_t *storage, const void *data, size_t data_size, sapi_duration_ms_t timeout_ms)
sapi_status_t sapi_channel_service_close (sapi_channel_service_t *storage)

Detailed Description

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 backend.

Definition in file sapi_channel_service.h.

Macro Definition Documentation

◆ SAPI_CHANNEL_SERVICE_NAME_SIZE

#define SAPI_CHANNEL_SERVICE_NAME_SIZE   (32U)

Definition at line 24 of file sapi_channel_service.h.

Typedef Documentation

◆ sapi_channel_service_t

Opaque handle to a named channel service instance.

Definition at line 33 of file sapi_channel_service.h.

Function Documentation

◆ sapi_channel_service_register_backend()

sapi_status_t sapi_channel_service_register_backend ( const sapi_channel_service_backend_t * backend)

Definition at line 20 of file sapi_channel_service.c.

◆ sapi_channel_service_setup()

sapi_status_t sapi_channel_service_setup ( sapi_channel_service_t * storage,
const char * channel_name )

Definition at line 31 of file sapi_channel_service.c.

◆ sapi_channel_service_read()

sapi_status_t sapi_channel_service_read ( sapi_channel_service_t * storage,
void * data,
size_t data_size,
sapi_duration_ms_t timeout_ms )

Definition at line 47 of file sapi_channel_service.c.

◆ sapi_channel_service_send()

sapi_status_t sapi_channel_service_send ( sapi_channel_service_t * storage,
const void * data,
size_t data_size,
sapi_duration_ms_t timeout_ms )

Definition at line 66 of file sapi_channel_service.c.

◆ sapi_channel_service_close()

sapi_status_t sapi_channel_service_close ( sapi_channel_service_t * storage)

Definition at line 85 of file sapi_channel_service.c.