nx_cidr_smoke.nx
buildroot/runtime/nx_cidr_smoke.nx
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
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
structs
| none |
consts
| 27 | const CIDR_ERR_FORMAT: i64 = -1 |
| 28 | const CIDR_ERR_BAD_PREFIX: i64 = -2 |
functions
| 32 | func cidr_parse(s: *u8, n: i64, ip_out: *i64, prefix_out: *i64) -> i64 |
| 69 | func cidr_mask(prefix: i64) -> i64 |
| 78 | func cidr_network_address(ip: i64, prefix: i64) -> i64 calls 1: cidr_mask |
| 83 | func cidr_contains(network: i64, prefix: i64, addr: i64) -> i64 |
| 91 | func main() -> i64 |