nx_socket.nx
buildroot/runtime/nx_socket.nx
about
nx_socket.nx -- IPv4 TCP/UDP socket primitives.
Used by:
- Network services (HTTP, gRPC servers)
- RPC client + server scaffolding
- The future Nishi netcode test harness
The host net.nx wraps a few socket calls but doesn't expose
the full primitive set or the address-family/type/protocol
constants. This module is the canonical surface.
Linux RV64 syscall numbers:
socket 198
bind 200
listen 201
accept 202
accept4 242
connect 203
sendto 206
recvfrom 207
shutdown 210
setsockopt 208
getsockopt 209
Address family / socket type / protocol constants are reused
across the whole net stack.
dependencies 1 imports · 6 importers
imports: syscalls.nx
imported by: nx_net_chan.nxnx_net_chan_blob_test.nxnx_net_chan_test.nxnx_remote_worker.nxnx_rpc_test.nxnx_socket_pingpong_test.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 35 | const NX_MAGIC_8080: i64 = 8080 |
| 38 | const NX_AF_UNIX: i64 = 1 |
| 39 | const NX_AF_INET: i64 = 2 |
| 40 | const NX_AF_INET6: i64 = 10 |
| 43 | const NX_SOCK_STREAM: i64 = 1 |
| 44 | const NX_SOCK_DGRAM: i64 = 2 |
| 45 | const NX_SOCK_RAW: i64 = 3 |
| 46 | const NX_SOCK_NONBLOCK: i64 = 0x800 |
| 47 | const NX_SOCK_CLOEXEC: i64 = 0x80000 |
| 50 | const NX_IPPROTO_IP: i64 = 0 |
| 51 | const NX_IPPROTO_TCP: i64 = 6 |
| 52 | const NX_IPPROTO_UDP: i64 = 17 |
| 55 | const NX_SOL_SOCKET: i64 = 1 |
| 58 | const NX_SO_REUSEADDR: i64 = 2 |
| 59 | const NX_SO_REUSEPORT: i64 = 15 |
| 60 | const NX_SO_KEEPALIVE: i64 = 9 |
| 61 | const NX_SO_SNDBUF: i64 = 7 |
| 62 | const NX_SO_RCVBUF: i64 = 8 |
| 65 | const NX_SHUT_RD: i64 = 0 |
| 66 | const NX_SHUT_WR: i64 = 1 |
| 67 | const NX_SHUT_RDWR: i64 = 2 |
| 70 | const NX_SYS_SOCKET: i64 = 198 |
| 71 | const NX_SYS_BIND: i64 = 200 |
| 72 | const NX_SYS_LISTEN: i64 = 201 |
| 73 | const NX_SYS_ACCEPT: i64 = 202 |
| 74 | const NX_SYS_CONNECT: i64 = 203 |
| 75 | const NX_SYS_SENDTO: i64 = 206 |
| 76 | const NX_SYS_RECVFROM: i64 = 207 |
| 77 | const NX_SYS_SETSOCKOPT: i64 = 208 |
| 78 | const NX_SYS_GETSOCKOPT: i64 = 209 |
| 79 | const NX_SYS_SHUTDOWN: i64 = 210 |
| 80 | const NX_SYS_ACCEPT4: i64 = 242 |
functions
| 90 | func nx_sock_htons(v: i64) -> i64 |
| 94 | func nx_sock_htonl(v: i64) -> i64 called by 1: main |
| 102 | func nx_sock_sin_init(buf: *u8, ip_be: i64, port_host: i64) -> i64 |
| 119 | func nx_sock_inet_aton(s: *u8) -> i64 called by 1: main |
| 151 | func nx_sock_socket(family: i64, sock_type: i64, proto: i64) -> i64 |
| 155 | func nx_sock_bind(fd: i64, addr: *u8, addrlen: i64) -> i64 |
| 159 | func nx_sock_listen(fd: i64, backlog: i64) -> i64 |
| 163 | func nx_sock_accept(fd: i64, addr: *u8, addrlen: *i64) -> i64 |
| 167 | func nx_sock_connect(fd: i64, addr: *u8, addrlen: i64) -> i64 |
| 171 | func nx_sock_setsockopt(fd: i64, level: i64, opt: i64, val: *u8, len: i64) -> i64 called by 1: nx_sock_reuseaddr |
| 175 | func nx_sock_shutdown(fd: i64, how: i64) -> i64 |
| 180 | func nx_sock_reuseaddr(fd: i64) -> i64 |
| 189 | func main() -> i64 |