code wiki / _hdl_build / nx_room_fec_wire.nx

nx_room_fec_wire.nx

buildroot/runtime/_hdl_build/nx_room_fec_wire.nx

8887 B158 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind tooltopic room
docsdependenciesstructsconstsfunctions

about

nx_room_fec_wire.nx -- R1: the FRAME-LEVEL FEC wire protocol that makes the measured loss-resilience (nx_room_resilience) REAL on the relay. A media frame is sharded into k data + m parity packets (each with a 16-byte wire header); the receiver reconstructs the ENTIRE frame byte-exact from any k surviving shards (<=m losses). This is the shippable bridge: the abstract block accounting in nx_room_resilience is here proven on real frame BYTES through encode -> packetize -> lose -> recover -> byte-exact compare. Reuses the proven RS GF(256) codec from nx_room_fec.nx (no reimpl). WIRE HEADER (16B): [block_id u32][shard_idx u8][is_parity u8][k u8][m u8][frame_len u32][rsv u32] The relay forwards shards opaquely (content-blind); only the endpoints encode/decode. HONEST SCOPE: this proves the protocol + recovery. Wiring it into nx_vroom_daemon's vd_stream + the browser client, and DEPLOYING to the live family link, is the operator-gated follow-on (touches live family video -- coordinate, never hot-patch). main() is the SELF-VALIDATING GATE. Evidence -> knowledge/status/room_fec_wire.log. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_room_fec.nx nx_room_fec_wire.nx nx_room_fec_relay.nx

imports: nx_syscalls.nxnx_room_fec.nx

imported by: nx_room_fec_relay.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap gf_init fec_build_G gf_inv fwire_encode fec_encode gf_mul fwire_decode fec_decode sys_mmap ↻ gf_solve gf_inv ↻ gf_mul ↻ frame_eq fwire_exhaustive2 fwire_decode ↻ frame_eq ↻ fwh_pack fwh_idx fwh_parity fwh_fl fw sys_write fwn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close sys_exit

structs

none

consts

19const FW_MAGIC_12345: i64 = 12345
21const FW_LOG: *u8 = "knowledge/status/room_fec_wire.log"

functions

23func fw(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
24func fwn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
27func fwh_pack(buf: *u8, block_id: i64, idx: i64, is_parity: i64, k: i64, m: i64, fl: i64) -> i64
called by 1: main
34func fwh_idx(buf: *u8) -> i64 { return buf[4] as i64 }
called by 1: main
35func fwh_parity(buf: *u8) -> i64 { return buf[5] as i64 }
called by 1: main
36func fwh_fl(buf: *u8) -> i64 { var v: i64=0; var b: i64=0; while b<4 { v = v | ((buf[8+b] as i64)<<(b*8)); b=b+1 } return v }
called by 1: main
39func fwire_encode(exp: *i64, log: *i64, G: *i64, frame: *u8, fl: i64, k: i64, m: i64, S: i64, data: *i64, shards: *i64) -> i64
called by 2: mainmain calls 1: fec_encode
46func fwire_decode(exp: *i64, log: *i64, G: *i64, shards: *i64, present: *i64, k: i64, m: i64, S: i64, fl: i64, frame_out: *u8, erased: *i64, out: *i64) -> i64
55func frame_eq(a: *u8, b: *u8, fl: i64) -> i64 { var i: i64=0; while i < fl { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
58func fwire_exhaustive2(exp: *i64, log: *i64, G: *i64, shards: *i64, frame: *u8, k: i64, m: i64, S: i64, fl: i64, present: *i64, erased: *i64, out: *i64, fout: *u8) -> i64
called by 1: main calls 2: fwire_decodeframe_eq
76func main() -> i64