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_netlink.c
Go to the documentation of this file.
1
11
13
15
19
21
23
24
27{
28 rte_status_t lifecycle_status;
29
30 if (osadapter == NULL)
31 {
33 }
34 /* REQ-LIFECYCLE-001 (ADR-026): registering an OSAdapter is a setup-only
35 * action - refuse once the application's setup phase has been locked. */
36 lifecycle_status = rte_lifecycle_check_setup_allowed();
37 if (lifecycle_status != RTE_STATUS_OK)
38 {
39 return lifecycle_status;
40 }
41 s_osadapter = osadapter;
42 return RTE_STATUS_OK;
43}
44
45rte_status_t rte_netlink_open(rte_netlink_storage_t *storage,
46 const rte_netlink_config_t *config,
47 rte_netlink_handle_t *out_handle)
48{
49 if ((storage == NULL) || (config == NULL) || (out_handle == NULL))
50 {
52 }
53 if (config->message_size == 0U)
54 {
56 }
57 if ((config->role == RTE_NETLINK_ROLE_CONNECT) && (config->host == NULL))
58 {
60 }
61 *out_handle = NULL;
62 if (s_osadapter == NULL)
63 {
65 }
66 if (s_osadapter->open == NULL)
67 {
69 }
70 return s_osadapter->open(storage, config, out_handle);
71}
72
74 const void *message,
75 size_t message_size,
76 rte_duration_ms_t timeout_ms)
77{
78 if ((handle == NULL) || (message == NULL) || (message_size == 0U))
79 {
81 }
82 if (s_osadapter == NULL)
83 {
85 }
86 if (s_osadapter->send == NULL)
87 {
89 }
90 return s_osadapter->send(handle, message, message_size, timeout_ms);
91}
92
94 void *out_message,
95 size_t buffer_size,
96 rte_duration_ms_t timeout_ms)
97{
98 if ((handle == NULL) || (out_message == NULL) || (buffer_size == 0U))
99 {
101 }
102 if (s_osadapter == NULL)
103 {
105 }
106 if (s_osadapter->receive == NULL)
107 {
109 }
110 return s_osadapter->receive(handle, out_message, buffer_size, timeout_ms);
111}
112
114{
115 if (handle == NULL)
116 {
118 }
119 if (s_osadapter == NULL)
120 {
122 }
123 if (s_osadapter->close == NULL)
124 {
126 }
127 return s_osadapter->close(handle);
128}
rte_status_t rte_lifecycle_check_setup_allowed(void)
Convenience check for a setup-only constructor: call this as one of the first checks in any function ...
rte_status_t
Common result/status codes.
Definition rte_status.h:27
@ RTE_STATUS_OK
Definition rte_status.h:28
@ RTE_STATUS_INVALID_PARAM
Definition rte_status.h:29
@ RTE_STATUS_NOT_SUPPORTED
Definition rte_status.h:34
@ RTE_STATUS_NOT_INITIALIZED
Definition rte_status.h:30
uint32_t rte_duration_ms_t
Definition rte_types.h:27
static const rte_osadapter_clocksync_t * s_osadapter
Process-wide application setup-phase lock (ADR-026).