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_appmanager.h
Go to the documentation of this file.
1
75
76#ifndef RTE_APPMANAGER_H
77#define RTE_APPMANAGER_H
78
79#include <stdint.h>
84
85#ifdef __cplusplus
86extern "C" {
87#endif
88
89/* ============================================================================
90 * Application Manager Interface
91 * ========================================================================== */
92
106
118typedef struct {
128 rte_status_t (*init)(void *context);
129
150 rte_status_t (*pre_execute)(void *context);
151
163 rte_status_t (*execute)(void *context);
164
183 rte_status_t (*post_execute)(void *context);
184
223 rte_status_t (*on_checkpoint_result)(void *context, bool committed);
224
237 rte_status_t (*shutdown)(void *context);
238
246 const char *(*get_name)(void);
247
255 const char *(*get_version)(void);
257
310
321
331
332/* ============================================================================
333 * Checkpoint marks (ADR-034)
334 * ========================================================================== */
335
345#define RTE_APPMANAGER_CHECKPOINT_SIGNATURE_SEED ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
346
369uint32_t rte_appmanager_checkpoint_fold_signature(uint64_t signature);
370
405void rte_appmanager_checkpoint_mark(const char *file, int32_t line, const char *label);
406
412#define RTE_CHECKPOINT_MARK() rte_appmanager_checkpoint_mark(__FILE__, (int32_t)__LINE__, NULL)
413
420#define RTE_CHECKPOINT_MARK_LABEL(label_str) rte_appmanager_checkpoint_mark(__FILE__, (int32_t)__LINE__, (label_str))
421
422/* ============================================================================
423 * Application Manager API
424 * ========================================================================== */
425
538
548
558
569
599
633
634#ifdef __cplusplus
635}
636#endif
637
638#endif /* RTE_APPMANAGER_H */
639 /* APPMANAGER */
void rte_appmanager_reset_state(void)
Forcibly resets the application manager's own bookkeeping (lifecycle state, iteration/error counters,...
rte_app_state_t
Application state enumeration.
uint32_t rte_appmanager_checkpoint_fold_signature(uint64_t signature)
Pure helper: folds a 64-bit checkpoint signature down to the uint32_t rte_checkpoint_config_t::checkp...
rte_status_t rte_appmanager_get_stats(rte_appmanager_state_t *state)
Get application statistics.
int rte_appmanager_run(const rte_appmanager_config_t *config)
Run application with lifecycle management.
void rte_appmanager_checkpoint_mark(const char *file, int32_t line, const char *label)
Folds a hash of this call site into the current cycle's checkpoint signature (ADR-034).
void rte_appmanager_request_shutdown(void)
Request application shutdown.
rte_status_t rte_appmanager_install_default_signal_handlers(void)
POSIX-only convenience: installs SIGINT and SIGTERM handlers that call rte_appmanager_request_shutdow...
rte_app_state_t rte_appmanager_get_state(void)
Get current application state.
@ RTE_APP_STATE_SHUTTING_DOWN
@ RTE_APP_STATE_SHUTDOWN
@ RTE_APP_STATE_INITIALIZING
@ RTE_APP_STATE_ERROR
@ RTE_APP_STATE_UNINITIALIZED
@ RTE_APP_STATE_RUNNING
rte_status_t
Common result/status codes.
Definition rte_status.h:27
uint32_t rte_duration_ms_t
Definition rte_types.h:27
rte_voter_storage_t rte_voter_t
Opaque handle to a voter instance.
Definition rte_voter.h:149
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...
N-way voting across registered rte_channel_t links (2oo2/2oo3/NMR).
Watchdog mechanism for detecting system/task hang conditions.
Optional built-in checkpoint rendezvous configuration (ADR-019/ADR-034).
Application manager configuration.
const rte_appmanager_operations_t * ops
const rte_appmanager_checkpoint_config_t * checkpoint
Application lifecycle operations.
rte_status_t(*) shutdown(void *context)
Shutdown application.
rte_status_t(*) pre_execute(void *context)
Optional per-cycle input/prepare stage (ADR-019).
rte_status_t(*) execute(void *context)
Execute main application logic.
rte_status_t(*) post_execute(void *context)
Optional per-cycle output/cleanup stage (ADR-019).
rte_status_t(*) init(void *context)
Initialize application.
rte_status_t(*) on_checkpoint_result(void *context, bool committed)
Optional per-cycle checkpoint outcome hook (ADR-034).
Application manager runtime state.