either a domain name (as defined in DNS RFC 1034) or an IP address More...

#include <Host.h>

Collaboration diagram for AnyP::Host:

Public Member Functions

auto ip () const
 
auto domainName () const
 stored domain name (if any) More...
 

Static Public Member Functions

static std::optional< HostParseIp (const Ip::Address &)
 converts an already parsed IP address to a Host object More...
 
static std::optional< HostParseSimpleDomainName (const SBuf &)
 
static std::optional< HostParseWildDomainName (const SBuf &)
 

Private Types

using Storage = std::variant< Ip::Address, Dns::DomainName >
 

Private Member Functions

 Host (const Storage &raw)
 

Static Private Member Functions

static std::optional< HostParseDomainName (const SBuf &)
 common parts of FromSimpleDomain() and FromWildDomain() More...
 

Private Attributes

Storage raw_
 the host we are providing access to More...
 

Detailed Description

Definition at line 24 of file Host.h.

Member Typedef Documentation

◆ Storage

using AnyP::Host::Storage = std::variant<Ip::Address, Dns::DomainName>
private

Definition at line 51 of file Host.h.

Constructor & Destructor Documentation

◆ Host()

AnyP::Host::Host ( const Storage raw)
inlineprivate

Definition at line 56 of file Host.h.

Referenced by ParseIp().

Member Function Documentation

◆ domainName()

auto AnyP::Host::domainName ( ) const
inline

Definition at line 48 of file Host.h.

References raw_.

Referenced by Ssl::GeneralNameMatcher::match(), and AnyP::operator<<().

◆ ip()

auto AnyP::Host::ip ( ) const
inline

stored IPv or IPv6 address (if any)

Ip::Address::isNoAddr() may be true for the returned address. Ip::Address::isAnyAddr() may be true for the returned address.

Definition at line 45 of file Host.h.

References raw_.

Referenced by Ssl::GeneralNameMatcher::match(), AnyP::operator<<(), and ParseIp().

◆ ParseDomainName()

std::optional< AnyP::Host > AnyP::Host::ParseDomainName ( const SBuf rawName)
staticprivate

Definition at line 24 of file Host.cc.

References debugs, SBuf::find(), SBuf::isEmpty(), and SBuf::npos.

◆ ParseIp()

std::optional< AnyP::Host > AnyP::Host::ParseIp ( const Ip::Address ip)
static

Definition at line 15 of file Host.cc.

References debugs, Host(), and ip().

Referenced by Ssl::ParseAsSimpleDomainNameOrIp(), AnyP::Uri::parsedHost(), and ParseSubjectAltName().

◆ ParseSimpleDomainName()

std::optional< AnyP::Host > AnyP::Host::ParseSimpleDomainName ( const SBuf rawName)
static

Parses input as a literal ASCII domain name (A-labels OK; see RFC 5890). Does not allow wildcards;

See also
ParseWildDomainName().

Definition at line 49 of file Host.cc.

References debugs, SBuf::find(), and SBuf::npos.

Referenced by Acl::ServerNameCheck::match(), Ssl::ParseAsSimpleDomainNameOrIp(), and AnyP::Uri::parsedHost().

◆ ParseWildDomainName()

std::optional< AnyP::Host > AnyP::Host::ParseWildDomainName ( const SBuf rawName)
static

Same as ParseSimpleDomainName() but allows the first label to be a wildcard (RFC 9525 Section 6.3).

Definition at line 59 of file Host.cc.

References debugs, SBuf::find(), SBuf::npos, and SBuf::startsWith().

Referenced by ParseSubjectAltName().

Member Data Documentation

◆ raw_

Storage AnyP::Host::raw_
private

Definition at line 58 of file Host.h.

Referenced by domainName(), and ip().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors