xorp

VrrpVif Class Reference

Implementation of a VRRP network interface. More...

#include <vrrp_vif.hh>

List of all members.

Public Types

typedef set< uint8_t > VRIDS

Public Member Functions

 VrrpVif (VrrpTarget &vt, const string &ifname, const string &vifname)
VrrpTargetget_vrrp_target ()
bool own (const IPv4 &addr)
 Check whether an IP address is configured on this interface.
Vrrpfind_vrid (uint32_t vrid)
 Look for a VRRP instance on this interface.
void add_vrid (uint32_t vrid)
 Add a VRRP instance on this interface.
void delete_vrid (uint32_t vrid)
 Delete a VRRP instance from this interface.
bool ready () const
 Check whether the interface is up.
void configure (const IfMgrIfTree &conf)
 Change the interface's configuration.
const IPv4addr () const
 Obtain the interface's primary IP address.
void send (const Mac &src, const Mac &dst, uint32_t ether, const vector< uint8_t > &payload)
 Send a L2 packet.
void join_mcast ()
 Join the VRRP multicast group.
void leave_mcast ()
 Leave the VRRP multicast group.
void recv (const IPv4 &from, const vector< uint8_t > &payload)
 Receive an IP packet.
void add_mac (const Mac &mac)
 Add a MAC address to this interface.
void add_ip (const IPv4 &ip, uint32_t prefix)
void delete_mac (const Mac &mac)
 Delete a MAC address from this interface.
void delete_ip (const IPv4 &ip)
void start_arps ()
 Start the reception of ARP packets.
void stop_arps ()
 Stop the reception of ARP packets.
void recv_arp (const Mac &src, const vector< uint8_t > &payload)
 Notify the reception of an ARP packet.
void get_vrids (VRIDS &vrids)
 Obtain a list of VRRP instance configured on this interface.
void xrl_cb (const XrlError &xrl_error)
 Callback on XRL error caused by this interface.

Private Types

typedef set< IPv4IPS
typedef map< uint32_t, Vrrp * > VRRPS

Private Member Functions

void set_ready (bool ready)
 Enable or disable the interface.
template<class T >
bool is_enabled (const T *obj)
 Check whether a rtrmgr configuration element (e.g., an interface) is enabled.

Private Attributes

VrrpTarget_vt
string _ifname
string _vifname
bool _ready
IPS _ips
VRRPS _vrrps
uint32_t _join
uint32_t _arps

Detailed Description

Implementation of a VRRP network interface.

This class links the VRRP state machine to the actual network.


Constructor & Destructor Documentation

VrrpVif::VrrpVif ( VrrpTarget vt,
const string &  ifname,
const string &  vifname 
)
Parameters:
vtthe VRRP target.
ifnamethe name of the physical interface.
vifnamethe name of the logical interface.

Member Function Documentation

void VrrpVif::add_mac ( const Mac mac)

Add a MAC address to this interface.

Parameters:
macMAC address to add.
void VrrpVif::add_vrid ( uint32_t  vrid)

Add a VRRP instance on this interface.

Parameters:
vridthe router ID of this VRRP instance.
const IPv4 & VrrpVif::addr ( ) const

Obtain the interface's primary IP address.

Returns:
the primary IP address.
void VrrpVif::configure ( const IfMgrIfTree conf)

Change the interface's configuration.

Parameters:
confthe new configuration of the interface.
void VrrpVif::delete_mac ( const Mac mac)

Delete a MAC address from this interface.

Parameters:
macMAC address to remove.
void VrrpVif::delete_vrid ( uint32_t  vrid)

Delete a VRRP instance from this interface.

Parameters:
vridthe router ID of the instance.
Vrrp * VrrpVif::find_vrid ( uint32_t  vrid)

Look for a VRRP instance on this interface.

Returns:
a VRRP instance configured on this interface.
Parameters:
vridthe VRRP ID to look for.
void VrrpVif::get_vrids ( VRIDS &  vrids)

Obtain a list of VRRP instance configured on this interface.

Parameters:
vridsthe VRRP instances on this interface (output parameter).
template<class T >
bool VrrpVif::is_enabled ( const T *  obj) [private]

Check whether a rtrmgr configuration element (e.g., an interface) is enabled.

Returns:
true if the element is enabled, false otherwise.
Parameters:
objelement to check.
bool VrrpVif::own ( const IPv4 addr)

Check whether an IP address is configured on this interface.

Returns:
whether the given IP address is configured on the interface.
Parameters:
addrthe IP address tocheck for.
bool VrrpVif::ready ( ) const

Check whether the interface is up.

Returns:
whether the interface is enabled.
void VrrpVif::recv ( const IPv4 from,
const vector< uint8_t > &  payload 
)

Receive an IP packet.

Parameters:
fromthe source IP address.
payloadthe IP payload.
void VrrpVif::recv_arp ( const Mac src,
const vector< uint8_t > &  payload 
)

Notify the reception of an ARP packet.

Parameters:
srcthe source MAC address.
payloadthe ARP header and data.
void VrrpVif::send ( const Mac src,
const Mac dst,
uint32_t  ether,
const vector< uint8_t > &  payload 
)

Send a L2 packet.

Parameters:
srcthe source MAC address.
dstthe destination MAC address.
etherthe Ethernet type.
payloadthe data following the MAC header.
void VrrpVif::set_ready ( bool  ready) [private]

Enable or disable the interface.

This will start / stop all VRRP instances running on this interface.

Parameters:
readyif true, enable the interface, otherwise disable it.
void VrrpVif::xrl_cb ( const XrlError xrl_error)

Callback on XRL error caused by this interface.

Parameters:
xrl_errorthe error (if any).

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