senf::INet6Network Class Reference

INet6 network prefix. More...

#include <senf/Socket/Protocols/INet/INet6Address.hh>

Inheritance diagram for senf::INet6Network:

Public Member Functions

INet6Address const & address () const
 Get the network address. More...
 
unsigned prefix_len () const
 Get the network prefix length. More...
 
bool boolean_test () const
 true, if INet6Network is non-empty More...
 
bool operator== (INet6Network const &other) const
 Compare two networks for equality. More...
 
bool match (INet6Address const &addr) const
 true, if the network includes addr More...
 
bool match (INet6Network const &net) const
 true, if the network includes net More...
 
INet6Address host (boost::uint64_t id)
 Return the host with the given id. More...
 
INet6Network subnet (boost::uint64_t net, unsigned prefix_len)
 Return the given subnet of this. More...
 
- Public Member Functions inherited from senf::comparable_safe_bool< INet6Network >
 operator bool_type () const
 
bool operator! () const
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, INet6Network const &addr)
 Output INet6Network instance as it's string representation. More...
 
std::istream & operator>> (std::istream &is, INet6Network &addr)
 Try to initialize INet6Network instance from a string representation. More...
 

Structors and default members

 INet6Network ()
 Construct empty (::/0) network. More...
 
 INet6Network (INet6Address const &address, unsigned prefix_len)
 Construct network from given address and prefix length. More...
 
 INet6Network (std::string const &s)
 Construct network from CIDR notation. More...
 

Additional Inherited Members

- Protected Types inherited from senf::safe_bool_base
typedef void(safe_bool_base::* bool_type) () const
 
- Protected Member Functions inherited from senf::comparable_safe_bool< INet6Network >
 ~comparable_safe_bool ()
 
- Protected Member Functions inherited from senf::safe_bool_base
void this_type_does_not_support_comparisons () const
 
 safe_bool_base ()
 
 safe_bool_base (const safe_bool_base &)
 
safe_bool_baseoperator= (const safe_bool_base &)
 
 ~safe_bool_base ()
 

Detailed Description

INet6 network prefix.

This class represents an INet6 network prefix in CIDR notation.

Definition at line 335 of file INet6Address.hh.

Constructor & Destructor Documentation

◆ INet6Network() [1/3]

senf::INet6Network::INet6Network ( )

Construct empty (::/0) network.

◆ INet6Network() [2/3]

senf::INet6Network::INet6Network ( INet6Address const &  address,
unsigned  prefix_len 
)

Construct network from given address and prefix length.

◆ INet6Network() [3/3]

senf::INet6Network::INet6Network ( std::string const &  s)
explicit

Construct network from CIDR notation.

Definition at line 152 of file INet6Address.cc.

Member Function Documentation

◆ address()

INet6Address const& senf::INet6Network::address ( ) const

Get the network address.

◆ boolean_test()

bool senf::INet6Network::boolean_test ( ) const

true, if INet6Network is non-empty

◆ host()

INet6Address senf::INet6Network::host ( boost::uint64_t  id)

Return the host with the given id.

Returns the host with the given number within the network. This call replaces the lower 64 bits of the network address with the given id.

◆ match() [1/2]

bool senf::INet6Network::match ( INet6Address const &  addr) const

true, if the network includes addr

◆ match() [2/2]

bool senf::INet6Network::match ( INet6Network const &  net) const

true, if the network includes net

The is true, if net is sub-network (or the same as) this.

◆ operator==()

bool senf::INet6Network::operator== ( INet6Network const &  other) const

Compare two networks for equality.

◆ prefix_len()

unsigned senf::INet6Network::prefix_len ( ) const

Get the network prefix length.

◆ subnet()

INet6Network senf::INet6Network::subnet ( boost::uint64_t  net,
unsigned  prefix_len 
)

Return the given subnet of this.

The returned INet6Network will be a subnet of this with the given network number. The network number is comprised by the bits above prefix_len:

INet6Network("2001:db8::/32").subnet(0x12u,40u) == INet6Network("2001:db8:1200::/40")
INet6Network("2001:db8:1200::/40").subnet(0x2345,64u) == INet6Network("2001:db8:1200:2345::/64")
Parameters
[in]netnetwork number
[in]prefix_lenlength of subnet prefix

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
INet6Network const &  addr 
)
related

Output INet6Network instance as it's string representation.

◆ operator>>()

std::istream & operator>> ( std::istream &  is,
INet6Network addr 
)
related

Try to initialize INet6Network instance from a string representation.

sets std::ios::failbit on the stream if an error occurred


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