IPv4 and IPv6 addresses and networks.
Definition in file ip.hpp.
Go to the source code of this file.
#include <array>
#include <exception>
#include <string>
#include <system_error>
#include <vector>
#include <sys/socket.h>
#include <fmt/format.h>
Classes | |
class | utils::ip::AddressBase< N > |
Base class for IPv4/IPv6 addresses. More... | |
class | utils::ip::NetworkBase< Address, typename > |
Base class for IPv4/IPv6 network. More... | |
class | utils::ip::InetNetwork |
INET IPv4/IPv4 network. More... | |
class | utils::ip::AddressSystemError |
Invalid network or address. More... | |
Namespaces | |
namespace | utils |
Utilities. | |
Typedefs | |
using | utils::ip::AddressV4 = AddressBase<4> |
IPv4 address in network bytes order. | |
using | utils::ip::AddressV6 = AddressBase<16> |
IPv6 address in network bytes order. | |
using | utils::ip::NetworkV4 = NetworkBase<AddressV4> |
IPv4 network. | |
using | utils::ip::NetworkV6 = NetworkBase<AddressV6> |
IPv6 network. | |
Functions | |
AddressV4 | utils::ip::AddressV4FromString (const std::string &str) |
Create an IPv4 address from an IP address string in dotted decimal form. | |
AddressV6 | utils::ip::AddressV6FromString (const std::string &str) |
Create an IPv6 address from an IP address string in dotted decimal form. | |
std::string | utils::ip::AddressV4ToString (const AddressV4 &address) |
Get the address as a string in dotted decimal format. | |
std::string | utils::ip::AddressV6ToString (const AddressV6 &address) |
Get the address as a string in dotted decimal format. | |
NetworkV4 | utils::ip::NetworkV4FromString (const std::string &str) |
Create an IPv4 network from a string containing IP address and prefix length. | |
NetworkV6 | utils::ip::NetworkV6FromString (const std::string &str) |
Create an IPv6 network from a string containing IP address and prefix length. | |
std::string | utils::ip::NetworkV4ToString (const NetworkV4 &network) |
Get the network as an address in dotted decimal format. | |
std::string | utils::ip::NetworkV6ToString (const NetworkV6 &network) |
Get the network as an address in dotted decimal format. | |
NetworkV4 | utils::ip::TransformToCidrFormat (NetworkV4 network) |
Convert NetworkV4 to CIDR format. | |
NetworkV6 | utils::ip::TransformToCidrFormat (NetworkV6 network) |
Convert NetworkV4 to CIDR format. | |
NetworkV4 | utils::ip::NetworkV4FromInetNetwork (const InetNetwork &inet_network) |
Convert InetNetwork to NetworkV4. | |
NetworkV6 | utils::ip::NetworkV6FromInetNetwork (const InetNetwork &inet_network) |
Convert InetNetwork to NetworkV6. | |
InetNetwork | utils::ip::NetworkV4ToInetNetwork (const NetworkV4 &network) |
Convert NetworkV4 to InetNetwork. | |
InetNetwork | utils::ip::NetworkV6ToInetNetwork (const NetworkV6 &network) |
Convert NetworkV6 to InetNetwork. | |
Variables | |
template<typename T > | |
constexpr bool | utils::ip::kIsAddressType |
AddressV4 utils::ip::AddressV4FromString | ( | const std::string & | str | ) |
Create an IPv4 address from an IP address string in dotted decimal form.
AddressSystemError |
NetworkV4 utils::ip::NetworkV4FromString | ( | const std::string & | str | ) |
Create an IPv4 network from a string containing IP address and prefix length.
std::invalid_argument,AddressSystemError |