|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
IPC Request-Reply Pattern Example. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <signal.h>#include "rte/status.h"#include "rte/log.h"#include "rte/ipc/rte_ipc_request_reply.h"Go to the source code of this file.
Data Structures | |
| struct | signal_query_t |
| Query message: Train asks for signal state. More... | |
| struct | signal_reply_t |
| Reply message: Signal state and limits. More... | |
Macros | |
| #define | SIGNAL_RED 0 |
| #define | SIGNAL_YELLOW 1 |
| #define | SIGNAL_GREEN 2 |
Functions | |
| static rte_status_t | query_signal_database (const signal_query_t *query, signal_reply_t *reply) |
| Signal database query logic. | |
| static int | run_signal_server (void) |
| Run signal server (responder). | |
| static int | run_train_controller (void) |
| Simulate train moving and querying signal state. | |
| int | main (int argc, char *argv[]) |
IPC Request-Reply Pattern Example.
Demonstrates synchronous RPC-style communication:
This is a TWO-PROCESS EXAMPLE. In production, you'd run: Terminal 1: ./signal-server Terminal 2: ./train-controller
Both use IPC Request-Reply for bidirectional communication.
Definition in file ipc-request-reply-example.c.
| #define SIGNAL_RED 0 |
Definition at line 48 of file ipc-request-reply-example.c.
| #define SIGNAL_YELLOW 1 |
Definition at line 49 of file ipc-request-reply-example.c.
| #define SIGNAL_GREEN 2 |
Definition at line 50 of file ipc-request-reply-example.c.
|
static |
Signal database query logic.
Simulates a real signal database that determines signal state based on track conditions, occupancy, etc.
Definition at line 62 of file ipc-request-reply-example.c.
|
static |
Run signal server (responder).
Creates an IPC request-reply server, waits for queries, and responds.
Definition at line 92 of file ipc-request-reply-example.c.
|
static |
Simulate train moving and querying signal state.
Definition at line 179 of file ipc-request-reply-example.c.
| int main | ( | int | argc, |
| char * | argv[] ) |
Definition at line 280 of file ipc-request-reply-example.c.