code wiki / _hdl_build / nx_hr_visitor_log_gate.nx

nx_hr_visitor_log_gate.nx

buildroot/runtime/_hdl_build/nx_hr_visitor_log_gate.nx

5631 B72 linesdepth 13pulls 21 transitivereach 0 importersview sourcekind gate/prooftopic hr
docsdependenciesstructsconstsfunctions

about

nx_hr_visitor_log_gate.nx -- referee for HR rung C (behavior sweep from real logs). Synthetic access log: a FLOODER (11 reqs/1s window -> abusive), a NORMAL visitor, and a BOT (python-requests UA). PROVES the sweep classifies each, writes verdicts, AUTO-BLOCKLISTS the flooder + bot, and that the auto-block then ENFORCES (a later classify of the flooder -> BLOCK even at low rate). GREEN iff every row matches. Prints verdict=GREEN to STDOUT + returns the exit code. Durable -> knowledge/status/hr_visitor_log_gate.log. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_hr_visitor_log.nx nx_g_puts_lib.nx nx_syscalls.nx nx_hr_visitor_log_gate.nx

imports: nx_hr_visitor_log.nxnx_g_puts_lib.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 g_puts sys_write gwrite sys_openat_wr sys_write ↻ sys_close sys_mmap logline rput g_read sys_openat_rd sys_read sys_close ↻ chk g_puts ↻ g_num sys_mmap ↻ sys_write ↻ hvl_count_ip hr_line_end hr_field_end hr_eqrange hvl_sweep sys_mmap ↻ hr_read sys_openat_rd ↻ sys_read ↻ sys_close ↻ sys_openat_wr ↻ hr_line_end ↻ hr_field_end ↻ hvl_is_first hr_line_end ↻ hr_field_end ↻ hr_eqrange ↻ hvl_count_ip ↻ hvl_ua_of_line hr_field_end ↻ hv_classify

structs

none

consts

none

functions

11func g_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);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(1,bb,k); return 0 }
called by 2: chkmain calls 2: sys_mmapsys_write
12func g_w(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
13func g_wn(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 as u8);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: main calls 2: sys_mmapsys_write
14func rput(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: logline
15func gwrite(path: *u8, s: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd<0 { return 0 } if n>0 { sys_write(fd, s, n) } sys_close(fd); return 0 }
16func g_read(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 {return 0} var o: i64=0; var go: i64=1; while go==1 { let r: i64=sys_read(fd,buf+o,cap-o); if r<=0 {go=0} else {o=o+r} } sys_close(fd); return o }
17func has(path: *u8, needle: *u8) -> i64
called by 1: main calls 2: sys_mmapg_read
22func logline(buf: *u8, o: i64, ip: *u8, path: *u8, ua: *u8) -> i64 { var p: i64=rput(buf,o,ip); buf[p]=9 as u8;p=p+1; p=rput(buf,p,path); buf[p]=9 as u8;p=p+1; p=rput(buf,p,ua); buf[p]=10 as u8;p=p+1; return p }
called by 1: main calls 1: rput
23func chk(got: i64, want: i64, label: *u8) -> i64
called by 1: main calls 2: g_putsg_num
29func main() -> i64