code wiki / _hdl_build / nx_cms_tls_front.nx
nx_cms_tls_front.nx
buildroot/runtime/_hdl_build/nx_cms_tls_front.nx
about
nx_cms_tls_front.nx -- CMS C8: TLS-terminating FRONT for the CMS admin daemon (the sites-daemon
integration shape, scoped to one backend). Speaks the SAME stack as nx_sites_daemon_v2: TLS 1.3
server session (Ed25519 CV -- the andelinwest/wiki daemon path), record-framed receive, chunked
app_send (any response size). Each accepted connection: handshake -> read ONE request's plaintext
-> forward over loopback TCP to the CMS admin -> relay the full response back inside TLS -> close.
The admin stays loopback-only plain HTTP (single responsibility); THIS process owns the TLS
boundary, exactly how the NAS sites daemon would adopt a CMS backend (route a vhost to a backend
instead of static files).
HONEST CONTRACT: request plaintext is taken up to CRLFCRLF reassembly (+ same-record body bytes);
a body split into records AFTER the header record is not reassembled -- form posts from real
browsers and our gates fit one record (<16KB). Named follow-on if uploads (C11) need more.
argv: [1]=listen port [2]=backend port [3]=cert.der path [4]=ed25519 key path (32B) [5]=budget
license_tier: ORIGINAL
dependencies 8 imports · 0 importers
imports: nx_syscalls.nxnx_connect.nxnx_csprng.nxnx_tls13_server_session.nxnx_tls13_server_session_run.nxnx_tls13_server_session_app_data.nxnx_tls13_read_record_from_fd.nxnx_tls13_app_send_fd.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 23 | const TF_RECCAP: i64 = 20480 |
| 24 | const TF_PLAINCAP: i64 = 65536 |
| 25 | const TF_OUTREC: i64 = 17408 |
| 26 | const TF_RESPCAP: i64 = 524288 |
functions
| 28 | func tf_atoi(s: *u8) -> i64 called by 1: main |
| 40 | func tf_ws(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 41 | func tf_wnum(v: i64) -> i64 { let b: *u8 = sys_mmap(32); var x: i64 = v; var nd: i64 = 1; var t: i64 = v; while t >= 10 { nd = nd + 1; t = t / 10 } var i: i64 = nd; while i > 0 { i = i - 1; b[i] = ((x % 10) + 48) as u8; x = x / 10 } sys_write(1, b, nd); return 0 } |
| 42 | func tf_contains(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64 called by 1: tf_recv_request |
| 55 | func tf_recv_request(s: *Tls13ServerSession, cfd: i64, rec_buf: *u8, plain: *u8, plain_cap: i64) -> i64 |
| 71 | func tf_backend(port: i64, req: *u8, rn: i64, resp: *u8, cap: i64) -> i64 called by 1: main calls 7: sys_socketsys_mmapnx_connect_boundedsys_closesys_writesys_set_socket_timeout+1 |
| 105 | func main(argc: i64, argv: *i64) -> i64 |