code wiki / _hdl_build / nx_route_table.nx
nx_route_table.nx
buildroot/runtime/_hdl_build/nx_route_table.nx
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
imports: nx_syscalls.nx
imported by: nx_route_table_gate.nxnx_site_dispatch.nx
structs
| none |
consts
| 10 | const RT_MAGIC_1000000: i64 = 1000000 |
| 12 | const RT_BUFFERED: i64 = 0 |
| 13 | const RT_STREAM: i64 = 1 |
| 14 | const RT_GATED: i64 = 2 |
functions
| 16 | func 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 |
| 18 | func rt_eol(b: *u8, n: i64, st: i64) -> i64 called by 1: rt_match |
| 26 | func rt_split(b: *u8, ls: i64, le: i64, offs: *i64, lens: *i64, maxf: i64) -> i64 called by 1: rt_match |
| 42 | func rt_slice_atoi(src: *u8, off: i64, len: i64) -> i64 called by 1: rt_match |
| 54 | func rt_tok_eq(src: *u8, off: i64, len: i64, tok: *u8) -> i64 |
| 63 | func rt_slice_eq(a: *u8, ao: i64, al: i64, b: *u8, bo: i64, bl: i64) -> i64 called by 1: rt_match |
| 73 | func rt_prefix_boundary(path: *u8, pn: i64, pre: *u8, po: i64, prel: i64) -> i64 called by 1: rt_match |
| 82 | func rt_mode_code(rt: *u8, off: i64, len: i64) -> i64 |
| 90 | func rt_match(rt: *u8, n: i64, host: *u8, hn: i64, path: *u8, pn: i64, port_out: *i64, mode_out: *i64) -> i64 called by 3: g_matchsd_dispatchsh_handle calls 8: sys_mmaprt_eolrt_splitrt_tok_eqrt_slice_eqrt_prefix_boundary+2 |