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
rte_protocol_adapter.h
Go to the documentation of this file.
1
20#ifndef RTE_PROTOCOL_ADAPTER_H
21#define RTE_PROTOCOL_ADAPTER_H
22
23#include <stddef.h>
24#include <stdint.h>
25#include <stdbool.h>
26
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
36#define RTE_PROTOCOL_ENDPOINT_STR_MAX (64U)
37
47
58
91
93typedef struct rte_protocol_impl_s *rte_protocol_handle_t;
94
98typedef struct rte_protocol_adapter_ops_s
99{
108 rte_status_t (*open)(void *storage, size_t storage_size,
109 const rte_protocol_config_t *config,
110 const rte_os_socket_ops_t *os_sockets,
111 rte_protocol_handle_t *out_handle);
112
120 rte_status_t (*send)(rte_protocol_handle_t handle, const void *data,
121 size_t size, rte_duration_ms_t timeout_ms);
122
131 size_t buffer_size, rte_duration_ms_t timeout_ms);
132
138
140
148 const rte_protocol_adapter_ops_t *ops);
149
156
165
174
175#ifdef __cplusplus
176}
177#endif
178
179#endif /* RTE_PROTOCOL_ADAPTER_H */
180
#define RTE_PROTOCOL_ENDPOINT_STR_MAX
Maximum length of host, topic, or endpoint string.
const rte_protocol_adapter_ops_t * rte_protocol_adapter_get(rte_protocol_type_t type)
Retrieves the registered ProtocolAdapter for a given protocol type.
const rte_protocol_adapter_ops_t * rte_protocol_adapter_get_udp(void)
Returns the built-in raw UDP ProtocolAdapter vtable.
const rte_protocol_adapter_ops_t * rte_protocol_adapter_get_tcp(void)
Returns the built-in raw TCP ProtocolAdapter vtable.
struct rte_protocol_impl_s * rte_protocol_handle_t
Opaque protocol handle pointer.
rte_protocol_role_t
Communication role of the protocol adapter instance.
rte_status_t rte_protocol_adapter_register(rte_protocol_type_t type, const rte_protocol_adapter_ops_t *ops)
Registers a ProtocolAdapter implementation for a given protocol type.
rte_protocol_type_t
Protocol transport identifier.
@ RTE_PROTOCOL_ROLE_SUB
@ RTE_PROTOCOL_ROLE_CONNECT
@ RTE_PROTOCOL_ROLE_PUB
@ RTE_PROTOCOL_ROLE_LISTEN
@ RTE_PROTOCOL_TYPE_RAW_UDP
@ RTE_PROTOCOL_TYPE_DDS
@ RTE_PROTOCOL_TYPE_RAW_TCP
rte_status_t
Common result/status codes.
Definition rte_status.h:27
uint32_t rte_duration_ms_t
Definition rte_types.h:27
OS Abstraction Layer - Raw OS Socket Interface for OSAdapters.
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
Vtable of low-level OS socket operations implemented by an OSAdapter.
Operations vtable implemented by a concrete ProtocolAdapter.
rte_status_t(*) receive(rte_protocol_handle_t handle, void *out_buf, size_t buffer_size, rte_duration_ms_t timeout_ms)
Receives a message from the protocol adapter.
rte_status_t(*) send(rte_protocol_handle_t handle, const void *data, size_t size, rte_duration_ms_t timeout_ms)
Sends a message over the protocol adapter.
rte_status_t(*) close(rte_protocol_handle_t handle)
Closes the protocol adapter endpoint.
rte_status_t(*) open(void *storage, size_t storage_size, const rte_protocol_config_t *config, const rte_os_socket_ops_t *os_sockets, rte_protocol_handle_t *out_handle)
Opens and initializes a protocol adapter endpoint.
Configuration passed to open a protocol adapter instance.
bool use_handshake
Enable handshake (HELLO/ACK) for raw UDP.
char topic[RTE_PROTOCOL_ENDPOINT_STR_MAX]
Topic name (DDS).
uint16_t port
Port (UDP/TCP).
uint32_t domain_id
Domain ID (DDS).
char host[RTE_PROTOCOL_ENDPOINT_STR_MAX]
Host address (UDP/TCP) or domain partition.
rte_duration_ms_t open_timeout_ms
Open / handshake timeout in milliseconds.
rte_duration_ms_t default_timeout_ms
Default read/write timeout in milliseconds.
size_t max_message_size
Maximum expected message payload size.