code wiki / (root) / nx_telemetry.nx

nx_telemetry.nx

buildroot/runtime/nx_telemetry.nx

10854 B212 linesdepth 9pulls 12 transitivereach 4 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_telemetry.nx -- CONSENT-GATED DEVICE TELEMETRY (X-DRV-F1). A spore that has brought up its hardware (X-DRV-W2) can CHOOSE to contribute its device learnings (device-id + working driver-spec + bring-up status) to the federated registry -- but ONLY by explicit opt-in. The CARDINAL property: DEFAULT = LOCAL-ONLY. Nothing leaves the device unless a consent row says SHARED; sharing is per-device-class and REVOCABLE (flip back to LOCAL and the next run shares nothing new). Shared payloads are GENUINELY ed25519-SIGNED with the node's identity key (composing nx_ed25519_signature -- DRY), carrying the node public key as provenance so the federated side can verify authenticity. Privacy-first, sovereign. nx_telemetry [consent_path] [devmap_path] consent_path : telemetry_consent.tsv (deviceid<TAB>LOCAL|SHARED; ABSENT row = LOCAL-ONLY) devmap_path : emu_devmap.tsv (the probed devices) node key : knowledge/registry/node_ed25519_seed.bin (32-byte node identity priv key) LOCAL records -> knowledge/status/telemetry_local.log (retained on-device, NEVER shared) SHARED records -> knowledge/status/telemetry_shared.log (opt-in only; signed + pubkey) Sovereign (syscalls + the ed25519 organ), no gcc/.sh. license_tier: ORIGINAL

dependencies 2 imports · 4 importers

nx_syscalls.nx nx_ed25519_signature.nx nx_telemetry.nx _obd_pipeline_smoke.nx nx_modbus_pred_maint_pipeline.nx nx_mqtt_sink_for_telemetry.nx nx_pred_maint_consumer.nx

imports: nx_syscalls.nxnx_ed25519_signature.nx

imported by: _obd_pipeline_smoke.nxnx_modbus_pred_maint_pipeline.nxnx_mqtt_sink_for_telemetry.nxnx_pred_maint_consumer.nx

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

main tm_p sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_exit ed25519_pub_from_priv sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 rotr64_v shr64_v sha512_gamma1 rotr64_v ↻ shr64_v ↻ sha512_sigma1 rotr64_v ↻ sha512_ch sha512_k sha512_sigma0 rotr64_v ↻ sha512_maj sha512_final sha512_blk_set_byte ↻ sha512_compress ↻ ge_p3_alloc

structs

none

consts

20const TM_MAGIC_65536: i64 = 65536
21const TM_MAGIC_1024: i64 = 1024
23const TM_REG: *u8 = "knowledge/registry/driver_registry.tsv"
24const TM_SEED: *u8 = "knowledge/registry/node_ed25519_seed.bin"
25const TM_LOCALLOG: *u8 = "knowledge/status/telemetry_local.log"
26const TM_SHAREDLOG:*u8 = "knowledge/status/telemetry_shared.log"

functions

28func tm_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
29func tm_fp(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
30func tm_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;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: tm_n calls 2: sys_mmapsys_write
31func tm_n(v: i64) -> i64 { tm_fn(1, v); return 0 }
called by 1: main calls 1: tm_fn
33func tm_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
43func tm_parse_num(buf: *u8, p: i64, le: i64) -> i64
58func tm_field(buf: *u8, ls: i64, le: i64, idx: i64) -> i64
66func tm_copy_field(buf: *u8, s: i64, le: i64, out: *u8) -> i64
called by 1: tm_reg_spec
74func tm_reg_spec(reg: *u8, rn: i64, did: i64, out: *u8) -> i64
116func tm_hex(src: *u8, n: i64, dst: *u8) -> i64
called by 1: main
131func tm_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: main
132func tm_catn(dst: *u8, off: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; var k: i64=0; if m==0{t[0]=48;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{dst[off+i]=t[k-1-i];i=i+1}; return off+k }
called by 1: main calls 1: sys_mmap
134func main(argc: i64, argv: *i64) -> i64