Skip to main content

Module lorawan_relay

Module lorawan_relay 

Source
Expand description

The C ABI for a LoRaWAN relay, TS011-1.0.1: the wake-on-radio frames an end device and a relay exchange, the uplinks a relay forwards, and the timing that keeps a wake-on-radio preamble short.

Everything here is a pure function of its arguments. Keys cross as a PamojaLorawanWorKeys of two sixteen-byte arrays, carriers and states as small structs, and frames as fixed-length arrays written in place, except a forwarded uplink, whose length follows the end device’s frame and crosses as a buffer.

Structs§

PamojaLorawanCarrier
Where a frame goes and how fast.
PamojaLorawanStateSync
What a relay tells an end device about itself in a WOR ACK, as TS011-1.0.1 table 14 codes each field.
PamojaLorawanSynchronization
What an end device knows of a relay’s scans once a WOR ACK has arrived.
PamojaLorawanUplinkMetadata
What a relay heard of an uplink it forwards.
PamojaLorawanWor
A wake-on-radio frame, as a relay reads it.
PamojaLorawanWorKeys
The integrity and encryption keys of one end device’s wake-on-radio frames.
PamojaLorawanWorSlot
When a synchronized end device’s next WOR frame goes out.

Constants§

PAMOJA_LORAWAN_FORWARD_OVERHEAD
The bytes a forwarded uplink adds in front of the end device’s frame.
PAMOJA_LORAWAN_LA_FPORT_RELAY
The port every message between a relay and its network uses.
PAMOJA_LORAWAN_MIN_WOR_PREAMBLE_SYMBOLS
The shortest WOR preamble, in symbols.
PAMOJA_LORAWAN_RELAY_FWD_DELAY_US
The gap between a relay hearing an uplink and forwarding it.
PAMOJA_LORAWAN_RXR_DELAY_US
How long after an uplink an end device’s RXR window opens at the latest.
PAMOJA_LORAWAN_TRUSTED_ED_NUMBER
How many end devices a relay verifies wake-on-radio frames for.
PAMOJA_LORAWAN_WOR_ACK_DELAY_US
The gap between a WOR frame and its acknowledgment.
PAMOJA_LORAWAN_WOR_ACK_LEN
The length of a WOR ACK.
PAMOJA_LORAWAN_WOR_ATTEMPTS_WO_ACK
How many WOR frames go without an acknowledgment before the uplink goes anyway.
PAMOJA_LORAWAN_WOR_DATA_DELAY_US
The gap between a WOR frame, or its acknowledgment, and the LoRaWAN frame after it.
PAMOJA_LORAWAN_WOR_JOIN_REQUEST
A WOR frame ahead of a join request.
PAMOJA_LORAWAN_WOR_JOIN_REQUEST_LEN
The length of a WOR frame ahead of a join request.
PAMOJA_LORAWAN_WOR_UPLINK
A WOR frame ahead of a Class A uplink.
PAMOJA_LORAWAN_WOR_UPLINK_LEN
The length of a WOR frame ahead of a Class A uplink.

Functions§

pamoja_lorawan_relay_forward_encode⚠
Writes an uplink a relay forwards, TS011-1.0.1 section 9.1.
pamoja_lorawan_relay_forward_parse⚠
Reads an uplink a relay forwarded, TS011-1.0.1 section 9.1.
pamoja_lorawan_relay_next_wor⚠
Picks the relay scan a synchronized end device aims its next WOR frame at, TS011-1.0.1 appendix 1.
pamoja_lorawan_relay_root_wor_s_key⚠
Derives an end device’s root relay session key from its network session key, TS011-1.0.1 section 4.4.
pamoja_lorawan_relay_second_channel⚠
Reads the second channel a relay or end device configuration describes.
pamoja_lorawan_relay_synchronization⚠
Works out when a relay scanned from the WOR ACK that answered a frame.
pamoja_lorawan_relay_t_offset_ms⚠
Works out the offset a relay reports in a WOR ACK, TS011-1.0.1 appendix 1.
pamoja_lorawan_relay_unsynchronized_preamble⚠
Works out the WOR preamble of an end device that does not know when the relay scans, TS011-1.0.1 section 5.2.
pamoja_lorawan_relay_wor_ack⚠
Builds a relay’s WOR ACK, TS011-1.0.1 section 6.2.
pamoja_lorawan_relay_wor_ack_open⚠
Checks and reads a WOR ACK, TS011-1.0.1 section 6.2.
pamoja_lorawan_relay_wor_join_request⚠
Builds the WOR frame ahead of a join request, TS011-1.0.1 section 5.3.1.
pamoja_lorawan_relay_wor_keys⚠
Derives an end device’s wake-on-radio keys from its root relay session key, TS011-1.0.1 section 4.5.
pamoja_lorawan_relay_wor_open⚠
Checks a WOR frame ahead of a Class A uplink and reads where the uplink follows.
pamoja_lorawan_relay_wor_parse⚠
Reads a WOR frame.
pamoja_lorawan_relay_wor_uplink⚠
Builds the WOR frame ahead of a Class A uplink, TS011-1.0.1 section 5.3.2.
pamoja_lorawan_session_root_wor_s_key⚠
Returns the root relay session key of a session’s device.
pamoja_lorawan_session_wor_keys⚠
Returns the wake-on-radio keys of a session’s device.