API

Core types.

VBVX is intentionally small. Four ideas cover everything: a buffer view, a header view, a flags view, and a set of packed POD headers.

Full reference

Doxygen API docs on GitHub Pages

Every type, member and overload — generated from source.

llmxio.github.io/vbvx →
BufferView
vbvx::BufferView(const uint8_t* data, size_t len)

Owns no memory. Computes header offsets on demand and returns header views via ipv4_header(), ipv6_header(), tcp_header(), udp_header(), icmp_header(), srv6_header() etc.

HeaderView<H>
vbvx::HeaderView<H>

Lightweight wrapper around const H*. Use .copy() to materialise a local value when you need to mutate or outlive the source buffer.

FlagsView<E>
vbvx::FlagsView<E> / vbvx::ConstFlagsView<E>

Chainable view over a bitmask enum. set(), clear(), toggle(), reset(), has(), has_all() — no allocation, just operates on the underlying enum value.

Packed headers
vbvx/*.hxx

[[gnu::packed]] structs with alignof == 1. On-wire fields stay in network byte order; use autoswap helpers to convert to host order.

FlagsView in practice

Opt your enum into bitmask operators by specialising vbvx::enable_bitmask_operators to std::true_type.

flags.cxx
#include "vbvx/flags_view.hxx"

enum class FooFlags : uint8_t {
  None = 0, A = 1 << 0, B = 1 << 1, C = 1 << 2,
};

template<> struct vbvx::enable_bitmask_operators<FooFlags>
  : std::true_type {};

FooFlags flags = FooFlags::None;
vbvx::FlagsView fv(flags);

fv.set(FooFlags::A).set(FooFlags::B);
fv.clear(FooFlags::A);
fv.toggle(FooFlags::C);

if (fv.has(FooFlags::B)) { /* ... */ }

vbvx::ConstFlagsView cfv = fv;
auto current = cfv.value();