userver: utils::ip::NetworkBase< Address, typename > Class Template Reference
Loading...
Searching...
No Matches
utils::ip::NetworkBase< Address, typename > Class Template Referencefinal

#include <userver/utils/ip.hpp>

Detailed Description

template<typename Address, typename = std::enable_if_t<kIsAddressType<Address>>>
class utils::ip::NetworkBase< Address, typename >

Base class for IPv4/IPv6 network.

Definition at line 83 of file ip.hpp.

Public Types

using AddressType = Address
 

Public Member Functions

 NetworkBase (const AddressType &address, unsigned short prefix_length)
 
AddressType GetAddress () const noexcept
 Get the address address of network.
 
unsigned char GetPrefixLength () const noexcept
 Get prefix length of address network.
 
bool ContainsAddress (const AddressType &address) const
 Returns true if the address is in network.
 

Static Public Attributes

static constexpr unsigned char kMaximumPrefixLength = std::is_same_v<Address, AddressV4> ? 32 : 128
 

Member Typedef Documentation

◆ AddressType

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
using utils::ip::NetworkBase< Address, typename >::AddressType = Address

Definition at line 85 of file ip.hpp.

Constructor & Destructor Documentation

◆ NetworkBase()

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
utils::ip::NetworkBase< Address, typename >::NetworkBase ( const AddressType & address,
unsigned short prefix_length )
inline

Definition at line 90 of file ip.hpp.

Member Function Documentation

◆ ContainsAddress()

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
bool utils::ip::NetworkBase< Address, typename >::ContainsAddress ( const AddressType & address) const
inline

Returns true if the address is in network.

Definition at line 106 of file ip.hpp.

◆ GetAddress()

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
AddressType utils::ip::NetworkBase< Address, typename >::GetAddress ( ) const
inlinenoexcept

Get the address address of network.

Definition at line 100 of file ip.hpp.

◆ GetPrefixLength()

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
unsigned char utils::ip::NetworkBase< Address, typename >::GetPrefixLength ( ) const
inlinenoexcept

Get prefix length of address network.

Definition at line 103 of file ip.hpp.

Friends And Related Symbol Documentation

◆ operator!=

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
bool operator!= ( const NetworkBase< Address > & a,
const NetworkBase< Address > & b )
friend

Definition at line 129 of file ip.hpp.

◆ operator==

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
bool operator== ( const NetworkBase< Address > & a,
const NetworkBase< Address > & b )
friend

Definition at line 125 of file ip.hpp.

Member Data Documentation

◆ kMaximumPrefixLength

template<typename Address , typename = std::enable_if_t<kIsAddressType<Address>>>
constexpr unsigned char utils::ip::NetworkBase< Address, typename >::kMaximumPrefixLength = std::is_same_v<Address, AddressV4> ? 32 : 128
staticconstexpr

Definition at line 86 of file ip.hpp.


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