[repo] Docs: the accepting side of ENet and the control host (PROTOCOL.md 3.1, 3.3); S-34 stock ENet host-side functions
This commit is contained in:
@@ -340,6 +340,38 @@ UNKNOWN U9 (narrowed): anything Sunshine's ENet sends that stock 1.3 does not; t
|
||||
data` a client offers; whether the client sets non-default ping or timeout values. Settle: the lab capture's control
|
||||
port datagrams, decoded with our parser (LAB_CAPTURE.md). Until then our client offers stock defaults.
|
||||
|
||||
**The accepting side, as stock ENet 1.3 does it** [E] (S-17, S-34; DomiStream `enet::host`, the Lumen host):
|
||||
- A datagram addressed to `0xFFF` is looked at only for a CONNECT at its start; anything else in it is ignored. A
|
||||
CONNECT asking for 0 or more than 255 channels is refused. A CONNECT repeated by a client whose connection already
|
||||
exists (same address, same connect id) is ignored: no second peer, no acknowledgement.
|
||||
- The CONNECT is **not acknowledged**; the host answers with a reliable VERIFY CONNECT on channel `0xFF` (the
|
||||
connection channel's first reliable sequence number, 1), and the verify retires the client's connect.
|
||||
- Session ids: the host's outgoing id is the client's offered *incoming* id (or, for `0xFF`, the slot's previous
|
||||
outgoing id) plus one, modulo 4, bumped once more if it equals the slot's previous outgoing id; the host's
|
||||
incoming id likewise from the client's offered *outgoing* id. A fresh slot has `0xFF` for both, so a client offering
|
||||
`0xFF`/`0xFF` gets 0/0. The verify carries `incoming session = the host's outgoing` and `outgoing session = the
|
||||
host's incoming`, i.e. both fields from the client's point of view; a sender puts its outgoing id in the header
|
||||
(only once the remote peer id is known), a receiver drops datagrams whose id is not its incoming id.
|
||||
- Verify fields: `outgoing peer id` = the host's own peer id (the client addresses it from then on); MTU = the
|
||||
client's clamped to 576-4096, then at most the host's; window = the client's, at most 65536 when the host's
|
||||
bandwidth is unlimited, clamped to 4096-65536; channel count = the client's, at most the host's channel limit;
|
||||
bandwidths = the host's own (0 = unlimited); throttle interval, acceleration and deceleration echoed; connect id
|
||||
echoed. The connect's `data` word is what the host's connect event reports.
|
||||
- The peer is connected when the client **acknowledges the verify**. Before that, data, pings and bandwidth or
|
||||
throttle commands from the client are not taken and not acknowledged (the client sends them again).
|
||||
- Acknowledgements: a command with the acknowledge flag is acknowledged only while connected, echoing the datagram's
|
||||
sent time; in a datagram **without** sent time such a command is handled but not acknowledged and the rest of the
|
||||
datagram is skipped. A failing command also ends the datagram.
|
||||
- Disconnect from the client while connected: acknowledged (if flagged), the connection closes with the client's
|
||||
data word. Ping, bandwidth limit and throttle configure need the connected state.
|
||||
- Unsequenced duplicates are dropped with a window of 1024 groups; groups up to 32 windows ahead move the window,
|
||||
older or farther ones are dropped.
|
||||
- The host pings a connected peer when nothing was **received** from it for the ping interval (500 ms by default)
|
||||
and no reliable command is in flight.
|
||||
|
||||
Not in DomiStream's host: the checksum and compression (see above), throttling what it sends by bandwidth, and
|
||||
unreliable fragments (dropped: every control message is small and reliable).
|
||||
|
||||
### 3.2 Encrypted frame
|
||||
|
||||
Every control message is wrapped [W4] (little-endian):
|
||||
@@ -392,6 +424,17 @@ does not match, **ends the session** when it arrives outside the encrypted frame
|
||||
message is skipped, and so is a frame that fails decryption. Whether Sunshine reads bodies (and which) is what U10
|
||||
still settles live: the probe sends empty bodies first ([LIVE-INTEROP.md](LIVE-INTEROP.md), table V).
|
||||
|
||||
How DomiStream's host side reads the client (`control::host`, for Lumen; ours, on [M] above): frames open with the
|
||||
client-to-host nonce; a frame that fails, or whose sequence number is not above the last accepted one, is dropped
|
||||
without moving the replay state (U11: the first number is not checked); a malformed message inside a good frame is
|
||||
skipped. Bodies of START_B, PERIODIC_PING and the IDR request are ignored, LOSS_STATS and FRAME_STATS are kept raw,
|
||||
INVALIDATE_REF_FRAMES reads `first`/`last` with missing bytes as 0, INPUT_DATA goes through section 4 (a layout we
|
||||
cannot read is reported, not fatal), every other type (START_A among them) is skipped. Only control V2 is spoken: a
|
||||
bare message outside the frame is dropped. Host messages: rumble, trigger rumble, motion event, RGB LED and the
|
||||
extended termination are sent, reliable on channel 0, numbered from 0; the plain TERMINATION (body U10) and
|
||||
HDR_MODE (`[M*]`) are refused until measured. Each PERIODIC_PING moves the stop deadline (default 60 s) out; when it
|
||||
passes, the host reports it once and the caller ends the session.
|
||||
|
||||
---
|
||||
|
||||
## 4. Input and gamepad packets
|
||||
|
||||
Reference in New Issue
Block a user