Commit Graph

33 Commits

Author SHA1 Message Date
mnovak c06fec4be5 [domistream] ENet: test that the client takes the verify's session ids as stock ENet does (fails: they are swapped)
A host that answers VERIFY_CONNECT with different incoming and outgoing session ids (stock ENet after a reconnect, PROTOCOL.md 3.1) must see the client send with the verify's outgoing id and accept datagrams carrying the verify's incoming id.
2026-12-04 13:28:50 +01:00
mnovak 989defcc88 [domistream] Host pairing: the host's state machine (pending-PIN slot, proof and signature checks, deadlines from the caller, trusted clients without a PIN) 2026-12-04 12:48:25 +01:00
mnovak 3106f2cb46 [domistream] Host HTTP: strict request head and query parsing into typed routes, XML answers the client parsers accept (head-end test corrected: a 64 KiB buffer without the empty line is already over the cap) 2026-12-04 12:48:25 +01:00
mnovak bdd867c521 [domistream] Host pairing: tests first (client and host paired in memory, wrong PIN on both sides, order, timeouts, trusted clients) 2026-12-04 12:48:25 +01:00
mnovak 3aa3775de8 [domistream] Host HTTP: tests first (request head and query parsing, caps, XML answers read back by the client parsers); API stubs return Unimplemented 2026-12-04 12:48:25 +01:00
mnovak e082570a3f [domistream] Control host: ControlHost (client frames opened with replay refusal, typed client messages, host messages, stop deadline)
parse_client_message types START_B, PERIODIC_PING, INPUT_DATA (through input::parse_input), IDR, INVALIDATE_REF_FRAMES, LOSS_STATS and FRAME_STATS (raw bodies) and skips anything else as Unknown. encode_host_message sends rumble, trigger rumble, motion, RGB LED and the extended termination; the plain termination (U10) and HDR_MODE (GPL-provenance layout) stay Unsupported. StopDeadline ends a session without PERIODIC_PING (default 60 s).
2026-12-04 12:46:39 +01:00
mnovak f8bad73121 [domistream] ENet host: EnetHostPeer, the accepting side (verify connect, session ids, reliable channels, pings, timeouts, disconnect)
One peer per client address. CONNECT answered with a reliable VERIFY CONNECT as stock ENet 1.3 does it (session ids picked from the client's offer, MTU, window and channels clamped, throttle echoed); connected once the client acknowledges the verify; reliable, unreliable and unsequenced delivery with fragment reassembly under the existing caps; duplicate unsequenced groups dropped; pings when the client is quiet; retransmission and timeout as the client; disconnect both ways. Shares the client's channel, fragment and in-flight types.
2026-12-04 12:46:39 +01:00
mnovak 58910d00fa [domistream] Control host: tests first (ControlStream against ControlHost, replay, stop deadline), API stubs
Input arrives typed and byte-identical to what the client encoded; host rumble, trigger rumble, LED, motion and termination reach the client; replays, forgeries and malformed messages are dropped; the stop deadline ends a session without PERIODIC_PING. Alloc caps for the host parsers. They fail against the stubs.
2026-12-04 12:46:39 +01:00
mnovak e77c5fcd83 [domistream] ENet host: tests first (client against host over an in-memory lossy wire), API stubs
EnetHostPeer is the accepting side, one peer per client address. The tests drive our EnetClient against it with simulated time, loss, duplication and reordering, plus a scripted client for the stock ENet 1.3 facts (verify connect fields, session ids, what is acknowledged when). They fail against the stubs.
2026-12-04 12:46:39 +01:00
mnovak a86a689b1f [domistream] RTSP server: session state machine, DESCRIBE writer, strict ANNOUNCE parser, response encoder and request framer; test fixes (escaped CRLF in alloc_caps, CSeq test state, clippy) 2026-12-04 12:44:49 +01:00
mnovak 54bc9f5faf [domistream] RTSP server: tests first (in-memory client/server session, order, Session, ANNOUNCE parser, DESCRIBE writer, caps); API stubs return Unimplemented 2026-12-04 12:44:40 +01:00
mnovak 0d3a9a7917 [domistream] Audio packetizer: RTP datagram per Opus packet, AES-128-CBC (AudioCipher::encrypt), no parity until U16; first sequence must start a block 2026-12-04 12:24:45 +01:00
mnovak b62443ef28 [domistream] Video packetizer: frame header, FEC blocks with Cauchy parity over whole packets, sequence numbers, optional AES-GCM sealing (VideoCipher::encrypt) 2026-12-04 12:24:40 +01:00
mnovak e1abd7d060 [domistream] Audio packetizer: tests first (round trips through AudioDepacketizer, wrap-around, caps, fixed vectors), API stubs 2026-12-04 12:20:55 +01:00
mnovak 7983833ba6 [domistream] Video packetizer: tests first (round trips through VideoDepacketizer, loss up to and beyond m, fixed vectors), API stubs 2026-12-04 12:20:55 +01:00
mnovak d62aa8f581 [domistream] Tests: closed XML depth bomb under the size cap
xml_depth_bomb_does_not_recurse: the closed half was 300 000 tag pairs
(2.1 MB), over MAX_XML_BYTES, so its `s.len() < MAX_XML_BYTES * 2` assert
failed and the depth check under it never ran (the protocol engineer was
right). Now 100 000 opens + 100 000 closes (about 0.7 MB): within the size
cap, it must be refused as TooLarge { max: MAX_XML_DEPTH }, without
recursion. The open-tags half is unchanged.
2026-11-26 03:53:14 +01:00
mnovak e67daea536 [domistream] Tests: properties cannot pass against Unimplemented
The never-panic properties (XML, RTSP, ENet, control, input, media) and the
allocation-cap checks only asserted inside `if let Ok`, so a stub returning
Unimplemented for everything passed them. Each now also requires the parser
to answer something other than Unimplemented (common::implemented); the XML
truncation property wants Malformed or Truncated, not any error.
2026-11-25 13:15:00 +01:00
mnovak 2740d3dd45 [domistream] Tests: first compile, clippy clean
Temporaries borrowed past their statement (control, media), clippy's
is_multiple_of, needless index loop and type complexity. input.rs: the
MOUSE_MOVE_ABS builder dropped the y field; the PROTOCOL.md cross-check would
have caught it at runtime.
2026-11-25 13:08:24 +01:00
mnovak b57e97a38b [domistream] Tests: fixtures from tools/vectors
Generated by tools/vectors/gen_vectors.py with Python hashlib, OpenSSL 3.5.7
(Git for Windows) and .NET 10 AesGcm. Keys and certificates are TEST-ONLY,
made fresh on this machine for these tests: RSA-2048 host, client and rogue
identities, and an EC certificate for the non-RSA refusal.
2026-11-25 13:08:24 +01:00
mnovak da1f3afd52 [domistream] Tests: rustfmt 2026-11-25 12:52:38 +01:00
mnovak 71e34e8d9d [domistream] Tests: allocation caps
A counting global allocator (peak_alloc) checks that small inputs with lying
length fields and arbitrary inputs never make a parser allocate past a bound
tied to the input and its caps; depacketizers and the ENet peer stay within
their in-flight caps.
2026-11-25 12:51:07 +01:00
mnovak 9c59b69bf0 [domistream] Tests: audio depacketizer with the parity-matrix hook
All 64 loss patterns of a 4+2 block with two different MDS matrices through
AudioFec::ParityMatrix (U16 unmeasured), encrypted and plain; FEC disabled;
sequence wrap; duplicates; reordering; far-past and far-future; hostile
parity; the loss timeout.
2026-11-25 12:51:06 +01:00
mnovak 240190041d [domistream] Tests: video depacketizer loss patterns
Generated multi-block frames with random, bursty, all-parity, all-data,
last-packet loss, reordering and duplicates; RTP sequence and frame index
wraps; far-past and far-future strays; recovered shard headers deliberately
garbage (bytes 0-31 untrusted); encryption with tampering. Frames are
byte-exact or reported in FrameLost, never corrupt.
2026-11-25 12:51:06 +01:00
mnovak f3ad3afe00 [domistream] Tests: Reed-Solomon erasure patterns
Every erasure pattern of size <= m for k 1..=8, m 1..=4 and the Wolf 4+2
example; k = 1..=255-m sweeps for m in 1,2,3,4,8,16,64,127,254; > m refused
with Truncated. with_parity_matrix checked byte-exact against an independent
GF(2^8) Cauchy construction and refused for non-MDS matrices.
2026-11-25 12:51:05 +01:00
mnovak ecc9908082 [domistream] Tests: media packet parsers and ciphers
RTP header, video packet and frame header, audio packet at every size
boundary; inconsistent FEC fields; video AES-GCM against .NET vectors and
audio AES-CBC against openssl vectors, including rikeyid + seq wrap and bad
padding. The RustCrypto test oracles are checked against the same vectors.
2026-11-25 12:51:04 +01:00
mnovak fbfcd588a5 [domistream] Tests: input vectors from the field tables
INPUT_DATA built from PROTOCOL.md 4 field tables, cross-checked against its
example bytes; encode, parse, equal for every known type; unknown types,
UNKNOWN-layout types, wrong lengths, lying length and size fields, changed
constants and out-of-range values refused.
2026-11-25 12:51:04 +01:00
mnovak fea864d16e [domistream] Tests: control frames, replay and messages
Nonce layout (seq LE, 6 zero, direction, 'C'), seal against .NET AesGcm
vectors, every tampered byte, wrong direction and key, lying length fields.
ControlStream drops replayed, older, reflected and forged frames and refuses
seq 0 after u32::MAX. Host message layouts and client message encoding.
2026-11-25 12:51:03 +01:00
mnovak 38a455a717 [domistream] Tests: ENet codec and client peer
Byte vectors built from the PROTOCOL.md 3.1 field definitions, every command
size, truncation, compressed and unknown commands, 32/33 commands and
4096/4097 bytes. Client: handshake, reliable sequence past 0xFFFF -> 0,
duplicates, far-future and far-past, lying fragments, retransmission,
timeout and disconnect.
2026-11-25 12:51:03 +01:00
mnovak e4ca1509c8 [domistream] Tests: RTSP parsers, framer, SDP and client
Bad start lines, header floods, line cap, lying Content-Length (over, under,
past the cap, past u64), 64 KiB+1 in the framer, chunking invariance,
surround-params against RFC 7845, ANNOUNCE intersection, and the client state
machine with hostile answers.
2026-11-25 12:51:03 +01:00
mnovak d0fe9a906c [domistream] Tests: pairing state machine against recorded vectors
Walks every state with a recorded transcript (fixtures from tools/vectors).
Wrong PIN, wrong hash, wrong cert, rogue and flipped signatures, wrong sizes,
out-of-order, replayed and cross-session answers all end in Failed(reason);
Paired cannot be reached by skipping a step. Crypto helpers, certificates,
identities and the PIN against the same vectors.
2026-11-25 12:51:01 +01:00
mnovak b261d7ddc9 [domistream] Tests: hostile HTTP and XML input
XML reader, serverinfo, applist, launch and status answers: empty, 1 byte,
max-1, max, max+1, huge; depth bombs, element, attribute and text caps,
entities, DTD and billion laughs, namespaces. Request builders refuse bad ids
and query injection. proptest round trip of generated XML trees.
2026-11-25 12:51:01 +01:00
mnovak 9d94b66975 [domistream] Tests: sans-I/O guard and secret hygiene
Fails if src/ uses std::net, Instant::now, SystemTime::now, std::thread,
std::fs, processes, env reads or OS randomness (comments stripped, grouped
std imports caught). Checks forbid(unsafe_code) and that Debug never prints
rikey, the PIN or the private key.
2026-11-25 12:51:00 +01:00
mnovak 7326767f37 [domistream] Tests: vector generator and shared test helpers
tools/vectors/gen_vectors.py makes the crypto vectors with tools independent of
RustCrypto: Python hashlib (SHA-256), the OpenSSL 3.5 CLI (RSA-2048 test-only
keys, X.509 certs, PKCS#1 v1.5 SHA-256 signatures, AES-128-ECB -nopad,
AES-128-CBC) and .NET 10 AesGcm (gcm_vectors.cs). Output goes to
crates/domistream/tests/fixtures (text only); not generated in this commit.

tests/common: seeded and scripted RandomSource, fixture reader, an independent
GF(2^8)/0x11D reference with Cauchy matrices, and test hosts that packetize
video (PROTOCOL.md 5.2-5.3) and audio (6.2-6.4).

Dev-dependencies: proptest (std only, no fork/timeout) and peak_alloc (MIT,
counting allocator for the allocation-cap test).
2026-11-25 12:51:00 +01:00