The datapath is the path that carries bytes between stellarlinkd and the modem, in both
directions. This page covers how bytes get in and out.
Claiming the modem#
The daemon must acquire the datapath before it can transmit or receive. With the shipped
configuration ([datapath] autostart = false) the daemon claims nothing until something asks it
to.
stellarlinkctl datapath status # who holds the modem, and is the transmit output enabled
stellarlinkctl datapath enable # claim it, then read back whether the claim took
stellarlinkctl datapath disable # release it| Route | Purpose |
|---|---|
GET /api/v1/datapath | Current state |
POST /api/v1/datapath/enable | Acquire |
POST /api/v1/datapath/disable | Release |
chain up acquires the datapath as its last step. The measurement commands (capture,
loopback) claim it themselves and want it exclusively: release it first, or they return 409.
Blocks and latency#
Data moves between the daemon and the modem in blocks of 4096 bytes (reported as
block_useful_bytes). Only full blocks are sent, so:
- a packet does not go on the air until its block is full;
- at a low packet rate you must flush, or the packets wait indefinitely;
- on the receive side, a block is returned only once it is full, and the first frame of a freshly armed chain is used for acquisition. Flush two blocks whenever you want to see the result come back.
stellarlinkctl tx flush --blocks 2 # POST /api/v1/datapath/flush {"blocks": 2}The flush reply gives the bytes sent (padding included; zero when nothing was pending) and
tx_chain_running, which says whether the transmit output is enabled. There is no automatic
flush timer: padding goes on the air, so when to spend it is the caller's decision.
Framing: stream or slot#
The modem cuts the byte stream into frames of the profile's frame length without looking at packet boundaries. How you lay packets out decides whether their boundaries survive:
| Mode | Boundaries | Overhead | Use for |
|---|---|---|---|
stream | None: the receiver gets the bytes re-cut at the frame length | Zero | Bulk payloads that carry their own delimiting |
slot | One packet per slot, recoverable | The fill of each slot | A packet feed (CSP, CCSDS) |
A slot is [length: 2 bytes, big-endian][packet][padding…], exactly slot_len bytes. The
length prefix is needed because CSP has no length field: without it the padding would be
indistinguishable from payload.
Two constraints on slot_len, both enforced by refusal:
- it must equal the modem's frame length (the profile's
framing.mtu_byteswithout coding); - it must divide 4096: 1024, 512, 256, 128, 64, 16 work; 223 does not, so slot framing is unavailable with Reed-Solomon coding.
Pushing packets#
One-off: POST /api/v1/datapath/transmit#
{
"packets": [
{"protocol": "csp",
"header": {"priority": "normal", "src": 10, "dst": 1, "dport": 7, "sport": 31,
"flags": {"crc32": false, "xtea": false, "rdp": false, "hmac": false}},
"payload_hex": "01020304"},
{"protocol": "raw", "payload_hex": "deadbeef"}
],
"framing": {"mode": "slot", "slot_len": 256}
}| Protocol | Effect |
|---|---|
raw | The bytes are passed through untouched |
csp | Stellar Link builds a CSP packet (4-byte header) from header and the payload |
ccsds | Stellar Link builds a CCSDS space packet (6-byte primary header) |
Packet shapes (the same JSON is accepted by /ws/tx and returned by the frames store):
{"protocol": "raw", "payload_hex": "deadbeef"}
{"protocol": "csp",
"header": {"priority": "normal", "src": 10, "dst": 1, "dport": 7, "sport": 31,
"flags": {"crc32": false, "xtea": false, "rdp": false, "hmac": false}},
"payload_hex": "01020304"}
{"protocol": "ccsds",
"header": {"version": 0, "kind": "tc", "secondary_header": false, "apid": 42,
"seq_flags": "standalone", "seq_count": 0, "data_length": 3},
"payload_hex": "01020304"}Every CSP header field is required: priority is critical, high, normal or low;
addresses are 5 bits (0 to 31) and ports 6 bits (0 to 63). CSP payloads are limited to 256 bytes.
In slot mode the encoded packet, header included, must fit in slot_len − 2 bytes.
For CCSDS, kind is tm or tc and seq_flags is continuation, first, last or
standalone.
The reply reports packets, useful_bytes, wire_bytes, boundaries_preserved,
tx_chain_running and block_useful_bytes. It returns once the data is queued, not once it
has been transmitted. When the chain cannot carry an emission the request is refused with 409,
naming the first missing prerequisite and the command that clears it; "force": true transmits
anyway, on an unconditioned chain.
From the CLI, which builds the request and always flushes:
stellarlinkctl tx send --protocol csp --src 10 --dst 1 --hex 01020304
stellarlinkctl tx send --file payload.bin --framing slot --slot-len 256Sustained feed: ws://<unit>:8080/ws/tx#
For continuous traffic, keep one WebSocket open rather than issuing one HTTP request per packet. The first message fixes the framing for the session:
{"framing": {"mode": "slot", "slot_len": 256}}{"type": "ready", "framing": {"mode": "slot", "slot_len": 256},
"boundaries_preserved": true, "block_useful_bytes": 4096}Then push as often as you like:
{"packets": [{"protocol": "raw", "payload_hex": "01020304"}]}{"type": "queued", "packets": 1, "useful_bytes": 256}A malformed packet is answered {"type": "rejected", "reason": "…"} and the socket stays open.
The ZeroMQ PUSH socket of the link service is the other way to feed the modem continuously.
Receiving#
Real time: ws://<unit>:8080/ws/frames#
/ws/frames?framing=slot&slot_len=256&payload=true| Parameter | Meaning |
|---|---|
framing | slot to parse slots, stream (default) to receive whole blocks |
slot_len | Slot length for slot |
payload | Include the payload as hex (off by default: it doubles the volume) |
Messages:
type | When |
|---|---|
packet | One recovered packet per slot (slot, len, payload) |
fill | A padding slot; never reported as a zero-length packet |
unparsed | A slot whose length prefix does not fit; reported, not dropped |
block | Stream mode: one received block, 4096 bytes |
lagged | The subscriber fell behind by blocks blocks |
Polling: GET /api/v1/frames#
Returns a page from a ring of recently received blocks:
{"granularity": "dma_block", "clock": "boot_relative", "empty_reason": null, "frames": [ ... ]}Each entry is one received block, not one protocol frame. Times are relative to the unit's start.
When the page is empty, empty_reason says whether the link carried nothing or nothing was
reading the modem. There is no per-frame FEC or CRC verdict here: fec_status and crc_ok stay
"none"/null (the link service reports frame quality when
transfer frames are configured). DELETE /api/v1/frames clears the ring.
Capture and loopback measurements#
Three routes measure the link at the byte level. They claim the datapath themselves.
| Route | CLI | What it does |
|---|---|---|
POST /api/v1/datapath/capture | stellarlinkctl capture -o rx.bin --blocks 4 | Returns the raw received blocks, concatenated |
POST /api/v1/datapath/loopback | stellarlinkctl loopback --payload p.bin --blocks 4 | Feeds a payload while capturing, returns the capture |
POST /api/v1/datapath/measure | — | Loopback plus comparison, returns per-block match counts |
Captures and loopback payloads use the modem's raw block format, in which each payload byte
occupies a 4-byte word; use stellarlinkctl loopback and stellarlinkctl compare rather than
comparing such files by hand.
Parameters common to all three:
| Parameter | Default | Meaning |
|---|---|---|
blocks | 4 | Blocks to collect in a row. Getting them proves a sustained link; a short capture fails (504) rather than being truncated |
warmup | 0 | Blocks to obtain and discard first. Every capture re-arms the chain, so the first block can carry an acquisition transient. Zero by default, so errors at the head of a capture are never discarded silently |
timeout_ms | 30000 | Give up after this long |
release / --keep | release | Release the datapath afterwards |
stellarlinkctl loopback compares the capture with the payload and prints a verdict
(BytePerfect, Degraded, …). stellarlinkctl compare capture.bin payload.bin does the same offline
on the host. See Measurement Tools for how to read the result.