code wiki / _hdl_build / nx_cms_tls_front.nx

nx_cms_tls_front.nx

buildroot/runtime/_hdl_build/nx_cms_tls_front.nx

8203 B177 linesdepth 14pulls 67 transitivereach 0 importersview sourcekind tooltopic cms
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_connect.nx nx_csprng.nx nx_tls13_server_session.nx nx_tls13_server_session_run.nx nx_tls13_server_session_app_data.n nx_tls13_read_record_from_fd.nx nx_tls13_app_send_fd.nx nx_cms_tls_front.nx

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

main sys_write sys_exit tf_atoi sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_socket sys_setsockopt sys_bind tf_ws sys_write ↻ tf_wnum sys_mmap ↻ sys_write ↻ sys_listen sys_accept sys_set_socket_timeout sys_mmap ↻ sys_setsockopt ↻ sys_munmap nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_tls13_server_session_ru nx_tls13_server_session_ne sys_mmap ↻ x25519_keypair_public sys_mmap ↻ x25519_base_point x25519 nx_scratch_save nx_scratch_init

structs

none

consts

23const TF_RECCAP: i64 = 20480
24const TF_PLAINCAP: i64 = 65536
25const TF_OUTREC: i64 = 17408
26const TF_RESPCAP: i64 = 524288

functions

28func tf_atoi(s: *u8) -> i64
called by 1: main
40func 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 }
called by 1: main calls 1: sys_write
41func 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 }
called by 1: main calls 2: sys_mmapsys_write
42func tf_contains(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64
called by 1: tf_recv_request
55func tf_recv_request(s: *Tls13ServerSession, cfd: i64, rec_buf: *u8, plain: *u8, plain_cap: i64) -> i64
71func tf_backend(port: i64, req: *u8, rn: i64, resp: *u8, cap: i64) -> i64
105func main(argc: i64, argv: *i64) -> i64