code wiki / (root) / nx_pages_daemon.nx

nx_pages_daemon.nx

buildroot/runtime/nx_pages_daemon.nx

8112 B204 linesdepth 5pulls 9 transitivereach 0 importersview sourcekind servicetopic pages
docsdependenciesstructsconstsfunctions

about

nx_pages_daemon.nx -- D1.2 of NISHI_DEPLOY_ROADMAP. Composes nx_http_server (socket+accept) + http_parse (full request parse) + nx_pages_vhost (Host-header routing) + nx_pages_static (file serving) into a single accept-loop daemon. HTTP-only in this stone; TLS/HTTPS lands in D1.3. Build (x86_64 native Linux ELF, static): cd nishi-core/nxc2 ./nxc2.exe --target x86_64 runtime/nx_pages_daemon.nx > /tmp/d.s wsl bash -c "as /tmp/d.s -o /tmp/d.o && ld /tmp/d.o -o nx_pages_daemon" Run: ./nx_pages_daemon # listens on :8080 (config hardcoded V1) V1 limitations (each named so they can become D1.x sub-stones): - port + vhost map are hardcoded; D1.6 adds config file - single-threaded accept loop; D1.10 adds worker pool - no keepalive; D1.x adds HTTP/1.1 persistent connections - no TLS; D1.3 - no SIGHUP reload; D1.6 - no ACME loop; D1.5

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_http.nx nx_http_server.nx nx_pages_vhost.nx nx_pages_static.nx nx_pages_config.nx nx_pages_daemon.nx

imports: nx_syscalls.nxnx_http.nxnx_http_server.nxnx_pages_vhost.nxnx_pages_static.nxnx_pages_config.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_vhost_table_init _daemon_setup_vhosts nx_pages_config_load sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close _pcfg_find_byte _pcfg_is_ws _pcfg_byte_eq nx_vhost_add _vh_arena_push_cstr _pcfg_parse_i64 nx_vhost_set_fallback sys_write _daemon_setup_vhosts_hardc nx_vhost_add ↻ nx_vhost_set_fallback ↻ nx_http_server_addr_any nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close ↻ sys_listen sys_write ↻ nx_http_server_accept_one sys_accept _daemon_serve_one sys_mmap ↻ sys_read ↻

structs

none

consts

29const NX_MAGIC_2048: i64 = 2048
30const NX_MAGIC_4096: i64 = 4096
32const NX_DAEMON_PORT: i64 = 18080
33const NX_DAEMON_BACKLOG: i64 = 128
34const NX_DAEMON_REQ_CAP: i64 = 16384
35const NX_DAEMON_RESP_CAP: i64 = 4194304 // 4 MB max response (covers WASM)
36const NX_DAEMON_HTTP_METHOD_GET: i64 = 1

functions

43func _daemon_setup_vhosts_hardcoded(t: *NxVHostTable, cursor: *i64) -> i64
61func _daemon_setup_vhosts(t: *NxVHostTable, cursor: *i64) -> i64
100func _daemon_serve_one(cfd: i64, table: *NxVHostTable) -> i64
169func main() -> i64