xorp

IPvXNet Class Reference

IPvXNet class. More...

#include <ipvxnet.hh>

Inheritance diagram for IPvXNet:
IPNet< A >

List of all members.

Public Member Functions

 IPvXNet (int family) throw (InvalidFamily)
 Constructor for a specified address family.
 IPvXNet (const BaseIPvXNet &n)
 Copy constructor for BaseIPvXNet subnet address.
 IPvXNet (const IPvXNet &n)
 Copy constructor for IPvXNet subnet address.
 IPvXNet (const IPv4Net &v4net)
 Copy constructor for IPv4Net subnet address.
 IPvXNet (const IPv6Net &v6net)
 Copy constructor for IPv6Net subnet address.
 IPvXNet (const char *cp) throw (InvalidString, InvalidNetmaskLength)
 Constructor from a string.
 IPvXNet (const IPvX &a, uint8_t prefix_len) throw (InvalidNetmaskLength)
 Constructor from a given base address and a prefix length.
bool is_ipv4 () const
 Test if this subnet is IPv4 subnet.
bool is_ipv6 () const
 Test if this subnet is IPv6 subnet.
IPv4Net get_ipv4net () const throw (InvalidCast)
 Get IPv4Net subnet.
IPv6Net get_ipv6net () const throw (InvalidCast)
 Get IPv6Net subnet.
void get (IPv4Net &to_ipv4net) const throw (InvalidCast)
 Assign address value to an IPv4Net subnet.
void get (IPv6Net &to_ipv6net) const throw (InvalidCast)
 Assign address value to an IPv6Net subnet.
int af () const
 Get the address family.
bool is_unicast () const
 Test if this subnet is a unicast prefix.
bool is_multicast () const
 Test if this subnet is within the multicast address range.
bool is_class_a () const
 Test if this subnet is within the IPv4 Class A address range (0.0.0.0/1).
bool is_class_b () const
 Test if this subnet is within the IPv4 Class B address range (128.0.0.0/2).
bool is_class_c () const
 Test if this subnet is within the IPv4 Class C address range (192.0.0.0/3).
bool is_experimental () const
 Test if this subnet is within the IPv4 experimental Class E address range (240.0.0.0/4).

Static Public Member Functions

static IPvXNet ip_multicast_base_prefix (int family) throw (InvalidFamily)
 Return the subnet containing all multicast addresses.
static IPvXNet ip_class_a_base_prefix (int family) throw (InvalidFamily)
 Return the subnet containing all IPv4 Class A addresses (0.0.0.0/1).
static IPvXNet ip_class_b_base_prefix (int family) throw (InvalidFamily)
 Return the subnet containing all IPv4 Class B addresses (128.0.0.0/2).
static IPvXNet ip_class_c_base_prefix (int family) throw (InvalidFamily)
 Return the subnet containing all IPv4 Class C addresses (192.0.0.0/3).
static IPvXNet ip_experimental_base_prefix (int family) throw (InvalidFamily)
 Return the subnet containing all IPv4 experimental Class E addresses (240.0.0.0/4).

Detailed Description

IPvXNet class.

Container for IPv4 and IPv6 networks.

Also see IPNet for available methods.


Constructor & Destructor Documentation

IPvXNet::IPvXNet ( int  family) throw (InvalidFamily) [inline, explicit]

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:
familythe address family.
IPvXNet::IPvXNet ( const BaseIPvXNet n) [inline]

Copy constructor for BaseIPvXNet subnet address.

Parameters:
nthe subnet to copy from.
IPvXNet::IPvXNet ( const IPvXNet n) [inline]

Copy constructor for IPvXNet subnet address.

Parameters:
nthe subnet to copy from.
IPvXNet::IPvXNet ( const IPv4Net v4net) [inline]

Copy constructor for IPv4Net subnet address.

Parameters:
v4netthe subnet to copy from.
IPvXNet::IPvXNet ( const IPv6Net v6net) [inline]

Copy constructor for IPv6Net subnet address.

Parameters:
v6netthe subnet to copy from.
IPvXNet::IPvXNet ( const char *  cp) throw (InvalidString, InvalidNetmaskLength) [inline]

Constructor from a string.

Parameters:
from_cstringC-style string with slash separated address and prefix length. Examples: "12.34.56/24", "1234:5678/32::"
IPvXNet::IPvXNet ( const IPvX a,
uint8_t  prefix_len 
) throw (InvalidNetmaskLength) [inline]

Constructor from a given base address and a prefix length.

Parameters:
abase address for the subnet.
prefix_lenlength of subnet mask.

Member Function Documentation

int IPvXNet::af ( ) const [inline]

Get the address family.

Returns:
the address family of this subnet (AF_INET or AF_INET6).
void IPvXNet::get ( IPv4Net to_ipv4net) const throw (InvalidCast) [inline]

Assign address value to an IPv4Net subnet.

Parameters:
to_ipv4netIPv4Net subnet to be assigned IPv4Net value contained within this subnet.
void IPvXNet::get ( IPv6Net to_ipv6net) const throw (InvalidCast) [inline]

Assign address value to an IPv6Net subnet.

Parameters:
to_ipv6netIPv6Net subnet to be assigned IPv6Net value contained within this subnet.
IPv4Net IPvXNet::get_ipv4net ( ) const throw (InvalidCast) [inline]

Get IPv4Net subnet.

Returns:
IPv4Net subnet contained with IPvXNet structure.
IPv6Net IPvXNet::get_ipv6net ( ) const throw (InvalidCast) [inline]

Get IPv6Net subnet.

Returns:
IPv6Net subnet contained with IPvXNet structure.
static IPvXNet IPvXNet::ip_class_a_base_prefix ( int  family) throw (InvalidFamily) [inline, static]

Return the subnet containing all IPv4 Class A addresses (0.0.0.0/1).

This method applies only for IPv4. Note that this is a static function and can be used without a particular object. Example: IPvXNet my_prefix = IPvXNet::ip_class_a_base_prefix(my_family);

Parameters:
familythe address family.
Returns:
the Class A base prefix address for address family of family.
static IPvXNet IPvXNet::ip_class_b_base_prefix ( int  family) throw (InvalidFamily) [inline, static]

Return the subnet containing all IPv4 Class B addresses (128.0.0.0/2).

This method applies only for IPv4. Note that this is a static function and can be used without a particular object. Example: IPvXNet my_prefix = IPvXNet::ip_class_b_base_prefix(my_family);

Parameters:
familythe address family.
Returns:
the Class B base prefix address for address family of family.
static IPvXNet IPvXNet::ip_class_c_base_prefix ( int  family) throw (InvalidFamily) [inline, static]

Return the subnet containing all IPv4 Class C addresses (192.0.0.0/3).

This method applies only for IPv4. Note that this is a static function and can be used without a particular object. Example: IPvXNet my_prefix = IPvXNet::ip_class_c_base_prefix(my_family);

Parameters:
familythe address family.
Returns:
the Class C base prefix address for address family of family.
static IPvXNet IPvXNet::ip_experimental_base_prefix ( int  family) throw (InvalidFamily) [inline, static]

Return the subnet containing all IPv4 experimental Class E addresses (240.0.0.0/4).

This method applies only for IPv4. Note that this is a static function and can be used without a particular object. Example: IPvXNet my_prefix = IPvXNet::ip_experimental_base_prefix(my_family);

Parameters:
familythe address family.
Returns:
the experimental base prefix address for address family of family.
static IPvXNet IPvXNet::ip_multicast_base_prefix ( int  family) throw (InvalidFamily) [inline, static]

Return the subnet containing all multicast addresses.

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:
familythe address family.
Returns:
the multicast base prefix address for address family of family.
bool IPvXNet::is_class_a ( ) const [inline]

Test if this subnet is within the IPv4 Class A address range (0.0.0.0/1).

This method applies only for IPv4, and always returns false for IPv6.

Returns:
true if this subnet is within the IPv4 Class A address range.

Reimplemented from IPNet< A >.

bool IPvXNet::is_class_b ( ) const [inline]

Test if this subnet is within the IPv4 Class B address range (128.0.0.0/2).

This method applies only for IPv4, and always returns false for IPv6.

Returns:
true if this subnet is within the IPv4 Class B address range.

Reimplemented from IPNet< A >.

bool IPvXNet::is_class_c ( ) const [inline]

Test if this subnet is within the IPv4 Class C address range (192.0.0.0/3).

This method applies only for IPv4, and always returns false for IPv6.

Returns:
true if this subnet is within the IPv4 Class C address range.

Reimplemented from IPNet< A >.

bool IPvXNet::is_experimental ( ) const [inline]

Test if this subnet is within the IPv4 experimental Class E address range (240.0.0.0/4).

This method applies only for IPv4, and always returns false for IPv6.

Returns:
true if this subnet is within the IPv4 experimental address range.

Reimplemented from IPNet< A >.

bool IPvXNet::is_ipv4 ( ) const [inline]

Test if this subnet is IPv4 subnet.

Returns:
true if the subnet is IPv4.
bool IPvXNet::is_ipv6 ( ) const [inline]

Test if this subnet is IPv6 subnet.

Returns:
true if the subnet is IPv6.
bool IPvXNet::is_multicast ( ) const [inline]

Test if this subnet is within the multicast address range.

Returns:
true if this subnet is within the multicast address range.

Reimplemented from IPNet< A >.

bool IPvXNet::is_unicast ( ) const [inline]

Test if this subnet is a unicast prefix.

In case of IPv4 all prefixes that fall within the Class A, Class B or Class C address space are unicast. In case of IPv6 all prefixes that don't contain the multicast address space are unicast. Note that the default route (0.0.0.0/0 for IPv4 or ::/0 for IPv6) is also considered an unicast prefix.

Returns:
true if this subnet is a unicast prefix.

Reimplemented from IPNet< A >.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations