VIPA 0.1.0
Header-only C++23 SIMD-assisted IPv4/IPv6 text parser.
Loading...
Searching...
No Matches
llmx::vipa Namespace Reference

Namespaces

namespace  detail

Classes

struct  IPv4Address
 Parsed IPv4 address in network byte order. More...
struct  IPv6Address
 Parsed IPv6 address in network byte order. More...
struct  ParseResult
 Address parser result with the concrete address family. More...

Typedefs

using Address = std::variant<IPv4Address, IPv6Address>
 Parsed IPv4 or IPv6 address value.

Enumerations

enum class  AddressFamily : uint8_t { IPv4 , IPv6 }
 Parsed IP address family. More...

Functions

auto parse_ipv4 (std::string_view text) noexcept -> std::optional< IPv4Address >
 Parse strict dotted-decimal IPv4 text.
template<std::size_t N>
auto parse_ipv4 (const char(&text)[N]) noexcept -> std::optional< IPv4Address >
 Parse a fixed character array as IPv4 text.
auto parse_ipv6 (std::string_view text) noexcept -> std::optional< IPv6Address >
 Parse IPv6 text into sixteen network-order bytes.
auto parse_address (std::string_view text) noexcept -> std::optional< ParseResult >
 Parse an IPv4 or IPv6 text address.

Typedef Documentation

◆ Address

Parsed IPv4 or IPv6 address value.

Enumeration Type Documentation

◆ AddressFamily

enum class llmx::vipa::AddressFamily : uint8_t
strong

Parsed IP address family.

Enumerator
IPv4 
IPv6 

Function Documentation

◆ parse_address()

auto llmx::vipa::parse_address ( std::string_view text) -> std::optional< ParseResult >
inlinenodiscardnoexcept

Parse an IPv4 or IPv6 text address.

IPv4 parsing is attempted first. On success, the returned family identifies which variant member is stored in the result.

Parameters
textAddress text to parse.
Returns
Parsed address and family, or std::nullopt for malformed input.

◆ parse_ipv4() [1/2]

template<std::size_t N>
auto llmx::vipa::parse_ipv4 ( const char(&) text[N]) -> std::optional< IPv4Address >
inlinenodiscardnoexcept

Parse a fixed character array as IPv4 text.

A trailing NUL byte is excluded from the parsed view when present.

◆ parse_ipv4() [2/2]

auto llmx::vipa::parse_ipv4 ( std::string_view text) -> std::optional< IPv4Address >
inlinenodiscardnoexcept

Parse strict dotted-decimal IPv4 text.

Accepted addresses contain exactly four decimal octets separated by dots. Leading-zero multi-digit octets and values above 255 are rejected.

Parameters
textIPv4 address text.
Returns
Parsed address bytes, or std::nullopt for malformed input.

◆ parse_ipv6()

auto llmx::vipa::parse_ipv6 ( std::string_view text) -> std::optional< IPv6Address >
inlinenodiscardnoexcept

Parse IPv6 text into sixteen network-order bytes.

Supports full and ::-compressed forms, including IPv4-embedded tails. Rejects malformed text, multiple compression markers, invalid hexadecimal groups, overlong addresses, and invalid IPv4 tails.

Parameters
textIPv6 address text.
Returns
Parsed address bytes, or std::nullopt for malformed input.