xorp

Vif Class Reference

Virtual Interface class. More...

#include <vif.hh>

Inheritance diagram for Vif:
MfeaVif Mld6igmpVif Mld6igmpVif PimVif RibVif

List of all members.

Public Types

enum  { VIF_INDEX_INVALID = ((uint32_t)~0), VIF_INDEX_MAX = ((uint32_t)~0) }
 

Various vif_index related values.


Public Member Functions

 Vif (const string &vifname, const string &ifname=string(""))
 Constructor for a given virtual interface name.
 Vif (const Vif &vif)
 Constructor to clone a Vif.
virtual ~Vif ()
 Destructor.
string str () const
 Convert this Vif from binary form to presentation format.
bool operator== (const Vif &other) const
 Equality Operator.
const string & name () const
 Get the vif name.
const string & ifname () const
 Get the name of the physical interface associated with vif.
void set_ifname (const string &ifname)
 Set the name of the physical interface associated with vif.
uint32_t pif_index () const
 Get the physical interface index.
void set_pif_index (uint32_t v)
 Set the physical interface index.
uint32_t vif_index () const
 Get the virtual interface index.
void set_vif_index (uint32_t v)
 Set the virtual interface index.
bool is_pim_register () const
 Test if this vif is a PIM Register interface.
bool is_p2p () const
 Test if this vif is a point-to-point interface.
bool is_loopback () const
 Test if this vif is a loopback interface.
bool is_discard () const
 Test if this vif is a discard interface.
bool is_unreachable () const
 Test if this vif is an unreachable interface.
bool is_management () const
 Test if this vif is a management interface.
bool is_multicast_capable () const
 Test if this vif is multicast capable.
bool is_broadcast_capable () const
 Test if this vif is broadcast capable.
bool is_underlying_vif_up () const
 Test if the underlying vif is UP.
uint32_t mtu () const
 Get the MTU of the vif.
void set_pim_register (bool v)
 Set/reset the vif as a PIM Register interface.
void set_p2p (bool v)
 Set/reset the vif as a point-to-point interface.
void set_loopback (bool v)
 Set/reset the vif as a loopback interface.
void set_discard (bool v)
 Set/reset the vif as a discard interface.
void set_unreachable (bool v)
 Set/reset the vif as an unreachable interface.
void set_management (bool v)
 Set/reset the vif as a management interface.
void set_multicast_capable (bool v)
 Set/reset the vif as multicast capable.
void set_broadcast_capable (bool v)
 Set/reset the vif as broadcast capable.
void set_underlying_vif_up (bool v)
 Set/reset the underlying vif status (when applicable).
void set_mtu (uint32_t v)
 Set the MTU of the vif.
const list< VifAddr > & addr_list () const
 Get the list of all addresses for this vif.
const IPvXaddr_ptr () const
 Get the first vif address.
int add_address (const VifAddr &vif_addr)
 Add a VifAddr address to the interface.
int add_address (const IPvX &ipvx_addr, const IPvXNet &ipvxnet_subnet_addr, const IPvX &ipvx_broadcast_addr, const IPvX &ipvx_peer_addr)
 Add an IPvX address and all related information to the interface.
int add_address (const IPvX &ipvx_addr)
 Add an IPvX address to the interface.
int delete_address (const IPvX &ipvx_addr)
 Delete an IPvX address from the interface.
VifAddrfind_address (const IPvX &ipvx_addr)
 Find a VifAddr that corresponds to an IPvX address.
const VifAddrfind_address (const IPvX &ipvx_addr) const
 Find a const VifAddr that corresponds to an IPvX address.
bool is_my_addr (const IPvX &ipvx_addr) const
 Test if an IPvX address belongs to this vif.
bool is_my_vif_addr (const VifAddr &vif_addr) const
 Test if an VifAddr is belongs to this vif.
bool is_same_subnet (const IPvXNet &ipvxnet) const
 Test if a given subnet address is a subset of one of the subnet addresses of this vif.
bool is_same_subnet (const IPvX &ipvx_addr) const
 Test if a given address belongs to one of the subnet addresses of this vif.
bool is_same_p2p (const IPvX &ipvx_addr) const
 Test if a given address belongs to the same point-to-point link as this vif.

Private Attributes

string _name
string _ifname
uint32_t _pif_index
uint32_t _vif_index
bool _is_pim_register
bool _is_p2p
bool _is_loopback
bool _is_discard
bool _is_unreachable
bool _is_management
bool _is_multicast_capable
bool _is_broadcast_capable
bool _is_underlying_vif_up
uint32_t _mtu
list< VifAddr_addr_list

Detailed Description

Virtual Interface class.

Vif holds information about a virtual interface. A Vif may represent a physical interface, or may represent more abstract entities such as the Discard or Unreachable interface, or a VLAN on a physical interface.


Constructor & Destructor Documentation

Vif::Vif ( const string &  vifname,
const string &  ifname = string("") 
) [explicit]

Constructor for a given virtual interface name.

Parameters:
vifnamestring representation of the virtual interface (e.g., "port 0").
ifnamestring representation of associated interface.
Vif::Vif ( const Vif vif)

Constructor to clone a Vif.

Parameters:
vifthe virtual interface to clone.

Member Function Documentation

int Vif::add_address ( const VifAddr vif_addr)

Add a VifAddr address to the interface.

Parameters:
vif_addrthe VifAddr (VifAddr) to add to the list of addresses for this vif.
Returns:
XORP_OK if a new address, otherwise XORP_ERROR.
int Vif::add_address ( const IPvX ipvx_addr,
const IPvXNet ipvxnet_subnet_addr,
const IPvX ipvx_broadcast_addr,
const IPvX ipvx_peer_addr 
)

Add an IPvX address and all related information to the interface.

Parameters:
ipvx_addrthe interface address.
ipvxnet_subnet_addrthe subnet address.
ipvx_broadcast_addrthe broadcast address.
ipvx_peer_addrthe peer address.
Returns:
XORP_OK if a new address, otherwise XORP_ERROR.
int Vif::add_address ( const IPvX ipvx_addr)

Add an IPvX address to the interface.

Parameters:
ipvx_addrthe interface address.
Returns:
XORP_OK if a new address, otherwise XORP_ERROR.
const list<VifAddr>& Vif::addr_list ( ) const [inline]

Get the list of all addresses for this vif.

Returns:
the list of all addresses for this vif (VifAddr).
const IPvX * Vif::addr_ptr ( ) const

Get the first vif address.

Returns:
a pointer to the first valid interface address of this vif, or NULL if no addresses.
int Vif::delete_address ( const IPvX ipvx_addr)

Delete an IPvX address from the interface.

Returns:
XORP_OK on success, otherwise XORP_ERROR.
VifAddr * Vif::find_address ( const IPvX ipvx_addr)

Find a VifAddr that corresponds to an IPvX address.

Parameters:
ipvx_addrthe IPvX address to search for.
Returns:
a pointer to the VifAddr for address ipvx_addr if found, otherwise NULL.
const VifAddr * Vif::find_address ( const IPvX ipvx_addr) const

Find a const VifAddr that corresponds to an IPvX address.

Parameters:
ipvx_addrthe IPvX address to search for.
Returns:
a const pointer to the VifAddr for address ipvx_addr if found, otherwise NULL.
const string& Vif::ifname ( ) const [inline]

Get the name of the physical interface associated with vif.

Returns:
string representation of interface name.
bool Vif::is_broadcast_capable ( ) const [inline]

Test if this vif is broadcast capable.

Returns:
true if this vif is broadcast capable, otherwise false.
bool Vif::is_discard ( ) const [inline]

Test if this vif is a discard interface.

Returns:
true if this vif is a discard interface, otherwise false.
bool Vif::is_loopback ( ) const [inline]

Test if this vif is a loopback interface.

Returns:
true if this vif is a loopback interface, otherwise false.
bool Vif::is_management ( ) const [inline]

Test if this vif is a management interface.

Returns:
true if this vif is a management interface, otherwise false.
bool Vif::is_multicast_capable ( ) const [inline]

Test if this vif is multicast capable.

Returns:
true if this vif is multicast capable, otherwise false.
bool Vif::is_my_addr ( const IPvX ipvx_addr) const

Test if an IPvX address belongs to this vif.

Parameters:
ipvx_addrthe IPvX address to test whether belongs to this vif.
Returns:
true if ipvx_addr belongs to this vif, otherwise false.
bool Vif::is_my_vif_addr ( const VifAddr vif_addr) const

Test if an VifAddr is belongs to this vif.

Parameters:
vif_addrthe VifAddr address to test whether belongs to this vif.
Returns:
true if vif_addr belongs to this vif, otherwise false.
bool Vif::is_p2p ( ) const [inline]

Test if this vif is a point-to-point interface.

Returns:
true if this vif is a point-to-point interface, otherwise false.
bool Vif::is_pim_register ( ) const [inline]

Test if this vif is a PIM Register interface.

Returns:
true if this vif is a PIM Register interface, otherwise false.
bool Vif::is_same_p2p ( const IPvX ipvx_addr) const

Test if a given address belongs to the same point-to-point link as this vif.

Parameters:
ipvx_addrthe address to test against.
Returns:
true if ipvx_addr belongs to the same point-to-point link as this vif, otherwise false.
bool Vif::is_same_subnet ( const IPvX ipvx_addr) const

Test if a given address belongs to one of the subnet addresses of this vif.

Parameters:
ipvx_addrthe address to test against.
Returns:
true if ipvx_addr belongs to one of the subnet addresses of this vif, otherwise false.
bool Vif::is_same_subnet ( const IPvXNet ipvxnet) const

Test if a given subnet address is a subset of one of the subnet addresses of this vif.

Parameters:
ipvxnetthe subnet address to test against.
Returns:
true if ipvxnet is a subset of one of the subnet addresses of this vif, otherwise false.
bool Vif::is_underlying_vif_up ( ) const [inline]

Test if the underlying vif is UP.

An example of an underlying vif is the corresponding interface inside the kernel, or the MFEA interface which a PIM interface matches to.

Returns:
true if the underlying vif is UP (when applicable), otherwise false.
bool Vif::is_unreachable ( ) const [inline]

Test if this vif is an unreachable interface.

Returns:
true if this vif is an unreachable interface, otherwise false.
uint32_t Vif::mtu ( ) const [inline]

Get the MTU of the vif.

Returns:
the MTU of the vif.
const string& Vif::name ( ) const [inline]

Get the vif name.

Returns:
a string representation of the vif name.
bool Vif::operator== ( const Vif 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.
uint32_t Vif::pif_index ( ) const [inline]

Get the physical interface index.

Returns:
the physical interface index (if applicable).
void Vif::set_broadcast_capable ( bool  v) [inline]

Set/reset the vif as broadcast capable.

Parameters:
vif true, then set this vif as broadcast capable, otherwise reset it.
void Vif::set_discard ( bool  v) [inline]

Set/reset the vif as a discard interface.

Parameters:
vif true, then set this vif as a discard interface, otherwise reset it.
void Vif::set_ifname ( const string &  ifname) [inline]

Set the name of the physical interface associated with vif.

Parameters:
ifname
void Vif::set_loopback ( bool  v) [inline]

Set/reset the vif as a loopback interface.

Parameters:
vif true, then set this vif as a loopback interface, otherwise reset it.
void Vif::set_management ( bool  v) [inline]

Set/reset the vif as a management interface.

Parameters:
vif true, then set this vif as a management interface, otherwise reset it.
void Vif::set_mtu ( uint32_t  v) [inline]

Set the MTU of the vif.

Parameters:
vthe MTU of the vif.
void Vif::set_multicast_capable ( bool  v) [inline]

Set/reset the vif as multicast capable.

Parameters:
vif true, then set this vif as multicast capable, otherwise reset it.
void Vif::set_p2p ( bool  v) [inline]

Set/reset the vif as a point-to-point interface.

Parameters:
vif true, then set this vif as a point-to-point interface, otherwise reset it.
void Vif::set_pif_index ( uint32_t  v) [inline]

Set the physical interface index.

Parameters:
vthe value of the physical interface index to set to.
void Vif::set_pim_register ( bool  v) [inline]

Set/reset the vif as a PIM Register interface.

Parameters:
vif true, then set this vif as a PIM Register interface, otherwise reset it.
void Vif::set_underlying_vif_up ( bool  v) [inline]

Set/reset the underlying vif status (when applicable).

An example of an underlying vif is the corresponding interface inside the kernel, or the MFEA interface which a PIM interface matches to.

Parameters:
vif true, then set the underlying vif status as UP, otherwise the underlying vif status is set to DOWN.
void Vif::set_unreachable ( bool  v) [inline]

Set/reset the vif as an unreachable interface.

Parameters:
vif true, then set this vif as an unreachable interface, otherwise reset it.
void Vif::set_vif_index ( uint32_t  v) [inline]

Set the virtual interface index.

Parameters:
vthe value of the virtual interface index to set to.
string Vif::str ( ) const

Convert this Vif from binary form to presentation format.

Returns:
C++ string with the human-readable ASCII representation of the Vif.
uint32_t Vif::vif_index ( ) const [inline]

Get the virtual interface index.

Returns:
the virtual interface index.

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