nx_wire_logger.nx
buildroot/runtime/nx_wire_logger.nx
about
nx_wire_logger.nx -- bits-up TCP wire logger.
Replaces external packet capture tools (Wireshark, tcpdump) with a
native NishiLang primitive that interposes on send/recv at the TCP
fd boundary. Direction-labeled hex dumps go to a chosen log fd
(typically stderr=2 or a dedicated file).
Substrate-honesty principle: any time we'd reach for Wireshark to
"see the bytes," we owe ourselves a native primitive. This is
that primitive.
API:
nx_wire_send(fd, log_fd, label, label_len, buf, len) -> i64
Calls sys_write(fd, buf, len); if log_fd > 0, hex-dumps the
same bytes to log_fd with the label prefix. Returns sys_write
result (bytes written, or negative on error).
nx_wire_recv(fd, log_fd, label, label_len, buf, max) -> i64
Calls sys_read(fd, buf, max); if log_fd > 0, hex-dumps the
first n bytes (n = read result) to log_fd. Returns sys_read
result.
Per Cardinals 9, 22. Composes nx_hex_dump.
license_tier: ORIGINAL
lineage_id: nishi_wire_logger_q10
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_hex_dump.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| none |
functions
| 31 | func nx_wire_send(fd: i64, log_fd: i64, |
| 43 | func nx_wire_recv(fd: i64, log_fd: i64, |
| 55 | func main() -> i64 |