Vif holds information about a virtual interface. A Vif may represent a physical interface, or may represent more abstract entities such as the Discard interface, or a VLAN on a physical interface.
explicit Vif (const string& vifname, const string& ifname = string(""))
| Vif |
Constructor for a given virtual interface name.
Parameters:
vifname | string representation of the virtual interface (e.g., "port 0"). |
ifname | string representation of associated interface. |
Vif (const Vif& vif)
| Vif |
Constructor to clone a Vif.
Parameters:
vif | the virtual interface to clone. |
~Vif ()
| ~Vif |
[virtual]
string str ()
| str |
[const]
Convert this Vif from binary form to presentation format.
Returns: C++ string with the human-readable ASCII representation of the Vif.
bool operator== (const Vif& other)
| operator== |
[const]
Equality Operator
Parameters:
other | the right-hand operand to compare against. |
Returns: true if the left-hand operand is numerically same as the right-hand operand.
const string& name ()
| name |
[const]
Get the vif name.
Returns: a string representation of the vif name.
const string& ifname ()
| ifname |
[const]
Get the name of the physical interface associated with vif.
Returns: string representation of interface name.
void set_ifname (const string& ifname)
| set_ifname |
Set the name of the physical interface associated with vif.
Parameters:
ifname |
uint32_t pif_index ()
| pif_index |
[const]
Get the physical interface index.
Returns: the physical interface index (if applicable).
void set_pif_index (uint32_t v)
| set_pif_index |
Set the physical interface index.
Parameters:
v | the value of the physical interface index to set to. |
enum { VIF_INDEX_INVALID = ((uint32_t)~0), VIF_INDEX_MAX = ((uint32_t)~0) } |
Various vif_index related values.
const uint32_t vif_index ()
| vif_index |
[const]
Get the virtual interface index.
Returns: the virtual interface index.
void set_vif_index (uint32_t v)
| set_vif_index |
Set the virtual interface index.
Parameters:
v | the value of the virtual interface index to set to. |
bool is_pim_register ()
| is_pim_register |
[const]
Test if this vif is a PIM Register interface.
return true if this vif is a PIM Register interface, otherwise false.
bool is_p2p ()
| is_p2p |
[const]
Test if this vif is a point-to-point interface.
return true if this vif is a point-to-point interface, otherwise false.
bool is_loopback ()
| is_loopback |
[const]
Test if this vif is a loopback interface.
return true if this vif is a loopback interface, otherwise false.
bool is_discard ()
| is_discard |
[const]
Test if this vif is a discard interface.
return true if this vif is a discard interface, otherwise false.
bool is_multicast_capable ()
| is_multicast_capable |
[const]
Test if this vif is multicast capable.
return true if this vif is multicast capable, otherwise false.
bool is_broadcast_capable ()
| is_broadcast_capable |
[const]
Test if this vif is broadcast capable.
return true if this vif is broadcast capable, otherwise false.
bool is_underlying_vif_up ()
| is_underlying_vif_up |
[const]
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.
return true if the underlying vif is UP (when applicable), otherwise false.
void set_pim_register (bool v)
| set_pim_register |
Set/reset the vif as a PIM Register interface.
Parameters:
v | if true, then set this vif as a PIM Register interface, otherwise reset it. |
void set_p2p (bool v)
| set_p2p |
Set/reset the vif as a point-to-point interface.
Parameters:
v | if true, then set this vif as a point-to-point interface, otherwise reset it. |
void set_loopback (bool v)
| set_loopback |
Set/reset the vif as a loopback interface.
Parameters:
v | if true, then set this vif as a loopback interface, otherwise reset it. |
void set_discard (bool v)
| set_discard |
Set/reset the vif as a discard interface.
Parameters:
v | if true, then set this vif as a discard interface, otherwise reset it. |
void set_multicast_capable (bool v)
| set_multicast_capable |
Set/reset the vif as multicast capable.
Parameters:
v | if true, then set this vif as multicast capable, otherwise reset it. |
void set_broadcast_capable (bool v)
| set_broadcast_capable |
Set/reset the vif as broadcast capable.
Parameters:
v | if true, then set this vif as broadcast capable, otherwise reset it. |
void set_underlying_vif_up (bool v)
| set_underlying_vif_up |
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:
v | if true, then set the underlying vif status as UP, otherwise the underlying vif status is set to DOWN. |
const list<VifAddr>& addr_list ()
| addr_list |
[const]
Get the list of all addresses for this vif.
Returns: the list of all addresses for this vif (VifAddr).
const IPvX* addr_ptr ()
| 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 add_address (const VifAddr& vif_addr)
| add_address |
Add a VifAddr address to the interface.
Parameters:
vif_addr | the VifAddr (VifAddr) to add to the list of addresses for this vif. |
Returns: XORP_OK if a new address, otherwise XORP_ERROR.
int add_address (const IPvX& ipvx_addr,
const IPvXNet& ipvxnet_subnet_addr,
const IPvX& ipvx_broadcast_addr,
const IPvX& ipvx_peer_addr)
| add_address |
Add an IPvX address and all related information to the interface.
Parameters:
ipvx_addr | the interface address. |
ipvxnet_subnet_addr | the subnet address. |
ipvx_broadcast_addr | the broadcast address. |
ipvx_peer_addr | the peer address. |
Returns: XORP_OK if a new address, otherwise XORP_ERROR.
int add_address (const IPvX& ipvx_addr)
| add_address |
Add an IPvX address to the interface.
Parameters:
ipvx_addr | the interface address. |
Returns: XORP_OK if a new address, otherwise XORP_ERROR.
int delete_address (const IPvX& ipvx_addr)
| delete_address |
Delete an IPvX address from the interface.
Returns: XORP_OK on success, otherwise XORP_ERROR.
VifAddr * find_address (const IPvX& ipvx_addr)
| find_address |
Find a VifAddr that corresponds to an IPvX address.
Parameters:
ipvx_addr | the IPvX address to search for. |
Returns: a pointer to the VifAddr for address ipvx_addr if found, otherwise NULL.
bool is_my_addr (const IPvX& ipvx_addr)
| is_my_addr |
[const]
Test if an IPvX address belongs to this vif.
Parameters:
ipvx_addr | the IPvX address to test whether belongs to this vif. |
Returns: true if ipvx_addr belongs to this vif, otherwise false.
bool is_my_vif_addr (const VifAddr& vif_addr)
| is_my_vif_addr |
[const]
Test if an VifAddr is belongs to this vif.
Parameters:
vif_addr | the VifAddr address to test whether belongs to this vif. |
Returns: true if vif_addr belongs to this vif, otherwise false.
bool is_same_subnet (const IPvXNet& ipvxnet)
| is_same_subnet |
[const]
Test if a given subnet address is a subset of one of the subnet addresses of this vif.
Parameters:
ipvxnet | the subnet address to test against. |
Returns: true if ipvxnet is a subset of one of the subnet addresses of this vif, otherwise false.
bool is_same_subnet (const IPvX& ipvx_addr)
| is_same_subnet |
[const]
Test if a given address belongs to one of the subnet addresses of this vif.
Parameters:
ipvx_addr | the address to test against. |
Returns: true if ipvx_addr belongs to one of the subnet addresses of this vif, otherwise false.
bool is_same_p2p (const IPvX& ipvx_addr)
| is_same_p2p |
[const]
Test if a given address belongs to the same point-to-point link as this vif.
Parameters:
ipvx_addr | the address to test against. |
Returns: true if ipvx_addr belongs to the same point-to-point link as this vif, otherwise false.