code wiki / _hdl_build / nx_docportal_admin_lib.nx
nx_docportal_admin_lib.nx
buildroot/runtime/_hdl_build/nx_docportal_admin_lib.nx
about
nx_docportal_admin_lib.nx -- the admin.<domain> DOCUMENT-PORTAL request handler (operator's global split:
CAPABILITIES live on subdomains -- admin.<d> -- while visitor content lives on <d>/paths). Pure bytes-in /
bytes-out per the proven nx_status_daemon sd_handle pattern: a thin socket loop wraps it at deploy time; the
logic + gate need no socket. The admin capability is GLOBAL (one handler serves every domain); the SHARD is the
domain, passed per request -> a request can only touch the domain it names, and within that domain the
public/private split of nx_docportal_lib holds by construction.
AUTHZ deny-by-default (defensive at the boundary; the caller sets user_level AFTER authenticating, like the
legal_portal NxPortalCtx + the nx_status_daemon login->token flow): 0=anon, 1=client, 2=staff. Every /admin
route needs >=1; /admin/staff routes need 2. Composes dp_ingest. license_tier: ORIGINAL
dependencies 3 imports · 4 importers
imports: nx_docportal_lib.nxnx_doc_at_rest.nxnx_doc_authz.nx
imported by: nx_docportal_admin_daemon.nxnx_docportal_admin_gate.nxnx_docportal_at_rest_gate.nxnx_docportal_authz_route_gate.nx
structs
| 25 | struct DaCtx { user_level: i64, subject: *u8 } |
consts
| 16 | const DA_ASCII_0: i64 = 48 |
| 17 | const DA_DEC: i64 = 10 |
| 18 | const DA_FLAGBUF: i64 = 8 |
| 20 | const K_MAGIC_131072: i64 = 131072 |
functions
| 27 | func da_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 28 | func da_cat(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o } |
| 29 | func da_numc(out: *u8, o: i64, v: i64) -> i64 |
| 39 | func da_eq(p: *u8, pl: i64, lit: *u8) -> i64 { let ll: i64 = da_slen(lit); if pl != ll { return 0 } var i: i64 = 0; while i < pl { if p[i] != lit[i] { return 0 } i = i + 1 } return 1 } |
| 40 | func da_prefix(p: *u8, pl: i64, lit: *u8) -> i64 { let ll: i64 = da_slen(lit); if pl < ll { return 0 } var i: i64 = 0; while i < ll { if p[i] != lit[i] { return 0 } i = i + 1 } return 1 } |
| 43 | func da_pathlen(req: *u8, n: i64, pathbuf: *u8) -> i64 called by 1: da_handle |
| 62 | func da_query_str(req: *u8, n: i64, key: *u8, out: *u8, outcap: i64) -> i64 |
| 83 | func da_body_start(req: *u8, n: i64) -> i64 called by 1: da_handle |
| 93 | func da_text_response(out: *u8, status: *u8, body: *u8, blen: i64) -> i64 |
| 106 | func da_is_post(req: *u8, n: i64) -> i64 { if n < 4 { return 0 } if req[0] == (80 as u8) { if req[1] == (79 as u8) { if req[2] == (83 as u8) { if req[3] == (84 as u8) { return 1 } } } } return 0 } called by 1: da_handle |
| 108 | func da_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } called by 1: da_handle |
| 113 | func da_parse_flags(req: *u8, n: i64, anyout: *i64) -> i64 |
| 126 | func da_handle(ctx: *DaCtx, req: *u8, n: i64, out: *u8) -> i64 |