code wiki / (root) / nx_udp.nx

nx_udp.nx

buildroot/runtime/nx_udp.nx

3845 B99 linesdepth 3pulls 3 transitivereach 5 importersview sourcekind librarytopic udp
docsdependenciesstructsconstsfunctions

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

nx_syscalls_x86_64.nx nx_udp.nx nx_dns_io.nx nx_iot_announce.nx nx_iot_kasa_probe.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_dns_io.nxnx_iot_announce.nxnx_iot_kasa_probe.nx

structs

none

consts

47const NX_UDP_VERDICT_UNKNOWN: i64 = 0
48const NX_UDP_VERDICT_OK: i64 = 1
49const NX_UDP_VERDICT_SOCKET_FAIL: i64 = 2
50const NX_UDP_VERDICT_BIND_FAIL: i64 = 3
51const NX_UDP_VERDICT_SEND_FAIL: i64 = 4
52const NX_UDP_VERDICT_RECV_FAIL: i64 = 5
53const NX_UDP_VERDICT_N: i64 = 6
55const SOCK_DGRAM: i64 = 2

functions

58func nx_udp_open() -> i64
63func nx_udp_bind_any(fd: i64, port: i64) -> i64
called by 1: nx_iot_announce_open calls 1: sys_bind
72func nx_udp_sockaddr_dest(out: *u8, a: i64, b: i64, c: i64, d: i64, port: i64) -> i64
83func nx_udp_send(fd: i64, buf: *u8, n: i64, addr16: *u8) -> i64
90func nx_udp_recv(fd: i64, buf: *u8, n: i64, peer_addr: *u8, peer_addr_len: *i64) -> i64
95func nx_udp_verdict_is_valid(v: i64) -> i64