IPvXNet class. Container for IPv4 and IPv6 networks.
Also see IPNet for available methods.
explicit IPvXNet (int family)
throw (InvalidFamily) | IPvXNet |
Constructor for a specified address family.
Creates a network address of specified family, and address value of INADDR_ANY or IN6ADDR_ANY (for IPv4 and IPv6 respectively).
Parameters:
family | the address family. |
IPvXNet (const BaseIPvXNet& n)
| IPvXNet |
Copy constructor for BaseIPvXNet subnet address
Parameters:
n | the subnet to copy from. |
IPvXNet (const IPvXNet& n)
| IPvXNet |
Copy constructor for IPvXNet subnet address
Parameters:
n | the subnet to copy from. |
IPvXNet (const IPv4Net& v4net)
| IPvXNet |
Copy constructor for IPv4Net subnet address
Parameters:
v4net | the subnet to copy from. |
IPvXNet (const IPv6Net& v6net)
| IPvXNet |
Copy constructor for IPv6Net subnet address
Parameters:
v6net | the subnet to copy from. |
IPvXNet (const char *cp)
throw (InvalidString, InvalidNetmaskLength) | IPvXNet |
Constructor from a string.
Parameters:
from_cstring | C-style string with slash separated address and prefix length. Examples: "12.34.56/24", "1234:5678/32::" |
IPvXNet (const IPvX& a, uint32_t prefix_len)
throw (InvalidNetmaskLength) | IPvXNet |
Constructor from a given base address and a prefix length.
Parameters:
a | base address for the subnet. |
prefix_len | length of subnet mask. |
inline bool is_ipv4 ()
| is_ipv4 |
[const]
Test if this subnet is IPv4 subnet.
Returns: true if the subnet is IPv4.
inline bool is_ipv6 ()
| is_ipv6 |
[const]
Test if this subnet is IPv6 subnet.
Returns: true if the subnet is IPv6.
inline IPv4Net get_ipv4net ()
throw (InvalidCast) | get_ipv4net |
[const]
Get IPv4Net subnet.
Returns: IPv4Net subnet contained with IPvXNet structure.
inline IPv6Net get_ipv6net ()
throw (InvalidCast) | get_ipv6net |
[const]
Get IPv6Net subnet.
Returns: IPv6Net subnet contained with IPvXNet structure.
inline void get (IPv4Net& to_ipv4net)
throw (InvalidCast) | get |
[const]
Assign address value to an IPv4Net subnet.
Parameters:
to_ipv4net | IPv4Net subnet to be assigned IPv4Net value contained within this subnet. |
inline void get (IPv6Net& to_ipv6net)
throw (InvalidCast) | get |
[const]
Assign address value to an IPv6Net subnet.
Parameters:
to_ipv6net | IPv6Net subnet to be assigned IPv6Net value contained within this subnet. |
inline int af ()
| af |
[const]
Get the address family.
Returns: the address family of this subnet (AF_INET or AF_INET6).
inline IPvXNet ip_multicast_base_prefix (int family)
throw (InvalidFamily) | ip_multicast_base_prefix |
[static]
Get the multicast base subnet.
Note that this is a static function and can be used without a particular object. Example: IPvXNet my_prefix = IPvXNet::ip_multicast_base_prefix(my_family);
Parameters:
family | the address family. |
Returns: the multicast base prefix address for address family of family.
bool is_multicast ()
| is_multicast |
[const]
Test if this subnet is a valid multicast prefix address.
Returns: true if this is a valid multicast prefix address.