VBVX 0.1.0
Header-only C++23 library for safe, zero-copy parsing of packet buffers.
Loading...
Searching...
No Matches
vbvx::BufferView Class Reference

A view over a packet buffer providing access to various protocol headers. More...

#include <buffer_view.hxx>

Public Member Functions

constexpr BufferView (const void *data, uint16_t length) noexcept
constexpr auto data () const noexcept -> std::span< const buffer_t >
 Get the underlying buffer data as a span.
constexpr auto length () const noexcept -> uint16_t
 Get the length of the buffer.
constexpr auto ether_header () const noexcept -> HeaderView< EtherHeader >
 Get Ethernet header view.
constexpr auto ether_type () const noexcept -> std::optional< EtherType >
 Get the EtherType of the packet for possible VLAN tag.
constexpr auto vlan_header () const noexcept -> HeaderView< VlanHeader >
 Get VLAN header view.
constexpr auto vlan_id () const noexcept -> std::optional< uint16_t >
 Get VLAN ID if VLAN tag is present.
constexpr auto l3_offset () const noexcept -> uint16_t
 Get the offset of the Layer 3 header.
constexpr auto arp_header () const noexcept -> HeaderView< ArpHeader >
 Get ARP header view.
constexpr auto ip4_header () const noexcept -> HeaderView< IPv4Header >
 Get IPv4 header view.
constexpr auto ip6_header () const noexcept -> HeaderView< IPv6Header >
 Get IPv6 header view.
constexpr auto ip4_ihl_bytes () const noexcept -> std::optional< uint8_t >
 Get the number of bytes in the IPv4 header.
constexpr auto ip_protocol () const noexcept -> std::optional< IpProtocol >
 Get the IP protocol (IPv4 or IPv6).
constexpr auto l4_offset () const noexcept -> std::optional< uint16_t >
 Get the offset of the Layer 4 header.
constexpr auto tcp_header () const noexcept -> HeaderView< TCPHeader >
 Get TCP header view.
constexpr auto udp_header () const noexcept -> HeaderView< UDPHeader >
 Get UDP header view.
constexpr auto icmp4_header () const noexcept -> HeaderView< ICMPv4Header >
 Get ICMPv4 header view.
constexpr auto icmp6_header () const noexcept -> HeaderView< ICMPv6Header >
 Get ICMPv6 header view.
constexpr auto srv6_header () const noexcept -> HeaderView< SRv6Header >
 Get SRv6 Header view if present.

Detailed Description

A view over a packet buffer providing access to various protocol headers.

Constructor & Destructor Documentation

◆ BufferView()

vbvx::BufferView::BufferView ( const void * data,
uint16_t length )
inlineconstexprnoexcept

Member Function Documentation

◆ arp_header()

auto vbvx::BufferView::arp_header ( ) const -> HeaderView< ArpHeader >
inlineconstexprnoexcept

Get ARP header view.

◆ data()

auto vbvx::BufferView::data ( ) const -> std::span< const buffer_t >
inlineconstexprnoexcept

Get the underlying buffer data as a span.

◆ ether_header()

auto vbvx::BufferView::ether_header ( ) const -> HeaderView< EtherHeader >
inlineconstexprnoexcept

Get Ethernet header view.

◆ ether_type()

auto vbvx::BufferView::ether_type ( ) const -> std::optional< EtherType >
inlineconstexprnoexcept

Get the EtherType of the packet for possible VLAN tag.

◆ icmp4_header()

auto vbvx::BufferView::icmp4_header ( ) const -> HeaderView< ICMPv4Header >
inlineconstexprnoexcept

Get ICMPv4 header view.

◆ icmp6_header()

auto vbvx::BufferView::icmp6_header ( ) const -> HeaderView< ICMPv6Header >
inlineconstexprnoexcept

Get ICMPv6 header view.

◆ ip4_header()

auto vbvx::BufferView::ip4_header ( ) const -> HeaderView< IPv4Header >
inlineconstexprnoexcept

Get IPv4 header view.

◆ ip4_ihl_bytes()

auto vbvx::BufferView::ip4_ihl_bytes ( ) const -> std::optional< uint8_t >
inlineconstexprnoexcept

Get the number of bytes in the IPv4 header.

◆ ip6_header()

auto vbvx::BufferView::ip6_header ( ) const -> HeaderView< IPv6Header >
inlineconstexprnoexcept

Get IPv6 header view.

◆ ip_protocol()

auto vbvx::BufferView::ip_protocol ( ) const -> std::optional< IpProtocol >
inlineconstexprnoexcept

Get the IP protocol (IPv4 or IPv6).

◆ l3_offset()

auto vbvx::BufferView::l3_offset ( ) const -> uint16_t
inlineconstexprnoexcept

Get the offset of the Layer 3 header.

◆ l4_offset()

auto vbvx::BufferView::l4_offset ( ) const -> std::optional< uint16_t >
inlineconstexprnoexcept

Get the offset of the Layer 4 header.

◆ length()

auto vbvx::BufferView::length ( ) const -> uint16_t
inlineconstexprnoexcept

Get the length of the buffer.

◆ srv6_header()

auto vbvx::BufferView::srv6_header ( ) const -> HeaderView< SRv6Header >
inlineconstexprnoexcept

Get SRv6 Header view if present.

◆ tcp_header()

auto vbvx::BufferView::tcp_header ( ) const -> HeaderView< TCPHeader >
inlineconstexprnoexcept

Get TCP header view.

◆ udp_header()

auto vbvx::BufferView::udp_header ( ) const -> HeaderView< UDPHeader >
inlineconstexprnoexcept

Get UDP header view.

◆ vlan_header()

auto vbvx::BufferView::vlan_header ( ) const -> HeaderView< VlanHeader >
inlineconstexprnoexcept

Get VLAN header view.

◆ vlan_id()

auto vbvx::BufferView::vlan_id ( ) const -> std::optional< uint16_t >
inlineconstexprnoexcept

Get VLAN ID if VLAN tag is present.


The documentation for this class was generated from the following file: