code wiki / (root) / nx_cidr_smoke.nx

nx_cidr_smoke.nx

buildroot/runtime/nx_cidr_smoke.nx

3667 B107 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind smoketopic cidr
docsdependenciesstructsconstsfunctions

about

cidr.nx -- IPv4 CIDR (RFC 4632) parser + match. Parses "a.b.c.d/N" notation and provides address-in-range matching. Used by: ACLs, rate-limit rules, VPN route tables, service discovery (DHCP scope definition). IPv6 CIDR (a:b:c::d/prefix) deferred -- same algorithm but wider masks. Would share helpers with ipaddr.nx. Invariants: CIDR1 Prefix length range-checked: [0, 32] for IPv4. CIDR2 Host bits in the network address are IGNORED on parse (RFC 4632 permissive). Canonical form masks them out via cidr_network_address. CIDR3 Match is bit-exact against the computed network + mask; no regex, no partial parsing, no DNS resolution.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_ipaddr.nx nx_cidr_smoke.nx

imports: nx_syscalls.nxnx_ipaddr.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 cidr_parse ipv4_parse cidr_mask cidr_contains cidr_mask ↻

structs

none

consts

27const CIDR_ERR_FORMAT: i64 = -1
28const CIDR_ERR_BAD_PREFIX: i64 = -2

functions

32func cidr_parse(s: *u8, n: i64, ip_out: *i64, prefix_out: *i64) -> i64
called by 1: main calls 1: ipv4_parse
69func cidr_mask(prefix: i64) -> i64
78func cidr_network_address(ip: i64, prefix: i64) -> i64
calls 1: cidr_mask
83func cidr_contains(network: i64, prefix: i64, addr: i64) -> i64
called by 1: main calls 1: cidr_mask
91func main() -> i64