skip to content
==> include/mesh/abi/host_net.h <==
1/* @ajax/mesh-abi-host-net: Network I/O counters: the NIC sample clock, the control port's and HTTP relay's bytes.
2 *
3 * Part of alpha-c-mesh, a C port of alpha-rust-mesh (README.md says from where). */
4#ifndef MESH_ABI_HOST_NET_H
5#define MESH_ABI_HOST_NET_H
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10
11/* Network I/O (0x640..): cumulative u64 counters since meshd started; viewers */
12/* derive rates from two snapshots.  Link and port counters are live (read at */
13/* `snap`, timed by S_UPTIME_MS); NIC counters are sampled about once a second */
14/* (timed by S_NET_AT_MS). */
15/* u64 uptime ms of the last NIC sample (0: none yet). */
16#define MESH_S_NET_AT_MS 0x640
17/* u32 NIC records at S_NICS (<= MAX_NICS): the interfaces that carry (or
18 * carried) a peer link, by name. */
19#define MESH_S_NET_NICS 0x648
20/* u32 NIC samples taken. */
21#define MESH_S_NET_SAMPLES 0x64c
22/* The control port: u64 request bytes read, reply bytes written, requests. */
23#define MESH_S_CTL_RX 0x650
24#define MESH_S_CTL_TX 0x658
25#define MESH_S_CTL_REQS 0x660
26/* The HTTP relay (--http): u64 request-head bytes read, response bytes written, connections. */
27#define MESH_S_HTTP_RX 0x668
28#define MESH_S_HTTP_TX 0x670
29#define MESH_S_HTTP_CONNS 0x678
30/* A NIC record (NI_*) summing every interface except loopback and the
31 * virtual ones whose traffic also crosses a physical one or never leaves the
32 * host (NET_VIRTUAL prefixes); NI_COUNT says how many it sums. */
33#define MESH_S_NET_TOTAL 0x680
34
35/* The Rust const asserts that only involve this package. */
36_Static_assert((MESH_S_NET_AT_MS % 8 == 0), "S_NET_AT_MS.is_multiple_of(8)");
37_Static_assert((MESH_S_CTL_RX % 8 == 0), "S_CTL_RX.is_multiple_of(8)");
38_Static_assert(MESH_S_HTTP_CONNS + 8 <= MESH_S_NET_TOTAL, "S_HTTP_CONNS + 8 <= S_NET_TOTAL");
39_Static_assert((MESH_S_NET_TOTAL % 8 == 0), "S_NET_TOTAL.is_multiple_of(8)");
40
41#endif