Usage

Drop in. Link up. Parse.

VBVX is header-only. There is no compiled artifact to ship — just consume the CMake target and include the views you need.

FetchContent (recommended)

Pull at configure time. Pin a tag or commit for reproducible builds.

CMakeLists.txt
include(FetchContent)

FetchContent_Declare(vbvx
  GIT_REPOSITORY https://github.com/llmxio/vbvx.git
  GIT_TAG vX.Y.Z   # pin to a release tag or commit
)
FetchContent_MakeAvailable(vbvx)

target_link_libraries(my_app PRIVATE vbvx::vbvx)

add_subdirectory (vendored)

Use as a submodule or copied directory.

CMakeLists.txt
# From your top-level CMakeLists.txt
add_subdirectory(path/to/vbvx)
target_link_libraries(my_app PRIVATE vbvx::vbvx)

Build & test

Requirements: a C++23-capable compiler (GCC/Clang) and CMake. Ninja is recommended.

shell
# Configure (enable tests)
cmake -G Ninja -B build -S . \
  -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON

# Build
cmake --build build

# Run tests (verbose)
ctest --test-dir build -V

First parse

Construct a BufferView over your packet data and walk the headers you care about.

parse.cxx
#include "vbvx/buffer_view.hxx"

vbvx::BufferView buf(data, len);

if (auto ip = buf.ipv4_header()) {
  if (buf.ip_protocol() == vbvx::IpProtocol::TCP) {
    if (auto tcp = buf.tcp_header()) {
      auto src_port = tcp->src_port();
      auto dst_port = tcp->dst_port();
      // use src/dst
    }
  }
}