Clementine
Public Member Functions | Friends | Related Functions | List of all members
asio::ip::network_v4 Class Reference

Represents an IPv4 network. More...

#include <network_v4.hpp>

Public Member Functions

 network_v4 () ASIO_NOEXCEPT
 Default constructor.
 
ASIO_DECL network_v4 (const address_v4 &addr, unsigned short prefix_len)
 Construct a network based on the specified address and prefix length.
 
ASIO_DECL network_v4 (const address_v4 &addr, const address_v4 &mask)
 Construct network based on the specified address and netmask.
 
 network_v4 (const network_v4 &other) ASIO_NOEXCEPT
 Copy constructor.
 
network_v4operator= (const network_v4 &other) ASIO_NOEXCEPT
 Assign from another network.
 
address_v4 address () const ASIO_NOEXCEPT
 Obtain the address object specified when the network object was created.
 
unsigned short prefix_length () const ASIO_NOEXCEPT
 Obtain the prefix length that was specified when the network object was created. More...
 
ASIO_DECL address_v4 netmask () const ASIO_NOEXCEPT
 Obtain the netmask that was specified when the network object was created.
 
address_v4 network () const ASIO_NOEXCEPT
 Obtain an address object that represents the network address.
 
address_v4 broadcast () const ASIO_NOEXCEPT
 Obtain an address object that represents the network's broadcast address.
 
ASIO_DECL address_v4_range hosts () const ASIO_NOEXCEPT
 Obtain an address range corresponding to the hosts in the network.
 
network_v4 canonical () const ASIO_NOEXCEPT
 Obtain the true network address, omitting any host bits.
 
bool is_host () const ASIO_NOEXCEPT
 Test if network is a valid host address.
 
ASIO_DECL bool is_subnet_of (const network_v4 &other) const
 Test if a network is a real subnet of another network.
 
ASIO_DECL std::string to_string () const
 Get the network as an address in dotted decimal format.
 
ASIO_DECL std::string to_string (asio::error_code &ec) const
 Get the network as an address in dotted decimal format.
 

Friends

bool operator== (const network_v4 &a, const network_v4 &b)
 Compare two networks for equality.
 
bool operator!= (const network_v4 &a, const network_v4 &b)
 Compare two networks for inequality.
 

Related Functions

(Note that these are not member functions.)

ASIO_DECL network_v4 make_network_v4 (const char *str)
 Create an IPv4 network from a string containing IP address and prefix length.
 
ASIO_DECL network_v4 make_network_v4 (const char *str, asio::error_code &ec)
 Create an IPv4 network from a string containing IP address and prefix length.
 
ASIO_DECL network_v4 make_network_v4 (const std::string &str)
 Create an IPv4 network from a string containing IP address and prefix length.
 
ASIO_DECL network_v4 make_network_v4 (const std::string &str, asio::error_code &ec)
 Create an IPv4 network from a string containing IP address and prefix length.
 

Detailed Description

Represents an IPv4 network.

The asio::ip::network_v4 class provides the ability to use and manipulate IP version 4 networks.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.

Member Function Documentation

◆ prefix_length()

unsigned short asio::ip::network_v4::prefix_length ( ) const
inline

Obtain the prefix length that was specified when the network object was created.


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