code wiki / _hdl_build / nx_vroom.nx
nx_vroom.nx
buildroot/runtime/_hdl_build/nx_vroom.nx
about
nx_vroom.nx -- the sovereign video-room request HANDLER (the daemon's brain),
kept separate from sockets/TLS so it is unit-gateable. Composes nx_room_relay
(per-room peer frames) into HTTP responses for the relay routes:
POST /video/post?room=R&id=N body=frame -> rr_post, "200 ok"
GET /video/frames?room=R&id=N -> octet body of OTHER peers'
frames as length-prefixed records: [id u64 LE][len u32 LE][frame bytes]*
GET /video/roster?room=R&id=N -> JSON [id,id,...]
Returns response length in `out`, or 0 if the route isn't a relay route (the
TLS/fork shell then serves the static page / client.wasm / 404).
Server-relay = ZERO WebRTC/STUN/TURN. All flag-style loops (no break/continue
in nested ifs -- that miscompiles and hangs, per the sites-daemon note).
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_room_relay.nx
imported by: nx_vroom_daemon.nxnx_vroom_gate.nx
structs
| none |
consts
| 14 | const K_MAGIC_2166136261: i64 = 2166136261 |
| 15 | const K_MAGIC_16777619: i64 = 16777619 |
functions
| 17 | func vr_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 18 | func vr_lower(c: u8) -> u8 { if c >= (65 as u8) { if c <= (90 as u8) { return c + (32 as u8) } } return c } |
| 20 | func vr_contains(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64 |
| 35 | func vr_body_start(hay: *u8, hlen: i64) -> i64 |
| 44 | func vr_content_length(req: *u8, reqn: i64) -> i64 |
| 73 | func vr_room_hash(req: *u8, reqn: i64) -> i64 |
| 104 | func vr_id(req: *u8, reqn: i64) -> i64 |
| 131 | func vr_app(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var i: i64=0; while i<n { dst[off+i]=src[i]; i=i+1 } return off+n } |
| 132 | func vr_apps(dst: *u8, off: i64, s: *u8) -> i64 { return vr_app(dst, off, s, vr_strlen(s)) } |
| 133 | func vr_wu64(dst: *u8, off: i64, v: i64) -> i64 { var i: i64=0; while i<8 { dst[off+i]=((v >> (i*8)) & 0xff) as u8; i=i+1 } return off+8 } |
| 134 | func vr_wu32(dst: *u8, off: i64, v: i64) -> i64 { var i: i64=0; while i<4 { dst[off+i]=((v >> (i*8)) & 0xff) as u8; i=i+1 } return off+4 } |
| 135 | func vr_wdec(dst: *u8, off: i64, v: i64) -> i64 called by 1: vr_handle |
| 145 | func vr_handle(plain: *u8, plain_n: i64, rr_st: *i64, rr_arena: *u8, now: i64, ttl: i64, |