F439_CPP_TX-RX_LoRa_Project

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
radio_link.h File Reference
Firmware Architecture » RadioLink Protocol Layer

RadioLink framing, crypto, replay, and persistence interface. More...

`#include <main.h>`
`#include <stdint.h>`
`#include <stdbool.h>`
`#include "ada1897_mb85rs64b.h"`
`#include "sx1262.h"`
`#include "radio_wire.h"`
Include dependency graph for radio_link.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | radioLinkCryptoCtx_t
| Runtime crypto context for RadioLink key material. More...

## Macros
#define | RADIOLINK_CRYPTO_ENABLE (1)
#define | RADIOLINK_DEBUG_TAMPER_ENABLE 0
#define | RADIOLINK_DEBUG_REPLAY_REJECT_ENABLE 0
#define | RADIOLINK_DEBUG_RX_REJECT_REASON_ENABLE 1
#define | RADIOLINK_DEBUG_TX_REPLAY_ONESHOT_ENABLE 0
#define | RL_PERSIST_ENABLE 1
#define | RL_PERSIST_DISABLE_WHEN_DEBUGGER 1
#define | RADIOLINK_WIRE_V3_HDR_LEN (RADIOLINK_WIRE_V3_HDR_LEN_DERIVED)
| Fixed Wire v3 header length in bytes.
#define | RADIOLINK_W3_VERSION (RADIOLINK_WIRE_V3_VERSION)
#define | RADIOLINK_W3_HDR_LEN (RADIOLINK_WIRE_V3_HDR_LEN_DERIVED)
#define | RADIOLINK_W3_TAG_LEN (RADIOLINK_WIRE_V3_TAG_LEN)
#define | RADIOLINK_MAX_NODE_ID (255u)
| Number of accepted Wire v3 node identifiers; valid nodeId range is 0..254.

## Typedefs
typedef struct radioLinkCryptoCtx_t | radioLinkCryptoCtx_t
| Runtime crypto context for RadioLink key material.

## Functions
bool | RadioLink_SendString (SX1262_Handle *sx, const char *s)
| Encrypt, authenticate, and send a string payload.
bool | RadioLink_TryDecodeToString (const uint8_t *rx, uint8_t rx_len, char *out, uint8_t out_max)
| Parse and decrypt a received Wire v3 frame into a string buffer.
bool | RadioLink_SendBytes (SX1262_Handle *sx, const uint8_t *buf, uint8_t len)
| Encrypt, authenticate, and send a raw byte payload.
bool | RadioLink_BuildWireV3Frame (uint8_t *out, uint8_t outMax, uint8_t nodeId, uint32_t sessionSeqId, uint32_t msgCounter, const uint8_t *plain, uint8_t plainLen, uint8_t *outLen)
| Build a Wire v3 frame from plaintext input.
bool | RadioLink_ParseWireV3Frame (const uint8_t *rx, uint8_t rxLen, uint8_t *outPlain, uint8_t outPlainMax, uint8_t *outPlainLen)
| Parse, authenticate, replay-check, and decrypt a Wire v3 frame.

## Detailed Description

RadioLink framing, crypto, replay, and persistence interface.

## Macro Definition Documentation

## ◆ RADIOLINK_CRYPTO_ENABLE

#define RADIOLINK_CRYPTO_ENABLE (1)

## ◆ RADIOLINK_DEBUG_REPLAY_REJECT_ENABLE

#define RADIOLINK_DEBUG_REPLAY_REJECT_ENABLE 0

## ◆ RADIOLINK_DEBUG_RX_REJECT_REASON_ENABLE

#define RADIOLINK_DEBUG_RX_REJECT_REASON_ENABLE 1

## ◆ RADIOLINK_DEBUG_TAMPER_ENABLE

#define RADIOLINK_DEBUG_TAMPER_ENABLE 0

## ◆ RADIOLINK_DEBUG_TX_REPLAY_ONESHOT_ENABLE

#define RADIOLINK_DEBUG_TX_REPLAY_ONESHOT_ENABLE 0

## ◆ RADIOLINK_MAX_NODE_ID

#define RADIOLINK_MAX_NODE_ID (255u)

Number of accepted Wire v3 node identifiers; valid nodeId range is 0..254.

## ◆ RADIOLINK_W3_HDR_LEN

#define RADIOLINK_W3_HDR_LEN (RADIOLINK_WIRE_V3_HDR_LEN_DERIVED)

## ◆ RADIOLINK_W3_TAG_LEN

#define RADIOLINK_W3_TAG_LEN (RADIOLINK_WIRE_V3_TAG_LEN)

## ◆ RADIOLINK_W3_VERSION

#define RADIOLINK_W3_VERSION (RADIOLINK_WIRE_V3_VERSION)

## ◆ RADIOLINK_WIRE_V3_HDR_LEN

#define RADIOLINK_WIRE_V3_HDR_LEN (RADIOLINK_WIRE_V3_HDR_LEN_DERIVED)

Fixed Wire v3 header length in bytes.

## ◆ RL_PERSIST_DISABLE_WHEN_DEBUGGER

#define RL_PERSIST_DISABLE_WHEN_DEBUGGER 1

## ◆ RL_PERSIST_ENABLE

#define RL_PERSIST_ENABLE 1

## Typedef Documentation

## ◆ radioLinkCryptoCtx_t

typedef struct radioLinkCryptoCtx_t radioLinkCryptoCtx_t

Runtime crypto context for RadioLink key material.

## Function Documentation

## ◆ RadioLink_BuildWireV3Frame()

bool RadioLink_BuildWireV3Frame | ( | uint8_t * | out,
|  | uint8_t | outMax,
|  | uint8_t | nodeId,
|  | uint32_t | sessionSeqId,
|  | uint32_t | msgCounter,
|  | const uint8_t * | plain,
|  | uint8_t | plainLen,
|  | uint8_t * | outLen )

Build a Wire v3 frame from plaintext input.

Parameters

  out | Output frame buffer.
  outMax | Size of the output frame buffer in bytes.
  nodeId | Source node identifier.
  sessionSeqId | Session sequence identifier.
  msgCounter | Monotonic message counter.
  plain | Plaintext payload buffer.
  plainLen | Plaintext payload length in bytes.
  outLen | Output pointer for the final frame length.

Returns
  true if the frame was built successfully, otherwise false.

## ◆ RadioLink_ParseWireV3Frame()

bool RadioLink_ParseWireV3Frame | ( | const uint8_t * | rx,
|  | uint8_t | rxLen,
|  | uint8_t * | outPlain,
|  | uint8_t | outPlainMax,
|  | uint8_t * | outPlainLen )

Parse, authenticate, replay-check, and decrypt a Wire v3 frame.

Parameters

  rx | Pointer to the received frame bytes.
  rxLen | Number of bytes in the received frame.
  outPlain | Output plaintext buffer.
  outPlainMax | Size of the output plaintext buffer in bytes.
  outPlainLen | Output pointer for the plaintext length.

Returns
  true if the frame was accepted and decrypted, otherwise false.

## ◆ RadioLink_SendBytes()

bool RadioLink_SendBytes | ( | SX1262_Handle * | sx,
|  | const uint8_t * | buf,
|  | uint8_t | len )

Encrypt, authenticate, and send a raw byte payload.

Parameters

  sx | SX1262 driver handle used for transmission.
  buf | Payload buffer.
  len | Payload length in bytes.

Returns
  true if the frame was built and queued successfully, otherwise false.

Encrypt, authenticate, and send a raw byte payload.

## ◆ RadioLink_SendString()

bool RadioLink_SendString | ( | SX1262_Handle * | sx,
|  | const char * | s )

Encrypt, authenticate, and send a string payload.

Parameters

  sx | SX1262 driver handle used for transmission.
  s | NUL-terminated string payload.

Returns
  true if the frame was built and queued successfully, otherwise false.

Encrypt, authenticate, and send a string payload.

## ◆ RadioLink_TryDecodeToString()

bool RadioLink_TryDecodeToString | ( | const uint8_t * | rx,
|  | uint8_t | rx_len,
|  | char * | out,
|  | uint8_t | out_max )

Parse and decrypt a received Wire v3 frame into a string buffer.

Parameters

  rx | Pointer to the received frame bytes.
  rx_len | Number of bytes in the received frame.
  out | Output string buffer.
  out_max | Size of the output buffer in bytes.

Returns
  true if decoding succeeded, otherwise false.

Parse and decrypt a received Wire v3 frame into a string buffer.