xorp

VifAddr Class Reference

Virtual interface address class. More...

#include <vif.hh>

List of all members.

Public Member Functions

 VifAddr (const IPvX &ipvx_addr)
 Constructor for a given address.
 VifAddr (const IPvX &ipvx_addr, const IPvXNet &ipvx_subnet_addr, const IPvX &ipvx_broadcast_addr, const IPvX &ipvx_peer_addr)
 Constructor for a given address, and its associated addresses.
const IPvXaddr () const
 Get the interface address.
const IPvXNetsubnet_addr () const
 Get the subnet address.
const IPvXbroadcast_addr () const
 Get the broadcast address.
const IPvXpeer_addr () const
 Get the peer address.
void set_addr (const IPvX &v)
 Set the interface address.
void set_subnet_addr (const IPvXNet &v)
 Set the subnet address.
void set_broadcast_addr (const IPvX &v)
 Set the broadcast address.
void set_peer_addr (const IPvX &v)
 Set the peer address.
bool is_my_addr (const IPvX &ipvx_addr) const
 Test whether if an IPvX address is same as my address.
bool is_same_subnet (const IPvXNet &ipvxnet) const
 Test if a given subnet address is a subset of my subnet address.
bool is_same_subnet (const IPvX &ipvx_addr) const
 Test whether an address belongs to my subnet address.
string str () const
 Convert this address from binary form to presentation format.
bool operator== (const VifAddr &other) const
 Equality Operator.

Private Attributes

IPvX _addr
IPvXNet _subnet_addr
IPvX _broadcast_addr
IPvX _peer_addr

Detailed Description

Virtual interface address class.

VifAddr holds information about an address of a virtual interface. A virtual interface may have more than one VifAddr.


Constructor & Destructor Documentation

VifAddr::VifAddr ( const IPvX ipvx_addr) [explicit]

Constructor for a given address.

Parameters:
ipvx_addrthe interface address.
VifAddr::VifAddr ( const IPvX ipvx_addr,
const IPvXNet ipvx_subnet_addr,
const IPvX ipvx_broadcast_addr,
const IPvX ipvx_peer_addr 
)

Constructor for a given address, and its associated addresses.

Parameters:
ipvx_addrthe interface address.
ipvx_subnet_addrthe subnet address.
ipvx_broadcast_addrthe broadcast address (if the interface is broadcast-capable).
ipvx_peer_addrthe peer address (if the interface is point-to-point).

Member Function Documentation

const IPvX& VifAddr::addr ( ) const [inline]

Get the interface address.

Returns:
the interface address.
const IPvX& VifAddr::broadcast_addr ( ) const [inline]

Get the broadcast address.

The broadcast address is valid only if the interface is broadcast capable.

Returns:
the broadcast address of the interface.
bool VifAddr::is_my_addr ( const IPvX ipvx_addr) const [inline]

Test whether if an IPvX address is same as my address.

Parameters:
ipvx_addrthe address to test whether is the same as my interface address.
Returns:
true if ipvx_addr is same as my interface address, otherwise false.
bool VifAddr::is_same_subnet ( const IPvXNet ipvxnet) const

Test if a given subnet address is a subset of my subnet address.

Parameters:
ipvxnetthe subnet address to test whether is a subset of my subnet address.
Returns:
true if ipvxnet is a subset of my subnet address, otherwise false.
bool VifAddr::is_same_subnet ( const IPvX ipvx_addr) const

Test whether an address belongs to my subnet address.

Parameters:
ipvx_addrthe address to test whether it belongs to my subnet address.
Returns:
true if ipvx_addr belongs to my subnet address, otherwise false.
bool VifAddr::operator== ( const VifAddr other) const

Equality Operator.

Parameters:
otherthe right-hand operand to compare against.
Returns:
true if the left-hand operand is numerically same as the right-hand operand.
const IPvX& VifAddr::peer_addr ( ) const [inline]

Get the peer address.

The peer address is valid only if the interface is point-to-point.

Returns:
the peer address of the interface.
void VifAddr::set_addr ( const IPvX v) [inline]

Set the interface address.

Parameters:
vthe interface address to set to the interface.
void VifAddr::set_broadcast_addr ( const IPvX v) [inline]

Set the broadcast address.

Parameters:
vthe broadcast address to set to the interface.
void VifAddr::set_peer_addr ( const IPvX v) [inline]

Set the peer address.

Parameters:
vthe peer address to set to the interface.
void VifAddr::set_subnet_addr ( const IPvXNet v) [inline]

Set the subnet address.

Parameters:
vthe subnet address to set to the interface.
string VifAddr::str ( ) const

Convert this address from binary form to presentation format.

Returns:
C++ string with the human-readable ASCII representation of the address.
const IPvXNet& VifAddr::subnet_addr ( ) const [inline]

Get the subnet address.

Returns:
the subnet address of the interface.

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