code wiki / _hdl_build / nx_email_mx_gate.nx

nx_email_mx_gate.nx

buildroot/runtime/_hdl_build/nx_email_mx_gate.nx

9564 B228 linesdepth 2pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic email
docsdependenciesstructsconstsfunctions

about

nx_email_mx_gate.nx -- GATE for EMAIL R0 (MX resolution, nx_email_mx). Drives the REAL nx_email_mx parser over hand-crafted DNS response packets (no network, fully deterministic) and asserts: COMPLETENESS : a 2-record MX response (both exchanges using RFC 1035 compression pointers back to the question name) parses to count=2 with correct preferences and materialised exchange hostnames; sort orders them lowest-preference-first (the connect order). NEG-CONTROL : a clean response whose only answer is an A record (not MX) returns NO_MX -- the parser does not hallucinate a mail host. TAMPER txid : the SAME valid MX packet parsed against a wrong expected tx_id returns TXID_MISMATCH (off-path spoof gate: a forged response cannot redirect mail). TAMPER ptrloop: an exchange name that is a self-referential compression pointer returns PTR_LOOP and the gate COMPLETES (bounded chase, no hang / no OOM). Evidence -> knowledge/status/email_mx.log (EMAILMXGATE authored=organ ... verdict=GREEN) license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_email_mx.nx nx_syscalls.nx nx_email_mx_gate.nx

imports: nx_email_mx.nxnx_syscalls.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 build_mx_response pu16 build_question_example_com pu16 ↻ nx_email_mx_parse nx_dns_get_u16_be nx_dns_skip_name emx_decode_name streq nx_email_mx_sort build_a_only_response pu16 ↻ build_question_example_com ↻ build_ptrloop_response pu16 ↻ ew sys_write ewn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close

structs

none

consts

27const EMX_LOG: *u8 = "knowledge/status/email_mx.log"

functions

29func ew(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 ewn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
40func pu16(p: *u8, off: i64, v: i64) -> i64
46func streq(a: *u8, b: *u8) -> i64
called by 1: main
58func build_question_example_com(p: *u8) -> i64
73func build_mx_response(p: *u8) -> i64
called by 1: main calls 2: pu16build_question_example_com
103func build_a_only_response(p: *u8) -> i64
called by 1: main calls 2: pu16build_question_example_com
121func build_ptrloop_response(p: *u8) -> i64
called by 1: main calls 1: pu16
144func main() -> i64