code wiki / (root) / nx_mdns_test.nx

nx_mdns_test.nx

buildroot/runtime/nx_mdns_test.nx

5484 B118 linesdepth 2pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_mdns_test.nx -- offline gate for the mDNS / DNS-SD printer-discovery parser (nx_mdns). Hand-builds a realistic mDNS `_ipp._tcp` response -- PTR + SRV + TXT + A, with NAME-COMPRESSION POINTERS on the SRV/TXT/A owner names (exactly what real printers emit) -- then proves nx_mdns extracts the printer tuple. Unique exit codes per invariant: 1-10 extract port=631 (SRV) + IPv4 192.168.8.127 (A) + TXT rp=ipp/print, through compression pointers 20-24 query builder emits a well-formed _ipp._tcp.local PTR question 30-31 truncated response -> sealed MALFORMED (NEVER a silent success) 40 absent record type -> NOT_FOUND (no false hit) expect_exit: 0 ; license_tier: ORIGINAL ; genealogy_id: project-printer-management-ipp-sclass-2026-06-20

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_dns.nx nx_mdns.nx nx_mdns_test.nx

imports: nx_syscalls.nxnx_dns.nxnx_mdns.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap ap_u16 nx_dns_put_u16_be ap_label ap_byte ap_raw nx_mdns_extract_printer nx_mdns_find_rr nx_dns_get_u16_be nx_dns_skip_name nx_mdns_srv_port nx_dns_get_u16_be ↻ nx_mdns_a_ip nx_mdns_txt_get nx_mdns_build_ipp_query nx_dns_build_query nx_dns_put_u16_be ↻ nx_dns_encode_name nx_dns_get_u16_be ↻ nx_mdns_verdict_is_valid nx_mdns_find_rr ↻ t_puts sys_write

structs

none

consts

none

functions

16func t_puts(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
18func ap_u16(b: *u8, o: i64, v: i64) -> i64 { return nx_dns_put_u16_be(b, o, v) }
called by 1: main calls 1: nx_dns_put_u16_be
19func ap_byte(b: *u8, o: i64, v: i64) -> i64 { b[o] = v as u8; return o + 1 }
called by 1: main
20func ap_label(b: *u8, o: i64, s: *u8, slen: i64) -> i64
called by 1: main
26func ap_raw(b: *u8, o: i64, s: *u8, slen: i64) -> i64
called by 1: main
32func main() -> i64