|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
Wire payload for RBC_UTIL_TOPIC_JRU_LOG publishes: A/B forwarding one local log event to Gateway, for Gateway to hand to Platform_Protocol_JRU's rte_osadapter_log_t. More...
#include <stdbool.h>#include <stdio.h>#include <string.h>#include "rte/oal/log/rte_log.h"#include "rbc_util_frame.h"Go to the source code of this file.
Functions | |
| static void | rbc_util_jru_payload_encode (char *out, size_t out_size, rte_log_level_t level, const char *tag, const char *message) |
| Encodes one forwarded log event into a JRU_LOG publish payload. | |
| static bool | rbc_util_jru_payload_decode (const char *payload, rte_log_level_t *out_level, char *tag_out, size_t tag_out_size, char *msg_out, size_t msg_out_size) |
| Decodes a JRU_LOG publish payload back into its fields. | |
Wire payload for RBC_UTIL_TOPIC_JRU_LOG publishes: A/B forwarding one local log event to Gateway, for Gateway to hand to Platform_Protocol_JRU's rte_osadapter_log_t.
The RBC_UTIL_MSG_PUBLISH payload (rbc_util_frame.h, RBC_UTIL_PAYLOAD_MAX = 250 bytes) carries this ASCII encoding: "<level_digit>|<tag>|<message>". A pipe delimiter rather than rte_log_write_event()'s own "Key=Value" convention because the forwarded message text is free-form (it may itself legitimately contain '=' or spaces) and only needs to survive as the LAST field, not be individually re-parsed - level is one digit (0-3, rte_log_level_t's own range) and tag is assumed delimiter-free (every call site in this codebase uses a short UPPER_CASE identifier, never one containing '|').
Pure types + static-inline codec, no I/O - same posture as rbc_util_frame.h. Consumed by C99 (AB side, the forwarding OSAdapter) and C++ (Gateway's status service).
Definition in file rbc_util_jru_payload.h.
|
inlinestatic |
Encodes one forwarded log event into a JRU_LOG publish payload.
| out | Destination, at least RBC_UTIL_PAYLOAD_MAX + 1 bytes (NUL-terminated). |
| out_size | Size of out. |
| level | Original severity. |
| tag | Original tag, or NULL/empty for none. |
| message | Original message. Truncated (not rejected) if the encoded line would not fit. |
Definition at line 41 of file rbc_util_jru_payload.h.
|
inlinestatic |
Decodes a JRU_LOG publish payload back into its fields.
| payload | NUL-terminated payload as decoded by rbc_util_frame_decode(). |
| out_level | Destination for the severity (RTE_LOG_LEVEL_INFO if the digit is missing or out of range - a defensive default, never a decode failure). |
| tag_out | Destination buffer for the tag. |
| tag_out_size | Size of tag_out. |
| msg_out | Destination buffer for the message (everything after the second '|'). |
| msg_out_size | Size of msg_out. |
payload has fewer than two '|' delimiters (malformed frame); the caller should drop it. Every field is still NUL-terminated on a false return. Definition at line 61 of file rbc_util_jru_payload.h.