SafeAPI RBC 2oo2 Generic Application
IL/CTC route and train logic for the safeAPIRBC2oo2 reference RBC
Loading...
Searching...
No Matches
ab_ga_il_wire.c File Reference

See ab_ga_il_wire.h - dedicated IL <-> RBC message codec + validation. More...

#include "ab_ga_il_wire.h"
#include "safeapi/oal/memory/sapi_mem_util.h"
#include "safeapi/utils/buffer/sapi_buffer.h"
Include dependency graph for ab_ga_il_wire.c:

Go to the source code of this file.

Functions

static bool read_i32_le (const uint8_t *frame, size_t off, int32_t *out)
static void write_i32_le (uint8_t *frame, size_t off, int32_t value)
static bool id_field_valid (int32_t v)
static bool flag_valid (uint8_t v)
bool ab_ga_il_wire_decode_route_cmd (const uint8_t frame[RBC_ENVELOPE_WIRE_SIZE], ab_ga_il_route_cmd_t *out)
 Decodes + fully range-validates an RBC_MSG_IL_ROUTE_CMD frame.
bool ab_ga_il_wire_decode_status (const uint8_t frame[RBC_ENVELOPE_WIRE_SIZE], ab_ga_il_status_msg_t *out)
 Decodes + validates an RBC_MSG_IL_STATUS frame. Same contract.
void ab_ga_il_wire_encode_route_indication (uint8_t frame[RBC_ENVELOPE_WIRE_SIZE], const ab_ga_il_route_indication_t *in)
 Encodes an RBC_MSG_IL_ROUTE_INDICATION frame (zero-fills the whole RBC_ENVELOPE_WIRE_SIZE slot first).

Detailed Description

See ab_ga_il_wire.h - dedicated IL <-> RBC message codec + validation.

Definition in file ab_ga_il_wire.c.

Function Documentation

◆ ab_ga_il_wire_decode_route_cmd()

bool ab_ga_il_wire_decode_route_cmd ( const uint8_t frame[RBC_ENVELOPE_WIRE_SIZE],
ab_ga_il_route_cmd_t * out )

Decodes + fully range-validates an RBC_MSG_IL_ROUTE_CMD frame.

Parameters
[in]frameRaw RBC_ENVELOPE_WIRE_SIZE bytes; frame[0] must be RBC_MSG_IL_ROUTE_CMD.
[out]outDecoded payload on success; untouched on failure.
Returns
true only if frame[0] is the right kind AND every field is in range (enums within their declared value sets; identity fields -1 or >= 0; the two flags 0 or 1). false otherwise - a malformed or out-of-range command is rejected, not clamped.

Definition at line 60 of file ab_ga_il_wire.c.

◆ ab_ga_il_wire_decode_status()

bool ab_ga_il_wire_decode_status ( const uint8_t frame[RBC_ENVELOPE_WIRE_SIZE],
ab_ga_il_status_msg_t * out )

Decodes + validates an RBC_MSG_IL_STATUS frame. Same contract.

Definition at line 119 of file ab_ga_il_wire.c.

◆ ab_ga_il_wire_encode_route_indication()

void ab_ga_il_wire_encode_route_indication ( uint8_t frame[RBC_ENVELOPE_WIRE_SIZE],
const ab_ga_il_route_indication_t * in )

Encodes an RBC_MSG_IL_ROUTE_INDICATION frame (zero-fills the whole RBC_ENVELOPE_WIRE_SIZE slot first).

Parameters
[out]frameReceives the full slot.
[in]inPayload to encode. Assumed already valid (RBC-side producer).

Definition at line 139 of file ab_ga_il_wire.c.

◆ flag_valid()

bool flag_valid ( uint8_t v)
static

Definition at line 53 of file ab_ga_il_wire.c.

◆ id_field_valid()

bool id_field_valid ( int32_t v)
static

Definition at line 47 of file ab_ga_il_wire.c.

◆ read_i32_le()

bool read_i32_le ( const uint8_t * frame,
size_t off,
int32_t * out )
static

Definition at line 15 of file ab_ga_il_wire.c.

◆ write_i32_le()

void write_i32_le ( uint8_t * frame,
size_t off,
int32_t value )
static

Definition at line 33 of file ab_ga_il_wire.c.