Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_safety_violation.c
Go to the documentation of this file.
1
7
8static sapi_safety_violation_handler_t s_handler = NULL;
9
11{
12 if (handler == NULL)
13 {
15 }
16 s_handler = handler;
17 return SAPI_STATUS_OK;
18}
19
21 const char *file,
22 int32_t line,
23 const char *message)
24{
25 if (s_handler == NULL)
26 {
27 return;
28 }
29 s_handler(kind, file, line, message);
30}
void sapi_safety_violation_report(sapi_safety_violation_kind_t kind, const char *file, int32_t line, const char *message)
Reports one violation to the registered handler, if any.
sapi_status_t sapi_safety_violation_register_handler(sapi_safety_violation_handler_t handler)
Registers the single handler invoked by sapi_safety_violation_report(). Registering again replaces th...
void(*) sapi_safety_violation_handler_t(sapi_safety_violation_kind_t kind, const char *file, int32_t line, const char *message)
Handler invoked by sapi_safety_violation_report().
sapi_safety_violation_kind_t
Which safety primitive detected the violation.
sapi_status_t
Common result/status codes.
Definition sapi_status.h:27
@ SAPI_STATUS_INVALID_PARAM
Definition sapi_status.h:29
@ SAPI_STATUS_OK
Definition sapi_status.h:28
Opt-in notification hook for the three new safety primitives (safe pointer, checked integer arithmeti...