Reassembly
When packets arrive out of order or messages span multiple packets, the receiver must buffer, reorder, and reassemble them. SRSPP provides three receiver backends that trade off memory usage, insertion speed, and delivery cost.
Comparison
| Fast | Lite | Packed | |
|---|---|---|---|
| Out-of-order insert | O(1) | O(WIN) | O(1) |
| Delivery | O(1) advance | O(REASM) shift | O(MSG) copy |
| Per-segment storage | MTU (fixed) | MTU (fixed) | Actual payload size |
| Static memory | WIN × MTU + REASM | REASM | BUF + REASM |
| Best for | High throughput | Memory-constrained | Variable-size payloads |
Fast
Every window slot reserves the full MTU size, regardless of how large the actual payload is. Insertion is O(1) — compute the slot index as seq % WIN and write. Delivery is O(1) per packet — walk consecutive occupied slots and copy to the reassembly buffer.
The tradeoff: wastes memory when payloads are smaller than the MTU.
Lite
Uses a single shared buffer for both reordering and reassembly. Segments are placed at computed byte offsets. A gap tracker records which byte ranges are filled and which are still missing.
The tradeoff: delivery requires shifting the entire buffer left when a message is consumed — O(REASM) bytes moved. But memory usage is minimal: only the REASM buffer plus gap metadata.
Packed
Like Fast, uses a bitset and slot indices for O(1) insertion. But instead of reserving MTU bytes per slot, payloads are appended to a bump allocator (append-only slab). Each slot stores only a metadata record (offset + length into the slab).
The tradeoff: no wasted space per slot (payloads packed tightly), but delivery requires copying from the slab to the reassembly buffer — O(message size).
Choosing a Backend
- Fast — use when throughput matters most and memory is available. Typical for ground stations or satellites with sufficient RAM.
- Lite — use on the most memory-constrained satellites where every byte counts. Accepts slower delivery in exchange for the smallest possible footprint.
- Packed — use when payload sizes vary significantly (some packets carry 50 bytes, others carry 500). Avoids the wasted space of Fast without the delivery cost of Lite.
All three backends produce identical output — the choice is purely a resource tradeoff. The application does not need to know which backend the receiver uses.