code wiki / _hdl_build / nx_conn_cap.nx

nx_conn_cap.nx

buildroot/runtime/_hdl_build/nx_conn_cap.nx

2130 B53 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_conn_cap.nx -- per-IP concurrent-connection cap, the access-wall DDoS L3-connection / slowloris defense (RFC 7230 timeouts complement). A bounded in-memory table the enforcement daemon owns: cc_acquire(ip) at accept (reject when an IP already holds >= cap, OR when the table is saturated = FAIL-CLOSED under a flood), cc_release(ip) on close. Pure logic, nx_syscalls -- pairs with nx_rate_limit (request brute-force, L4) + nx_access_wall (the rate_ok / conn-ok signals feed the PDP). license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_conn_cap.nx nx_conn_cap_gate.nx

imports: nx_syscalls.nx

imported by: nx_conn_cap_gate.nx

structs

none

consts

8const CC_CAP_DEFAULT: i64 = 16 // default max concurrent connections per IP

functions

11func cc_find(ips: *i64, n: i64, ip: i64) -> i64
20func cc_acquire(ips: *i64, cnts: *i64, nbox: *i64, slots: i64, ip: i64, cap: i64) -> i64
called by 1: main calls 1: cc_find
35func cc_release(ips: *i64, cnts: *i64, nbox: *i64, ip: i64) -> i64
called by 1: main calls 1: cc_find
49func cc_count(ips: *i64, cnts: *i64, nbox: *i64, ip: i64) -> i64
called by 1: main calls 1: cc_find