code wiki / _hdl_build / nx_route_table.nx

nx_route_table.nx

buildroot/runtime/_hdl_build/nx_route_table.nx

5351 B128 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind librarytopic route
docsdependenciesstructsconstsfunctions

about

nx_route_table.nx -- the S-CLASS DATA-DRIVEN ROUTE MATCHER (the LOGIC core that RETIRES the hardcoded if-cascade). PURE: a route TABLE (data) + a request (host, path) -> the matched (backend port, mode). NO hardcoded routes, NO IO, NO sockets. Semantics match the SOTA (nginx/Envoy/HAProxy/ingress, banked in knowledge/library/route_*): EXACT host beats wildcard '*'; LONGEST path-prefix wins; BOUNDARY-SAFE (`/gen` matches `/gen` and `/gen/*` but NEVER `/generated`); per-route MODE. Operator: "fix all this hardcoding and tight coupling especially on routing ... get it to s class exceed, not the garbage f-level stuff." Table row format (one per line, space-delimited; '#'=comment): <host|*> <path-prefix> <port> <mode> modes: buffered|stream|gated. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_route_table.nx nx_route_table_gate.nx nx_site_dispatch.nx

imports: nx_syscalls.nx

imported by: nx_route_table_gate.nxnx_site_dispatch.nx

structs

none

consts

10const RT_MAGIC_1000000: i64 = 1000000
12const RT_BUFFERED: i64 = 0
13const RT_STREAM: i64 = 1
14const RT_GATED: i64 = 2

functions

16func rt_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: rt_tok_eq
18func rt_eol(b: *u8, n: i64, st: i64) -> i64
called by 1: rt_match
26func rt_split(b: *u8, ls: i64, le: i64, offs: *i64, lens: *i64, maxf: i64) -> i64
called by 1: rt_match
42func rt_slice_atoi(src: *u8, off: i64, len: i64) -> i64
called by 1: rt_match
54func rt_tok_eq(src: *u8, off: i64, len: i64, tok: *u8) -> i64
called by 2: rt_mode_codert_match calls 1: rt_slen
63func rt_slice_eq(a: *u8, ao: i64, al: i64, b: *u8, bo: i64, bl: i64) -> i64
called by 1: rt_match
73func rt_prefix_boundary(path: *u8, pn: i64, pre: *u8, po: i64, prel: i64) -> i64
called by 1: rt_match
82func rt_mode_code(rt: *u8, off: i64, len: i64) -> i64
called by 1: rt_match calls 1: rt_tok_eq
90func rt_match(rt: *u8, n: i64, host: *u8, hn: i64, path: *u8, pn: i64, port_out: *i64, mode_out: *i64) -> i64