user@devops:~$ cat README.md
protocols-watch
# Description
protocols-watch (cpp-protocols-watch) is a Linux kernel socket-protocol table monitor written in C++23 with zero external dependencies. It reads /proc/net/protocols (proto_seq_show in net/core/sock.c) and shows every registered protocol: object size, in-use sockets, allocated memory, pressure indicator (NI / no / yes), max_header, slab backing, owner module and the 18 proto_ops flags (cl close, co connect, di disconnect, ac accept, io ioctl, in init, de destroy, sh shutdown, ss setsockopt, gs getsockopt, se sendmsg, re recvmsg, bi bind, br backlog_rcv, ha hash, uh unhash, gp get_port, em enter_memory_pressure). Classifies family (ipv4, ipv6, unix, netlink, packet, xdp, mctp). Filters --active, --family NAME, --name PREFIX, --press, --slab and --top N. Watch mode (--watch N) with new/gone/grew/shrank socket deltas; per-frame flush on pipes. JSON output (--json) with summary + protocols array validated with python -m json.tool. --demo with 18 protocols of a synthetic busy host (208 sockets, TCP under pressure) and --file for dumps with # comments (includes sample-protocols.table). Self-test 74 checks: family classifier, ops decode, parser, filters, demo, JSON and real /proc reads. Zero deps: g++ -std=c++23 -O2 -Wall -Wextra.
# Key features
$ Reads /proc/net/protocols: full kernel struct proto table
$ Symbolic families: ipv4, ipv6, unix, netlink, packet, xdp, mctp
$ 18 proto_ops flags decoded with --ops (cl|co|di|ac|io|in|de|sh|ss|gs|se|re|bi|br|ha|uh|gp|em)
$ Memory pressure (NI / no / yes) and allocated memory; TCP under pressure in red
$ Watch mode (--watch N) with new/gone/grew/shrank socket deltas
$ Filters --active, --family, --name PREFIX, --press, --slab, --top N
$ Validatable JSON; --demo with 18 protocols (208 sockets); --file tolerates # comments; --no-color with mutable ANSI palette
# Gallery
# Technologies used