nx_udp.nx
buildroot/runtime/nx_udp.nx
about
nx_udp.nx -- sovereign UDP socket primitives.
Phase 0 of the Nishi comms stack per docs/NISHI_COMMS_ROADMAP.md.
Open a UDP socket, optionally bind to a port, send + receive
packets. No libc. No external networking library.
What it does today:
- open UDP socket (SOCK_DGRAM)
- bind to a local port (for receiving)
- sendto an IPv4 dest
- recvfrom into a caller buffer
What it doesn't do yet:
- DNS lookup (caller packs IPv4 manually). L21b queued.
- IPv6. Phase 1+.
- Multicast. Niche; later.
- Connected-UDP convenience. Trivial wrap.
genealogy_id: rfc_768_udp + linux_socket_api + rfc_5389_stun
lineage_id: nishi_comms_udp_floor_q10
nx_safety_envelope:
intended_use: "UDP socket primitives -- foundation for
DNS, NTP, STUN, IoT discovery, low-latency
comms"
sil_target: SIL2 (network primitive; failure modes
include reorder / drop / spoof
which higher layers must handle)
asil_target: QM
dal_target: DAL C
evidence: [POSIX_socket_classical_basis,
sealed_verdict_enum, no_FP,
sys_sendto_recvfrom_balance_audited]
hazard_register: [bug-tape-source-address-spoofing-trusted,
bug-tape-fragment-reassembly-DoS,
bug-tape-amplification-attack-reflector]
residual_risk: "UDP has NO authentication. Caller MUST
treat source addresses as untrusted.
Amplification mitigation requires response-
size limits (upstream). Substrate provides
dependencies 1 imports · 3 importers
imports: nx_syscalls_x86_64.nx
imported by: nx_dns_io.nxnx_iot_announce.nxnx_iot_kasa_probe.nx
structs
| none |
consts
| 47 | const NX_UDP_VERDICT_UNKNOWN: i64 = 0 |
| 48 | const NX_UDP_VERDICT_OK: i64 = 1 |
| 49 | const NX_UDP_VERDICT_SOCKET_FAIL: i64 = 2 |
| 50 | const NX_UDP_VERDICT_BIND_FAIL: i64 = 3 |
| 51 | const NX_UDP_VERDICT_SEND_FAIL: i64 = 4 |
| 52 | const NX_UDP_VERDICT_RECV_FAIL: i64 = 5 |
| 53 | const NX_UDP_VERDICT_N: i64 = 6 |
| 55 | const SOCK_DGRAM: i64 = 2 |
functions
| 58 | func nx_udp_open() -> i64 |
| 63 | func nx_udp_bind_any(fd: i64, port: i64) -> i64 |
| 72 | func nx_udp_sockaddr_dest(out: *u8, a: i64, b: i64, c: i64, d: i64, port: i64) -> i64 |
| 83 | func nx_udp_send(fd: i64, buf: *u8, n: i64, addr16: *u8) -> i64 |
| 90 | func nx_udp_recv(fd: i64, buf: *u8, n: i64, peer_addr: *u8, peer_addr_len: *i64) -> i64 |
| 95 | func nx_udp_verdict_is_valid(v: i64) -> i64 |