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

An IPv4 network. More...

#include <IPRange.h>

Collaboration diagram for swoc::IP4Net:
Collaboration graph

Public Member Functions

 IP4Net ()=default
 Construct invalid network.
 
 IP4Net (self_type const &that)=default
 Copy constructor.
 
 IP4Net (IP4Addr addr, IPMask mask)
 
 IP4Net (swoc::TextView text)
 
bool load (swoc::TextView text)
 
bool empty () const
 
IP4Addr min () const
 
IP4Addr max () const
 
IPMask const & mask () const
 
IP4Range as_range () const
 
self_typeassign (IP4Addr const &addr, IPMask const &mask)
 
self_typeclear ()
 Reset network to invalid state.
 
bool operator== (self_type const &that) const
 Equality.
 
bool operator!= (self_type const &that) const
 Inequality.
 

Protected Attributes

IP4Addr _addr
 Network address (also lower_node).
 
IPMask _mask
 Network mask.
 

Detailed Description

An IPv4 network.

Definition at line 718 of file IPRange.h.

Constructor & Destructor Documentation

◆ IP4Net() [1/2]

swoc::IP4Net::IP4Net ( swoc::IP4Addr addr,
swoc::IPMask mask )
inline

Construct from addr and mask.

Parameters
addrAn address in the network.
maskThe mask for the network.

The network is based on the mask, and the resulting network address is chosen such that the network will contain addr. For a given addr and mask there is only one network that satisifies these criteria.

Definition at line 2120 of file IPRange.h.

◆ IP4Net() [2/2]

swoc::IP4Net::IP4Net ( swoc::TextView text)
inline

Definition at line 735 of file IPRange.h.

Member Function Documentation

◆ as_range()

IP4Range swoc::IP4Net::as_range ( ) const
inline
Returns
A range that exactly covers the network.

Definition at line 2143 of file IPRange.h.

◆ assign()

IP4Net::self_type & swoc::IP4Net::assign ( IP4Addr const & addr,
IPMask const & mask )
inline

Assign an addr and mask to this.

Parameters
addrNetwork addres.
maskNetwork mask.
Returns
this.

Definition at line 2158 of file IPRange.h.

◆ clear()

self_type & swoc::IP4Net::clear ( )
inline

Reset network to invalid state.

Definition at line 769 of file IPRange.h.

◆ empty()

bool swoc::IP4Net::empty ( ) const
inline
Returns
true if the network contains no addresses (is invalid).

Definition at line 2128 of file IPRange.h.

◆ load()

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

Parse network as text.

Parameters
textString describing the network in CIDR format.
Returns
true if a valid string, false if not.

Definition at line 851 of file swoc_ip.cc.

◆ mask()

IPMask const & swoc::IP4Net::mask ( ) const
inline
Returns
The mask for the network.

Definition at line 2123 of file IPRange.h.

◆ max()

IP4Addr swoc::IP4Net::max ( ) const
inline
Returns
The largest address in the network.

Definition at line 2138 of file IPRange.h.

◆ min()

IP4Addr swoc::IP4Net::min ( ) const
inline
Returns
Network address - smallest address in the network.

Definition at line 2133 of file IPRange.h.

◆ operator!=()

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

Inequality.

Definition at line 2153 of file IPRange.h.

◆ operator==()

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

Equality.

Definition at line 2148 of file IPRange.h.

Member Data Documentation

◆ _addr

IP4Addr swoc::IP4Net::_addr
protected

Network address (also lower_node).

Definition at line 781 of file IPRange.h.

◆ _mask

IPMask swoc::IP4Net::_mask
protected

Network mask.

Definition at line 782 of file IPRange.h.


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