code wiki / _hdl_build / nx_docportal_admin_lib.nx

nx_docportal_admin_lib.nx

buildroot/runtime/_hdl_build/nx_docportal_admin_lib.nx

14997 B233 linesdepth 9pulls 16 transitivereach 8 importersview sourcekind librarytopic docportal
docsdependenciesstructsconstsfunctions

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

nx_docportal_lib.nx nx_doc_at_rest.nx nx_doc_authz.nx nx_docportal_admin_lib.nx nx_docportal_admin_daemon.nx nx_docportal_admin_gate.nx nx_docportal_at_rest_gate.nx nx_docportal_authz_route_gate.nx

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

25struct DaCtx { user_level: i64, subject: *u8 }

consts

16const DA_ASCII_0: i64 = 48
17const DA_DEC: i64 = 10
18const DA_FLAGBUF: i64 = 8
20const K_MAGIC_131072: i64 = 131072

functions

27func da_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
28func 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 }
29func da_numc(out: *u8, o: i64, v: i64) -> i64
39func 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 }
called by 1: da_handle calls 1: da_slen
40func 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 }
called by 1: da_handle calls 1: da_slen
43func da_pathlen(req: *u8, n: i64, pathbuf: *u8) -> i64
called by 1: da_handle
62func da_query_str(req: *u8, n: i64, key: *u8, out: *u8, outcap: i64) -> i64
called by 2: da_parse_flagsda_handle calls 1: da_slen
83func da_body_start(req: *u8, n: i64) -> i64
called by 1: da_handle
93func da_text_response(out: *u8, status: *u8, body: *u8, blen: i64) -> i64
called by 1: da_handle calls 2: da_catda_numc
106func 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
108func 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
113func da_parse_flags(req: *u8, n: i64, anyout: *i64) -> i64
called by 1: da_handle calls 2: da_query_strsys_munmap
126func da_handle(ctx: *DaCtx, req: *u8, n: i64, out: *u8) -> i64