Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / cast / protocol / AGENTS.md

AGENTS.md2.3 KiBRenderedCodeRaw
1# AGENTS.md — cast/protocol/ (':cast:protocol')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `cast/protocol/` + allowed shared modules. Do not root-scan.
4
5<!-- last-reviewed: 2026-10-16 -->
6- Gradle: :cast:protocol / dir: cast/protocol/
7- Package roots present: (pure-Kotlin protocol library — single package, no Android roots)
8- Entry files: HandshakeMessages.kt + Pairing.kt (no MainActivity/Route — library)
9- Deps: :library:e2ee-p2p
10- Metadata: metadata_data/cast-protocol.md (absent — libraries have none by design)
11- Rust: no / screenshotTest: no
12
13## Overview
14**Purpose:** Pure-Kotlin cast wire protocol shared by the `cast/` sender and `cast/tv` receiver — pairing, E2EE handshake, control framing, RTP media. No Android, no UI.
15**Covers:** Pairing + handshake messages, ephemeral-TLS key schedule, secret sealing, control framing + frame assembly, streaming sessions + receiver sessions, RTP packetize/depacketize + RTCP, media proxy, codec negotiation, stream multiplexing.
16**Entry points + reading order:** `Pairing.kt` → `HandshakeMessages.kt` → `KeySchedule.kt` → `StreamingSession.kt` → `RtpPacketizer.kt`/`RtpDepacketizer.kt`.
17**Gotchas:**
18- Sender and receiver must upgrade in lockstep — wire changes touch `cast/` + `cast/tv` together
19- Crypto changes need adversarial review; test against the recorded handshake vectors if present
20
21## Key files
22### Pairing + handshake + crypto
23- com/vayunmathur/cast/protocol/Pairing.kt
24- com/vayunmathur/cast/protocol/HandshakeMessages.kt
25- com/vayunmathur/cast/protocol/EphemeralTls.kt
26- com/vayunmathur/cast/protocol/KeySchedule.kt
27- com/vayunmathur/cast/protocol/Crypto.kt
28- com/vayunmathur/cast/protocol/SecretSealing.kt
29### Framing + sessions
30- com/vayunmathur/cast/protocol/ControlFraming.kt
31- com/vayunmathur/cast/protocol/FrameAssembler.kt
32- com/vayunmathur/cast/protocol/FrameId.kt
33- com/vayunmathur/cast/protocol/StreamingSession.kt
34- com/vayunmathur/cast/protocol/ReceiverSession.kt
35- com/vayunmathur/cast/protocol/Streams.kt
36### Media transport
37- com/vayunmathur/cast/protocol/RtpPacketizer.kt
38- com/vayunmathur/cast/protocol/RtpDepacketizer.kt
39- com/vayunmathur/cast/protocol/Rtcp.kt
40- com/vayunmathur/cast/protocol/MediaProxy.kt
41- com/vayunmathur/cast/protocol/CodecNegotiation.kt
42
43## Verify (this module only)
44```
45./gradlew :cast:protocol:compileDevKotlin
46./gradlew :cast:protocol:lint
47```