code wiki / (root) / nx_socket.nx

nx_socket.nx

buildroot/runtime/nx_socket.nx

7109 B226 linesdepth 3pulls 3 transitivereach 9 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

syscalls.nx nx_socket.nx nx_net_chan.nx nx_net_chan_blob_test.nx nx_net_chan_test.nx nx_remote_worker.nx nx_rpc_test.nx nx_socket_pingpong_test.nx

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

main nx_sock_htons nx_sock_htonl nx_sock_sin_init nx_sock_htons ↻ nx_sock_inet_aton nx_sock_socket

structs

none

consts

35const NX_MAGIC_8080: i64 = 8080
38const NX_AF_UNIX: i64 = 1
39const NX_AF_INET: i64 = 2
40const NX_AF_INET6: i64 = 10
43const NX_SOCK_STREAM: i64 = 1
44const NX_SOCK_DGRAM: i64 = 2
45const NX_SOCK_RAW: i64 = 3
46const NX_SOCK_NONBLOCK: i64 = 0x800
47const NX_SOCK_CLOEXEC: i64 = 0x80000
50const NX_IPPROTO_IP: i64 = 0
51const NX_IPPROTO_TCP: i64 = 6
52const NX_IPPROTO_UDP: i64 = 17
55const NX_SOL_SOCKET: i64 = 1
58const NX_SO_REUSEADDR: i64 = 2
59const NX_SO_REUSEPORT: i64 = 15
60const NX_SO_KEEPALIVE: i64 = 9
61const NX_SO_SNDBUF: i64 = 7
62const NX_SO_RCVBUF: i64 = 8
65const NX_SHUT_RD: i64 = 0
66const NX_SHUT_WR: i64 = 1
67const NX_SHUT_RDWR: i64 = 2
70const NX_SYS_SOCKET: i64 = 198
71const NX_SYS_BIND: i64 = 200
72const NX_SYS_LISTEN: i64 = 201
73const NX_SYS_ACCEPT: i64 = 202
74const NX_SYS_CONNECT: i64 = 203
75const NX_SYS_SENDTO: i64 = 206
76const NX_SYS_RECVFROM: i64 = 207
77const NX_SYS_SETSOCKOPT: i64 = 208
78const NX_SYS_GETSOCKOPT: i64 = 209
79const NX_SYS_SHUTDOWN: i64 = 210
80const NX_SYS_ACCEPT4: i64 = 242

functions

90func nx_sock_htons(v: i64) -> i64
94func nx_sock_htonl(v: i64) -> i64
called by 1: main
102func nx_sock_sin_init(buf: *u8, ip_be: i64, port_host: i64) -> i64
119func nx_sock_inet_aton(s: *u8) -> i64
called by 1: main
151func nx_sock_socket(family: i64, sock_type: i64, proto: i64) -> i64
155func nx_sock_bind(fd: i64, addr: *u8, addrlen: i64) -> i64
159func nx_sock_listen(fd: i64, backlog: i64) -> i64
163func nx_sock_accept(fd: i64, addr: *u8, addrlen: *i64) -> i64
167func nx_sock_connect(fd: i64, addr: *u8, addrlen: i64) -> i64
171func nx_sock_setsockopt(fd: i64, level: i64, opt: i64, val: *u8, len: i64) -> i64
called by 1: nx_sock_reuseaddr
175func nx_sock_shutdown(fd: i64, how: i64) -> i64
180func nx_sock_reuseaddr(fd: i64) -> i64
189func main() -> i64