nx_telemetry.nx
buildroot/runtime/nx_telemetry.nx
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
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
structs
| none |
consts
| 20 | const TM_MAGIC_65536: i64 = 65536 |
| 21 | const TM_MAGIC_1024: i64 = 1024 |
| 23 | const TM_REG: *u8 = "knowledge/registry/driver_registry.tsv" |
| 24 | const TM_SEED: *u8 = "knowledge/registry/node_ed25519_seed.bin" |
| 25 | const TM_LOCALLOG: *u8 = "knowledge/status/telemetry_local.log" |
| 26 | const TM_SHAREDLOG:*u8 = "knowledge/status/telemetry_shared.log" |
functions
| 28 | func 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 } |
| 29 | func 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 } |
| 30 | func 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 } |
| 31 | func tm_n(v: i64) -> i64 { tm_fn(1, v); return 0 } |
| 33 | func tm_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 43 | func tm_parse_num(buf: *u8, p: i64, le: i64) -> i64 |
| 58 | func tm_field(buf: *u8, ls: i64, le: i64, idx: i64) -> i64 |
| 66 | func tm_copy_field(buf: *u8, s: i64, le: i64, out: *u8) -> i64 called by 1: tm_reg_spec |
| 74 | func tm_reg_spec(reg: *u8, rn: i64, did: i64, out: *u8) -> i64 |
| 93 | func tm_consent(con: *u8, cn: i64, did: i64) -> i64 |
| 116 | func tm_hex(src: *u8, n: i64, dst: *u8) -> i64 called by 1: main |
| 131 | func 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 |
| 132 | func 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 } |
| 134 | func main(argc: i64, argv: *i64) -> i64 |