Mercury Modem
Mercury ARQ/Broadcast modem
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
arq_protocol.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
Include dependency graph for arq_protocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  arq_frame_hdr_t
 
struct  arq_mode_timing_t
 
struct  arq_accept_t
 

Macros

#define ARQ_HDR_SUBTYPE_IDX   1
 
#define ARQ_HDR_FLAGS_IDX   2
 
#define ARQ_HDR_SESSION_IDX   3
 
#define ARQ_HDR_SEQ_IDX   4
 
#define ARQ_HDR_ACK_IDX   5
 
#define ARQ_HDR_SNR_IDX   6
 
#define ARQ_HDR_DELAY_IDX   7
 
#define ARQ_FRAME_HDR_SIZE   8 /* bytes 0-7 inclusive */
 
#define ARQ_CONNECT_SESSION_IDX   1
 
#define ARQ_CONNECT_PAYLOAD_IDX   2
 
#define ARQ_CONNECT_SESSION_MASK   0x7F
 
#define ARQ_CONNECT_ACCEPT_FLAG   0x80
 
#define ARQ_CONTROL_FRAME_SIZE   14
 
#define ARQ_CONNECT_META_SIZE   2 /* framer byte + connect_meta byte */
 
#define ARQ_CONNECT_MAX_ENCODED   (ARQ_CONTROL_FRAME_SIZE - ARQ_CONNECT_META_SIZE)
 
#define ARQ_CONNECT_DST_CRC_SIZE   2 /* CRC16-CCITT of DST at bytes [2..3], little-endian */
 
#define ARQ_CONNECT_SRC_MAX_ENCODED   (ARQ_CONNECT_MAX_ENCODED - ARQ_CONNECT_DST_CRC_SIZE) /* 10 */
 
#define ARQ_CQ_PAYLOAD_IDX   1
 
#define ARQ_CQ_SRC_MAX_ENCODED   (ARQ_CONTROL_FRAME_SIZE - ARQ_CQ_PAYLOAD_IDX) /* 13 */
 
#define ARQ_BW_TOKEN_NONE   0
 
#define ARQ_BW_TOKEN_500   1
 
#define ARQ_BW_TOKEN_2300   2
 
#define ARQ_BW_TOKEN_2750   3
 
#define ARQ_BURST_MAX   5
 
#define ARQ_CONTROL_MODE   FREEDV_MODE_DATAC16
 
#define ARQ_CHANNEL_GUARD_MS
 
#define ARQ_ISS_POST_ACK_GUARD_MS
 
#define ARQ_ACCEPT_RX_WINDOW_MS
 
#define ARQ_LISTEN_OFF_GRACE_MS   2000
 
#define ARQ_CALL_RETRY_SLOTS_DEFAULT   4 /* CALL retries before giving up */
 
#define ARQ_CALL_FAST_SLOTS   2
 
#define ARQ_ACCEPT_RX_WINDOW_FLOOR_MS   26000
 
#define ARQ_ACCEPT_RETRY_SLOTS_DEFAULT   4 /* ACCEPT retries before returning */
 
#define ARQ_DISCONNECT_RETRY_SLOTS_DEFAULT   2 /* DISCONNECT frame retries */
 
#define ARQ_CALLINT_MIN_S   4.0f
 
#define ARQ_CALLINT_DEFAULT_S   0.0f /* 0 = use table default */
 
#define ARQ_RETRY_STAGGER_MS_DEFAULT   2000
 
#define ARQ_RETRY_STAGGER_MS_MAX   5000
 
#define ARQ_CALL_RETRY_SLOTS   atomic_load(&arq_call_retry_slots)
 
#define ARQ_ACCEPT_RETRY_SLOTS   atomic_load(&arq_accept_retry_slots)
 
#define ARQ_DISCONNECT_RETRY_SLOTS   atomic_load(&arq_disconnect_retry_slots)
 
#define ARQ_ACK_DATA_GAP_MS   300
 
#define ARQ_CHANNEL_SYNC_HOLD_MS   250
 
#define ARQ_CHANNEL_DEFER_MS   500
 
#define ARQ_CHANNEL_DEFER_MAX   20 /* ~10 s, then key regardless */
 
#define ARQ_REPLY_WINDOW_MARGIN_MS   1000
 
#define ARQ_SNR_HYST_DB   5.0f
 
#define ARQ_SNR_MIN_DATAC15_DB
 
#define ARQ_SNR_MIN_DATAC4_DB
 
#define ARQ_SNR_MIN_DATAC3_DB   -1.0f
 
#define ARQ_SNR_MIN_DATAC1_DB   3.0f
 
#define ARQ_SNR_MIN_DATAC17_DB
 
#define ARQ_SNR_MIN_QAM16C2_DB
 
#define ARQ_DISCONNECT_DRAIN_TIMEOUT_S_DEFAULT   45
 
#define ARQ_DISCONNECT_DRAIN_TIMEOUT_S   atomic_load(&arq_disconnect_drain_timeout_s)
 
#define ARQ_CONNECT_VERSION   1
 
#define ARQ_CONNECT_EXT_BW_MASK   0x03
 
#define ARQ_CONNECT_EXT_VERSION_SHIFT   2
 
#define ARQ_CONNECT_EXT_VERSION_MASK   0x0C
 
#define ARQ_CONNECT_EXT_CAROUSEL   0x10
 
#define ARQ_ACCEPT_CALLED_CRC_IDX   4
 
#define ARQ_ACCEPT_NONCE_IDX   6
 
#define ARQ_ACCEPT_LEVEL_IDX   8
 
#define ARQ_ACCEPT_LEVEL_CTL_DEAF
 

Enumerations

enum  arq_subtype_t { ARQ_SUBTYPE_DISCONNECT = 4 }
 

Functions

int arq_protocol_retry_rank (const char *local_call, const char *remote_call)
 
uint64_t arq_protocol_retry_deadline_ms (float seconds, int rank)
 
int arq_protocol_encode_hdr (uint8_t *buf, size_t buf_len, const arq_frame_hdr_t *hdr)
 Encode a parsed header into the first ARQ_FRAME_HDR_SIZE bytes of buf.
 
int arq_protocol_decode_hdr (const uint8_t *buf, size_t buf_len, arq_frame_hdr_t *hdr)
 Decode the ARQ header from the first bytes of buf.
 
uint8_t arq_protocol_bw_token_from_hz (int bw_hz)
 Map a configured bandwidth in Hz to an on-air BW token.
 
int arq_protocol_bw_hz_from_token (uint8_t bw_token)
 Map an on-air BW token back to Hz.
 
uint8_t arq_protocol_encode_snr (float snr_db)
 Encode a floating-point SNR (dB) into the snr_raw wire byte.
 
float arq_protocol_decode_snr (uint8_t snr_raw)
 Decode snr_raw wire byte back to float dB.
 
const arq_mode_timing_t * arq_protocol_mode_timing (int freedv_mode)
 Look up mode timing entry for a FreeDV mode.
 
float arq_protocol_longest_burst_s (void)
 Longest single-burst airtime across the whole mode table, in seconds.
 
float arq_protocol_call_interval_s (void)
 Return the CALL/ACCEPT retry interval in seconds, applying any CALLINT override.
 
float arq_protocol_call_interval_for_mode_s (int mode)
 
uint16_t arq_protocol_callsign_crc16 (const char *callsign)
 Compute CRC16-CCITT of an uppercase-normalised callsign.
 
int arq_protocol_build_disconnect (uint8_t *buf, size_t buf_len, uint8_t session_id, uint8_t snr_raw)
 DISCONNECT frame (PACKET_TYPE_ARQ_CONTROL).
 
int arq_protocol_build_call (uint8_t *buf, size_t buf_len, uint8_t session_id, const char *caller, const char *called, int bw_hz)
 Build a CALL.
 
int arq_protocol_build_accept (uint8_t *buf, size_t buf_len, uint8_t session_id, const char *called, const char *caller, int bw_hz, int start_level, uint16_t nonce)
 Build an ACCEPT.
 
bool arq_protocol_connect_version_ok (const uint8_t *buf, size_t buf_len)
 Is buf a CALL or ACCEPT of this protocol version?
 
bool arq_protocol_connect_dst_matches (const uint8_t *buf, const char *callsign)
 Is a CALL or ACCEPT addressed to callsign (bytes 2-3, all 16 bits)?
 
int arq_protocol_parse_call (const uint8_t *buf, size_t buf_len, uint8_t *session_id_out, char *caller_out, int *bw_hz_out)
 Parse a CALL: session id, the caller's callsign, the bandwidth.
 
int arq_protocol_parse_accept (const uint8_t *buf, size_t buf_len, arq_accept_t *out)
 Parse an ACCEPT.
 
int arq_protocol_build_cq (uint8_t *buf, size_t buf_len, const char *src, int bw_hz)
 Build a compact DATAC16 CQ frame carrying source callsign and BW token.
 
int arq_protocol_parse_cq (const uint8_t *buf, size_t buf_len, char *src_out, int *bw_hz_out)
 Parse a compact DATAC16 CQ frame.
 

Variables

_Atomic int arq_call_retry_slots
 
_Atomic int arq_accept_retry_slots
 
_Atomic int arq_disconnect_retry_slots
 
_Atomic float arq_callint_override_s
 
_Atomic int arq_retry_stagger_ms
 
_Atomic int arq_disconnect_drain_timeout_s
 
const arq_mode_timing_t arq_mode_table []
 
const int arq_mode_table_count
 

Macro Definition Documentation

◆ ARQ_ACCEPT_CALLED_CRC_IDX

#define ARQ_ACCEPT_CALLED_CRC_IDX   4

◆ ARQ_ACCEPT_LEVEL_CTL_DEAF

#define ARQ_ACCEPT_LEVEL_CTL_DEAF
Value:
7 /* the callee hears the caller below
the control mode: start at the floor */

◆ ARQ_ACCEPT_LEVEL_IDX

#define ARQ_ACCEPT_LEVEL_IDX   8

◆ ARQ_ACCEPT_NONCE_IDX

#define ARQ_ACCEPT_NONCE_IDX   6

◆ ARQ_ACCEPT_RETRY_SLOTS

#define ARQ_ACCEPT_RETRY_SLOTS   atomic_load(&arq_accept_retry_slots)

◆ ARQ_ACCEPT_RETRY_SLOTS_DEFAULT

#define ARQ_ACCEPT_RETRY_SLOTS_DEFAULT   4 /* ACCEPT retries before returning */

◆ ARQ_ACCEPT_RX_WINDOW_FLOOR_MS

#define ARQ_ACCEPT_RX_WINDOW_FLOOR_MS   26000

◆ ARQ_ACCEPT_RX_WINDOW_MS

#define ARQ_ACCEPT_RX_WINDOW_MS
Value:
9000 /* ACCEPTING RX window after ACCEPT TX:
* ISS_guard(900)+DATAC15(4400)+margin(3700)
* Old value 7000 left only ~300ms margin
* and raced with TIMER_RETRY, causing
* 3-4 wasted ACCEPT retries (~28s). */

◆ ARQ_ACK_DATA_GAP_MS

#define ARQ_ACK_DATA_GAP_MS   300

◆ ARQ_BURST_MAX

#define ARQ_BURST_MAX   5

◆ ARQ_BW_TOKEN_2300

#define ARQ_BW_TOKEN_2300   2

◆ ARQ_BW_TOKEN_2750

#define ARQ_BW_TOKEN_2750   3

◆ ARQ_BW_TOKEN_500

#define ARQ_BW_TOKEN_500   1

◆ ARQ_BW_TOKEN_NONE

#define ARQ_BW_TOKEN_NONE   0

◆ ARQ_CALL_FAST_SLOTS

#define ARQ_CALL_FAST_SLOTS   2

◆ ARQ_CALL_RETRY_SLOTS

#define ARQ_CALL_RETRY_SLOTS   atomic_load(&arq_call_retry_slots)

◆ ARQ_CALL_RETRY_SLOTS_DEFAULT

#define ARQ_CALL_RETRY_SLOTS_DEFAULT   4 /* CALL retries before giving up */

◆ ARQ_CALLINT_DEFAULT_S

#define ARQ_CALLINT_DEFAULT_S   0.0f /* 0 = use table default */

◆ ARQ_CALLINT_MIN_S

#define ARQ_CALLINT_MIN_S   4.0f

◆ ARQ_CHANNEL_DEFER_MAX

#define ARQ_CHANNEL_DEFER_MAX   20 /* ~10 s, then key regardless */

◆ ARQ_CHANNEL_DEFER_MS

#define ARQ_CHANNEL_DEFER_MS   500

◆ ARQ_CHANNEL_GUARD_MS

#define ARQ_CHANNEL_GUARD_MS
Value:
700 /* IRS response guard after frame decode.
* OFDM decode fires ~200ms before sender
* PTT-OFF, so effective gap at sender is
* (guard - 200ms) ~= 500ms. Radio needs
* ~340ms for TX->RX switch -> 160ms margin
* for preamble detection. At 500ms the
* effective gap was ~300ms, causing ~50%
* ACK loss on DATAC1 (< 340ms switch). */

◆ ARQ_CHANNEL_SYNC_HOLD_MS

#define ARQ_CHANNEL_SYNC_HOLD_MS   250

◆ ARQ_CONNECT_ACCEPT_FLAG

#define ARQ_CONNECT_ACCEPT_FLAG   0x80

◆ ARQ_CONNECT_DST_CRC_SIZE

#define ARQ_CONNECT_DST_CRC_SIZE   2 /* CRC16-CCITT of DST at bytes [2..3], little-endian */

◆ ARQ_CONNECT_EXT_BW_MASK

#define ARQ_CONNECT_EXT_BW_MASK   0x03

◆ ARQ_CONNECT_EXT_CAROUSEL

#define ARQ_CONNECT_EXT_CAROUSEL   0x10

◆ ARQ_CONNECT_EXT_VERSION_MASK

#define ARQ_CONNECT_EXT_VERSION_MASK   0x0C

◆ ARQ_CONNECT_EXT_VERSION_SHIFT

#define ARQ_CONNECT_EXT_VERSION_SHIFT   2

◆ ARQ_CONNECT_MAX_ENCODED

#define ARQ_CONNECT_MAX_ENCODED   (ARQ_CONTROL_FRAME_SIZE - ARQ_CONNECT_META_SIZE)

◆ ARQ_CONNECT_META_SIZE

#define ARQ_CONNECT_META_SIZE   2 /* framer byte + connect_meta byte */

◆ ARQ_CONNECT_PAYLOAD_IDX

#define ARQ_CONNECT_PAYLOAD_IDX   2

◆ ARQ_CONNECT_SESSION_IDX

#define ARQ_CONNECT_SESSION_IDX   1

◆ ARQ_CONNECT_SESSION_MASK

#define ARQ_CONNECT_SESSION_MASK   0x7F

◆ ARQ_CONNECT_SRC_MAX_ENCODED

#define ARQ_CONNECT_SRC_MAX_ENCODED   (ARQ_CONNECT_MAX_ENCODED - ARQ_CONNECT_DST_CRC_SIZE) /* 10 */

◆ ARQ_CONNECT_VERSION

#define ARQ_CONNECT_VERSION   1

◆ ARQ_CONTROL_FRAME_SIZE

#define ARQ_CONTROL_FRAME_SIZE   14

◆ ARQ_CONTROL_MODE

#define ARQ_CONTROL_MODE   FREEDV_MODE_DATAC16

◆ ARQ_CQ_PAYLOAD_IDX

#define ARQ_CQ_PAYLOAD_IDX   1

◆ ARQ_CQ_SRC_MAX_ENCODED

#define ARQ_CQ_SRC_MAX_ENCODED   (ARQ_CONTROL_FRAME_SIZE - ARQ_CQ_PAYLOAD_IDX) /* 13 */

◆ ARQ_DISCONNECT_DRAIN_TIMEOUT_S

#define ARQ_DISCONNECT_DRAIN_TIMEOUT_S   atomic_load(&arq_disconnect_drain_timeout_s)

◆ ARQ_DISCONNECT_DRAIN_TIMEOUT_S_DEFAULT

#define ARQ_DISCONNECT_DRAIN_TIMEOUT_S_DEFAULT   45

◆ ARQ_DISCONNECT_RETRY_SLOTS

#define ARQ_DISCONNECT_RETRY_SLOTS   atomic_load(&arq_disconnect_retry_slots)

◆ ARQ_DISCONNECT_RETRY_SLOTS_DEFAULT

#define ARQ_DISCONNECT_RETRY_SLOTS_DEFAULT   2 /* DISCONNECT frame retries */

◆ ARQ_FRAME_HDR_SIZE

#define ARQ_FRAME_HDR_SIZE   8 /* bytes 0-7 inclusive */

◆ ARQ_HDR_ACK_IDX

#define ARQ_HDR_ACK_IDX   5

◆ ARQ_HDR_DELAY_IDX

#define ARQ_HDR_DELAY_IDX   7

◆ ARQ_HDR_FLAGS_IDX

#define ARQ_HDR_FLAGS_IDX   2

◆ ARQ_HDR_SEQ_IDX

#define ARQ_HDR_SEQ_IDX   4

◆ ARQ_HDR_SESSION_IDX

#define ARQ_HDR_SESSION_IDX   3

◆ ARQ_HDR_SNR_IDX

#define ARQ_HDR_SNR_IDX   6

◆ ARQ_HDR_SUBTYPE_IDX

#define ARQ_HDR_SUBTYPE_IDX   1

◆ ARQ_ISS_POST_ACK_GUARD_MS

#define ARQ_ISS_POST_ACK_GUARD_MS
Value:
900 /* ISS guard before resuming DATA TX
* after receiving an ACK from the IRS.
* Larger than ARQ_CHANNEL_GUARD_MS:
* ack_rx fires ~168ms before IRS PTT-OFF,
* so the effective gap at IRS is only
* (guard + 100ms head) - 168ms.
* At 500ms: gap=432ms, too tight for
* DATAC1 re-sync after IRS ACK TX.
* At 900ms: gap=832ms -- 492ms of clear
* air before the DATAC1 preamble. */

◆ ARQ_LISTEN_OFF_GRACE_MS

#define ARQ_LISTEN_OFF_GRACE_MS   2000

◆ ARQ_REPLY_WINDOW_MARGIN_MS

#define ARQ_REPLY_WINDOW_MARGIN_MS   1000

◆ ARQ_RETRY_STAGGER_MS_DEFAULT

#define ARQ_RETRY_STAGGER_MS_DEFAULT   2000

◆ ARQ_RETRY_STAGGER_MS_MAX

#define ARQ_RETRY_STAGGER_MS_MAX   5000

◆ ARQ_SNR_HYST_DB

#define ARQ_SNR_HYST_DB   5.0f

◆ ARQ_SNR_MIN_DATAC15_DB

#define ARQ_SNR_MIN_DATAC15_DB
Value:
-7.0f /* its cliff (sim, bench): below
* it the carousel's MFSK rung wins */

◆ ARQ_SNR_MIN_DATAC17_DB

#define ARQ_SNR_MIN_DATAC17_DB
Value:
7.0f /* bench (docs/MODES.md): goodput
* crossover vs DATAC1 ~ +6 dB MPP;
* 89/100 delivery at +8 */

◆ ARQ_SNR_MIN_DATAC1_DB

#define ARQ_SNR_MIN_DATAC1_DB   3.0f

◆ ARQ_SNR_MIN_DATAC3_DB

#define ARQ_SNR_MIN_DATAC3_DB   -1.0f

◆ ARQ_SNR_MIN_DATAC4_DB

#define ARQ_SNR_MIN_DATAC4_DB
Value:
-6.0f /* bench (docs/MODES.md):
* DATAC15/DATAC4 goodput crossover
* ~-7.5 dB MPP / -8.5 dB AWGN */

◆ ARQ_SNR_MIN_QAM16C2_DB

#define ARQ_SNR_MIN_QAM16C2_DB
Value:
13.0f /* bench: goodput crossover vs
* DATAC17 ~ +11 dB MPP, 84/100 at
* +13.7; upstream's published
* operating point is +15 */

Enumeration Type Documentation

◆ arq_subtype_t

Enumerator
ARQ_SUBTYPE_DISCONNECT 

Function Documentation

◆ arq_protocol_build_accept()

int arq_protocol_build_accept ( uint8_t *  buf,
size_t  buf_len,
uint8_t  session_id,
const char *  called,
const char *  caller,
int  bw_hz,
int  start_level,
uint16_t  nonce 
)

Build an ACCEPT.

called: the callsign the CALL was addressed to (the callee's primary or a secondary); start_level 0..6, or ARQ_ACCEPT_LEVEL_CTL_DEAF.

Returns
ARQ_CONTROL_FRAME_SIZE (14), or -1.

◆ arq_protocol_build_call()

int arq_protocol_build_call ( uint8_t *  buf,
size_t  buf_len,
uint8_t  session_id,
const char *  caller,
const char *  called,
int  bw_hz 
)

Build a CALL.

Returns
ARQ_CONTROL_FRAME_SIZE (14), or -1.

◆ arq_protocol_build_cq()

int arq_protocol_build_cq ( uint8_t *  buf,
size_t  buf_len,
const char *  src,
int  bw_hz 
)

Build a compact DATAC16 CQ frame carrying source callsign and BW token.

◆ arq_protocol_build_disconnect()

int arq_protocol_build_disconnect ( uint8_t *  buf,
size_t  buf_len,
uint8_t  session_id,
uint8_t  snr_raw 
)

DISCONNECT frame (PACKET_TYPE_ARQ_CONTROL).

◆ arq_protocol_bw_hz_from_token()

int arq_protocol_bw_hz_from_token ( uint8_t  bw_token)

Map an on-air BW token back to Hz.

Returns
500/2300/2750 on success, or 0 if the token is invalid.

◆ arq_protocol_bw_token_from_hz()

uint8_t arq_protocol_bw_token_from_hz ( int  bw_hz)

Map a configured bandwidth in Hz to an on-air BW token.

Returns
ARQ_BW_TOKEN_* value, or ARQ_BW_TOKEN_NONE if unsupported.

◆ arq_protocol_call_interval_for_mode_s()

float arq_protocol_call_interval_for_mode_s ( int  mode)

◆ arq_protocol_call_interval_s()

float arq_protocol_call_interval_s ( void  )

Return the CALL/ACCEPT retry interval in seconds, applying any CALLINT override.

Falls back to the DATAC16 table default (8.0s).

◆ arq_protocol_callsign_crc16()

uint16_t arq_protocol_callsign_crc16 ( const char *  callsign)

Compute CRC16-CCITT of an uppercase-normalised callsign.

Used to encode/validate the DST field in CALL/ACCEPT frames.

◆ arq_protocol_connect_dst_matches()

bool arq_protocol_connect_dst_matches ( const uint8_t *  buf,
const char *  callsign 
)

Is a CALL or ACCEPT addressed to callsign (bytes 2-3, all 16 bits)?

◆ arq_protocol_connect_version_ok()

bool arq_protocol_connect_version_ok ( const uint8_t *  buf,
size_t  buf_len 
)

Is buf a CALL or ACCEPT of this protocol version?

◆ arq_protocol_decode_hdr()

int arq_protocol_decode_hdr ( const uint8_t *  buf,
size_t  buf_len,
arq_frame_hdr_t *  hdr 
)

Decode the ARQ header from the first bytes of buf.

Returns
0 on success, -1 if buf too short.

◆ arq_protocol_decode_snr()

float arq_protocol_decode_snr ( uint8_t  snr_raw)

Decode snr_raw wire byte back to float dB.

Returns
SNR in dB, or 0.0f if snr_raw == 0 (unknown).

◆ arq_protocol_encode_hdr()

int arq_protocol_encode_hdr ( uint8_t *  buf,
size_t  buf_len,
const arq_frame_hdr_t *  hdr 
)

Encode a parsed header into the first ARQ_FRAME_HDR_SIZE bytes of buf.

Returns
0 on success, -1 if buf_len < ARQ_FRAME_HDR_SIZE.

◆ arq_protocol_encode_snr()

uint8_t arq_protocol_encode_snr ( float  snr_db)

Encode a floating-point SNR (dB) into the snr_raw wire byte.

Returns
Encoded byte (0 if snr_db is out of range or unknown).

◆ arq_protocol_longest_burst_s()

float arq_protocol_longest_burst_s ( void  )

Longest single-burst airtime across the whole mode table, in seconds.

The RX side must be able to hold a burst of ANY mode the peer might send, not just the one currently selected — the peer can change rung between our bursts, and the first frame of the new rung arrives before we know about it. Buffers sized from the active mode are therefore always one step behind.

◆ arq_protocol_mode_timing()

const arq_mode_timing_t * arq_protocol_mode_timing ( int  freedv_mode)

Look up mode timing entry for a FreeDV mode.

Returns
Pointer to timing entry, or NULL if mode is unknown.

◆ arq_protocol_parse_accept()

int arq_protocol_parse_accept ( const uint8_t *  buf,
size_t  buf_len,
arq_accept_t *  out 
)

Parse an ACCEPT.

Returns
0, or -1 (wrong version, bad bandwidth token, a reserved bit set, a start rung off the ladder).

◆ arq_protocol_parse_call()

int arq_protocol_parse_call ( const uint8_t *  buf,
size_t  buf_len,
uint8_t *  session_id_out,
char *  caller_out,
int *  bw_hz_out 
)

Parse a CALL: session id, the caller's callsign, the bandwidth.

Returns
0, or -1 (wrong version, bad bandwidth token, undecodable call).

◆ arq_protocol_parse_cq()

int arq_protocol_parse_cq ( const uint8_t *  buf,
size_t  buf_len,
char *  src_out,
int *  bw_hz_out 
)

Parse a compact DATAC16 CQ frame.

◆ arq_protocol_retry_deadline_ms()

uint64_t arq_protocol_retry_deadline_ms ( float  seconds,
int  rank 
)

◆ arq_protocol_retry_rank()

int arq_protocol_retry_rank ( const char *  local_call,
const char *  remote_call 
)

Variable Documentation

◆ arq_accept_retry_slots

_Atomic int arq_accept_retry_slots
extern

◆ arq_call_retry_slots

_Atomic int arq_call_retry_slots
extern

◆ arq_callint_override_s

_Atomic float arq_callint_override_s
extern

◆ arq_disconnect_drain_timeout_s

_Atomic int arq_disconnect_drain_timeout_s
extern

◆ arq_disconnect_retry_slots

_Atomic int arq_disconnect_retry_slots
extern

◆ arq_mode_table

const arq_mode_timing_t arq_mode_table[]
extern

◆ arq_mode_table_count

const int arq_mode_table_count
extern

◆ arq_retry_stagger_ms

_Atomic int arq_retry_stagger_ms
extern