code wiki / _hdl_build / nx_smtp_client_gate.nx

nx_smtp_client_gate.nx

buildroot/runtime/_hdl_build/nx_smtp_client_gate.nx

10410 B220 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic smtp
docsdependenciesstructsconstsfunctions

about

nx_smtp_client_gate.nx -- GATE for EMAIL R1 (SMTP client, nx_smtp_client). Drives the REAL nx_smtp_client codec + state machine over scripted transcripts (no network, fully deterministic) and asserts: COMPLETENESS : multiline 250 reply parses to code=250/complete=1; 220 greeting + 354 data-go parse; EHLO/MAIL/RCPT/ QUIT/DATA builders emit exact CRLF-framed bytes; dot-stuffing turns a lone "." line into ".." and terminates with <CRLF>.<CRLF>; the state machine walks the full happy path to DONE. NEG-CONTROL : a 550 at RCPT routes the state machine to ABORT/FAIL (no DATA is ever sent to a rejected recipient). TAMPER reply : a continuation line whose code differs from the first line -> CODE_MISMATCH; a non-digit code -> BAD_CODE; a continuation with no final line -> parsed but complete=0 (not treated as a finished reply -- streaming/forgery safe). TAMPER inject: the dot-stuffed body contains the "<CRLF>.<CRLF>" terminator EXACTLY ONCE, at the very end -- a lone "." line cannot prematurely terminate DATA (SMTP injection / truncation defense, RFC 5321 ยง4.5.2). Evidence -> knowledge/status/smtp_client.log (SMTPCLIENTGATE authored=organ ... verdict=GREEN) license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_smtp_client.nx nx_syscalls.nx nx_gate_verdict.nx nx_smtp_client_gate.nx

imports: nx_smtp_client.nxnx_syscalls.nxnx_gate_verdict.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 slen nx_smtp_parse_reply first_code_or_badline smtp_is_digit nx_smtp_build_ehlo sm_cat sm_catn memeq nx_smtp_build_mail_from sm_cat ↻ sm_catn ↻ nx_smtp_build_rcpt_to sm_cat ↻ sm_catn ↻ nx_smtp_build_simple sm_cat ↻ nx_smtp_dot_stuff count_sub find_sub nx_smtp_advance smtp_is_2xx ew sys_write ewn sys_mmap ↻ sys_write ↻ nx_smtp_action_name sys_openat_append sys_close gv_ctr sys_mmap ↻ gv_verdict gv_puts sys_write ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap

structs

none

consts

31const SMTP_LOG: *u8 = "knowledge/status/smtp_client.log"

functions

33func 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
34func ewn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
44func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
45func memeq(a: *u8, b: *u8, len: i64) -> i64 { var i: i64 = 0; while i < len { if a[i] != b[i] { return 0 } i = i + 1 } return 1 }
called by 1: main
46func find_sub(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64
called by 1: main
57func count_sub(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64
called by 1: main
69func main() -> i64