Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / cast / protocol / AGENTS.md
| 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 | - Gradle: :cast:protocol / dir: cast/protocol/ |
| 6 | - Package roots present: (pure-Kotlin protocol library — single package, no Android roots) |
| 7 | - Entry files: HandshakeMessages.kt + Pairing.kt (no MainActivity/Route — library) |
| 8 | - Deps: :library:e2ee-p2p |
| 9 | - Metadata: metadata_data/cast-protocol.md (absent — libraries have none by design) |
| 10 | - Rust: no / screenshotTest: no |
| 11 | |
| 12 | ## Overview |
| 13 | **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. |
| 14 | **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. |
| 15 | **Entry points + reading order:** `Pairing.kt` → `HandshakeMessages.kt` → `KeySchedule.kt` → `StreamingSession.kt` → `RtpPacketizer.kt`/`RtpDepacketizer.kt`. |
| 16 | **Gotchas:** |
| 17 | - Sender and receiver must upgrade in lockstep — wire changes touch `cast/` + `cast/tv` together |
| 18 | - Crypto changes need adversarial review; test against the recorded handshake vectors if present |
| 19 | |
| 20 | ## Key files |
| 21 | ### Pairing + handshake + crypto |
| 22 | - com/vayunmathur/cast/protocol/Pairing.kt |
| 23 | - com/vayunmathur/cast/protocol/HandshakeMessages.kt |
| 24 | - com/vayunmathur/cast/protocol/EphemeralTls.kt |
| 25 | - com/vayunmathur/cast/protocol/KeySchedule.kt |
| 26 | - com/vayunmathur/cast/protocol/Crypto.kt |
| 27 | - com/vayunmathur/cast/protocol/SecretSealing.kt |
| 28 | ### Framing + sessions |
| 29 | - com/vayunmathur/cast/protocol/ControlFraming.kt |
| 30 | - com/vayunmathur/cast/protocol/FrameAssembler.kt |
| 31 | - com/vayunmathur/cast/protocol/FrameId.kt |
| 32 | - com/vayunmathur/cast/protocol/StreamingSession.kt |
| 33 | - com/vayunmathur/cast/protocol/ReceiverSession.kt |
| 34 | - com/vayunmathur/cast/protocol/Streams.kt |
| 35 | ### Media transport |
| 36 | - com/vayunmathur/cast/protocol/RtpPacketizer.kt |
| 37 | - com/vayunmathur/cast/protocol/RtpDepacketizer.kt |
| 38 | - com/vayunmathur/cast/protocol/Rtcp.kt |
| 39 | - com/vayunmathur/cast/protocol/MediaProxy.kt |
| 40 | - com/vayunmathur/cast/protocol/CodecNegotiation.kt |
| 41 | |
| 42 | ## Verify (this module only) |
| 43 | ``` |
| 44 | ./gradlew :cast:protocol:compileDevKotlin |
| 45 | ./gradlew :cast:protocol:lint |
| 46 | ``` |