LibSWOC++ 1.5.14
Solid Wall of C++
Loading...
Searching...
No Matches
swoc::IP6Srv Class Reference

An IPv6 address and host_order_port, modeled on an SRV type for DNS. More...

#include <IPSrv.h>

Collaboration diagram for swoc::IP6Srv:
Collaboration graph

Public Member Functions

 IP6Srv ()=default
 Default constructor.
 
 IP6Srv (IP6Addr addr, in_port_t port=0)
 — IPv6
 
 IP6Srv (IPSrv const &that)
 
 IP6Srv (sockaddr_in6 const *s)
 
 IP6Srv (swoc::TextView text)
 
bool load (swoc::TextView text)
 
constexpr operator IP6Addr const & () const
 Implicit conversion to address.
 
constexpr IP6Addr const & addr () const
 
in_port_t host_order_port () const
 
in_port_t network_order_port () const
 
bool operator== (self_type that) const
 
bool operator!= (self_type that) const
 
bool operator< (self_type that) const
 
bool operator<= (self_type const &that) const
 
bool operator> (self_type const &that) const
 
bool operator>= (self_type const &that) const
 
self_typeassign (IP6Addr const &addr)
 
self_typeassign (in_port_t port)
 
self_typeassign (IP6Addr const &addr, in_port_t port)
 
self_typeassign (sockaddr_in6 const *s)
 

Static Public Member Functions

static constexpr sa_family_t family ()
 

Protected Attributes

IP6Addr _addr
 Address.
 
in_port_t _port = 0
 Port [host order].
 

Detailed Description

An IPv6 address and host_order_port, modeled on an SRV type for DNS.

Definition at line 123 of file IPSrv.h.

Constructor & Destructor Documentation

◆ IP6Srv() [1/4]

swoc::IP6Srv::IP6Srv ( IP6Addr addr,
in_port_t port = 0 )
inlineexplicit

— IPv6

Construct from address and host_order_port.

Parameters
addrThe address.
portThe port in host order, defaults to 0.

Definition at line 476 of file IPSrv.h.

◆ IP6Srv() [2/4]

swoc::IP6Srv::IP6Srv ( IPSrv const & that)
inlineexplicit

Construct from generic.

Parameters
thatThe generic SRV.

If that is not IPv6 the result is a default constructed instance.

Definition at line 477 of file IPSrv.h.

◆ IP6Srv() [3/4]

swoc::IP6Srv::IP6Srv ( sockaddr_in6 const * s)
inlineexplicit

Construct from a socket address.

Parameters
sSocket address.

Definition at line 478 of file IPSrv.h.

◆ IP6Srv() [4/4]

swoc::IP6Srv::IP6Srv ( swoc::TextView text)
explicit

Construct from a string.

Parameters
textInput text.

If the port is not present it is set to zero.

Definition at line 764 of file swoc_ip.cc.

Member Function Documentation

◆ addr()

IP6Addr const & swoc::IP6Srv::addr ( ) const
inlineconstexpr
Returns
The address.

Definition at line 484 of file IPSrv.h.

◆ assign() [1/4]

auto swoc::IP6Srv::assign ( in_port_t port)
inline

Assign a port.

Parameters
portPort [host order].
Returns
this.

Definition at line 526 of file IPSrv.h.

◆ assign() [2/4]

auto swoc::IP6Srv::assign ( IP6Addr const & addr)
inline

Change the address.

Parameters
addrAddress to assign.
Returns
this

Definition at line 532 of file IPSrv.h.

◆ assign() [3/4]

auto swoc::IP6Srv::assign ( IP6Addr const & addr,
in_port_t port )
inline

Assign an address and port.

Parameters
addrAddress.
portPort [host order].
Returns
this

Definition at line 538 of file IPSrv.h.

◆ assign() [4/4]

auto swoc::IP6Srv::assign ( sockaddr_in6 const * s)
inline

Change the address and port.

Parameters
sA socket address.
Returns
this

Definition at line 545 of file IPSrv.h.

◆ family()

sa_family_t swoc::IP6Srv::family ( )
inlinestaticconstexpr

The protocol family.

Returns
AF_INET6
Note
Useful primarily for template classes.

Definition at line 496 of file IPSrv.h.

◆ host_order_port()

in_port_t swoc::IP6Srv::host_order_port ( ) const
inline
Returns
The port in host order.

Definition at line 488 of file IPSrv.h.

◆ load()

bool swoc::IP6Srv::load ( swoc::TextView text)

Load from a string.

Parameters
textInput string.
Returns
true if text in a valid format, false if not.

Definition at line 769 of file swoc_ip.cc.

◆ network_order_port()

in_port_t swoc::IP6Srv::network_order_port ( ) const
inline
Returns
The port in network order.

Definition at line 492 of file IPSrv.h.

◆ operator IP6Addr const &()

swoc::IP6Srv::operator IP6Addr const & ( ) const
inlineconstexpr

Implicit conversion to address.

Definition at line 480 of file IPSrv.h.

◆ operator!=()

bool swoc::IP6Srv::operator!= ( IP6Srv::self_type that) const
inline

Definition at line 505 of file IPSrv.h.

◆ operator<()

bool swoc::IP6Srv::operator< ( IP6Srv::self_type that) const
inline

Definition at line 508 of file IPSrv.h.

◆ operator<=()

bool swoc::IP6Srv::operator<= ( IP6Srv::self_type const & that) const
inline

Definition at line 512 of file IPSrv.h.

◆ operator==()

bool swoc::IP6Srv::operator== ( IP6Srv::self_type that) const
inline

Definition at line 501 of file IPSrv.h.

◆ operator>()

bool swoc::IP6Srv::operator> ( IP6Srv::self_type const & that) const
inline

Definition at line 517 of file IPSrv.h.

◆ operator>=()

bool swoc::IP6Srv::operator>= ( IP6Srv::self_type const & that) const
inline

Definition at line 521 of file IPSrv.h.

Member Data Documentation

◆ _addr

IP6Addr swoc::IP6Srv::_addr
protected

Address.

Definition at line 219 of file IPSrv.h.

◆ _port

in_port_t swoc::IP6Srv::_port = 0
protected

Port [host order].

Definition at line 220 of file IPSrv.h.


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