- remove Java plugins (velocity/paper), dashboard, all MC-specific code
(handshake, death_code, varint, hostname-HMAC); available in history pre-v0.2
- merge crates/* into one package with src/bin/{rampart,rampart-manager,rampart-cli}
- ProtocolHandler trait + registry (no implementations yet), universal PoW kept
- XDP: universal L3/L4 filter (xdp/core/) + pluggable hook API (xdp/hooks/),
fix IPv6 saddr bug; clang build verified
- docs: bilingual knowledge base (docs/kb/: attacks x4, defense-levels,
practice x3), rewrite README/architecture for universal concept
- TODO.md v4.0: <=300-line module limit, competitor benchmark section (ref/)
- deploy/CI/docs cleanup: no MC references, new binary names
cargo build/clippy(-D warnings)/test green (55 tests)
26 lines
1 KiB
C
26 lines
1 KiB
C
#ifndef RAMPART_STATS_H
|
|
#define RAMPART_STATS_H
|
|
|
|
#include "common.h"
|
|
#include "maps.h"
|
|
|
|
// ── Per-CPU stat increment ──
|
|
static __always_inline void inc_stat(__u32 idx)
|
|
{
|
|
__u64 *val = bpf_map_lookup_elem(&stats_map, &idx);
|
|
if (val)
|
|
__sync_fetch_and_add(val, 1);
|
|
}
|
|
|
|
// ── Convenience wrappers ──
|
|
static __always_inline void inc_total(void) { inc_stat(STAT_TOTAL); }
|
|
static __always_inline void inc_tcp(void) { inc_stat(STAT_TCP); }
|
|
static __always_inline void inc_udp(void) { inc_stat(STAT_UDP); }
|
|
static __always_inline void inc_whitelist(void) { inc_stat(STAT_WHITELIST); }
|
|
static __always_inline void inc_blacklist(void) { inc_stat(STAT_BLACKLIST); }
|
|
static __always_inline void inc_syn_throttle(void) { inc_stat(STAT_SYN_THROTTLE); }
|
|
static __always_inline void inc_rate_limit(void) { inc_stat(STAT_RATE_LIMIT); }
|
|
static __always_inline void inc_pass(void) { inc_stat(STAT_PASS); }
|
|
static __always_inline void inc_drop(void) { inc_stat(STAT_DROP); }
|
|
|
|
#endif /* RAMPART_STATS_H */
|