|
xorp
|
The VRRP XORP process. More...
#include <vrrp_target.hh>
Public Member Functions | |
| VrrpTarget (XrlRouter &rtr) | |
| bool | running () const |
| Check whether VRRP is running. | |
| void | tree_complete () |
| Called when the rtrmgr configuration is first received. | |
| void | updates_made () |
| Called when the rtrmgr configuration changed. | |
| void | send (const string &ifname, const string &vifname, const Mac &src, const Mac &dst, uint32_t ether, const PAYLOAD &payload) |
| Transmit a L2 packet. | |
| void | join_mcast (const string &ifname, const string &vifname) |
| Join the VRRP multicast group. | |
| void | leave_mcast (const string &ifname, const string &vifname) |
| Leave the VRRP multicast group. | |
| void | start_arps (const string &ifname, const string &vifname) |
| Start the reception of ARP packets on an interface. | |
| void | stop_arps (const string &ifname, const string &vifname) |
| Stop the reception of ARPs. | |
| void | add_mac (const string &ifname, const Mac &mac) |
| Add a MAC address to the router. | |
| void | delete_mac (const string &ifname, const Mac &mac) |
| Delete MAC address from the router. | |
| void | add_ip (const string &ifname, const IPv4 &ip, uint32_t prefix) |
| void | delete_ip (const string &ifname, const IPv4 &ip) |
| EventLoop & | eventloop () |
Static Public Attributes | |
| static const string | vrrp_target_name = "vrrp" |
| static const string | fea_target_name = "fea" |
Protected Member Functions | |
| XrlCmdError | common_0_1_get_target_name (string &name) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | common_0_1_get_version (string &version) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | common_0_1_get_status (uint32_t &status, string &reason) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | common_0_1_shutdown () |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | common_0_1_startup () |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_add_vrid (const string &ifname, const string &vifname, const uint32_t &vrid) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_delete_vrid (const string &ifname, const string &vifname, const uint32_t &vrid) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_set_priority (const string &ifname, const string &vifname, const uint32_t &vrid, const uint32_t &priority) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_set_interval (const string &ifname, const string &vifname, const uint32_t &vrid, const uint32_t &interval) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_set_preempt (const string &ifname, const string &vifname, const uint32_t &vrid, const bool &preempt) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_set_disable (const string &ifname, const string &vifname, const uint32_t &vrid, const bool &disable) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_add_ip (const string &ifname, const string &vifname, const uint32_t &vrid, const IPv4 &ip) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_set_prefix (const string &ifname, const string &vifname, const uint32_t &vrid, const IPv4 &ip, const uint32_t &prefix_len) |
| XrlCmdError | vrrp_0_1_delete_ip (const string &ifname, const string &vifname, const uint32_t &vrid, const IPv4 &ip) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_get_vrid_info (const string &ifname, const string &vifname, const uint32_t &vrid, string &state, IPv4 &master) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_get_vrids (const string &ifname, const string &vifname, XrlAtomList &vrids) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_get_ifs (XrlAtomList &ifs) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | vrrp_0_1_get_vifs (const string &ifname, XrlAtomList &vifs) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | raw_packet4_client_0_1_recv (const string &if_name, const string &vif_name, const IPv4 &src_address, const IPv4 &dst_address, const uint32_t &ip_protocol, const int32_t &ip_ttl, const int32_t &ip_tos, const bool &ip_router_alert, const bool &ip_internet_control, const vector< uint8_t > &payload) |
| Pure-virtual function that needs to be implemented to: | |
| XrlCmdError | raw_link_client_0_1_recv (const string &if_name, const string &vif_name, const Mac &src_address, const Mac &dst_address, const uint32_t ðer_type, const vector< uint8_t > &payload) |
| Pure-virtual function that needs to be implemented to: | |
Private Types | |
| typedef map< string, VrrpVif * > | VIFS |
| typedef map< string, VIFS * > | IFS |
Private Member Functions | |
| void | shutdown () |
| Terminate the VRRP process. | |
| void | start () |
| Start VRRP. | |
| void | check_interfaces () |
| Check whether rtrmgr configuration changes affect VRRP. | |
| void | check_vif (VrrpVif &vif) |
| Check whether configuration changes affect a specific interface. | |
| void | add_vrid (const string &ifn, const string &vifn, uint32_t id) |
| Add a VRRP instance. | |
| void | delete_vrid (const string &ifn, const string &vifn, uint32_t id) |
| Delete a VRRP instance. | |
| Vrrp & | find_vrid (const string &ifn, const string &vifn, uint32_t id) |
| Get a reference to a VRRP instance. | |
| Vrrp * | find_vrid_ptr (const string &ifn, const string &vifn, uint32_t id) |
| Get a pointer to a VRRP instance. | |
| VrrpVif * | find_vif (const string &ifn, const string &vifn, bool add=false) |
| Get a pointer to a network interface. | |
| void | xrl_cb (const XrlError &xrl_error) |
| The callback for all XRL operations. | |
Private Attributes | |
| XrlRouter & | _rtr |
| bool | _running |
| IFS | _ifs |
| IfMgrXrlMirror | _ifmgr |
| bool | _ifmgr_setup |
| XrlRawLinkV0p1Client | _rawlink |
| XrlRawPacket4V0p1Client | _rawipv4 |
| XrlIfmgrV0p1Client | _fea |
| int | _xrls_pending |
The VRRP XORP process.
This class manages all VRRP instances and provides a link between XRLs and the VRRP state machine.
| void VrrpTarget::add_mac | ( | const string & | ifname, |
| const Mac & | mac | ||
| ) |
| void VrrpTarget::add_vrid | ( | const string & | ifn, |
| const string & | vifn, | ||
| uint32_t | id | ||
| ) | [private] |
Add a VRRP instance.
| ifn | interface to run on. |
| vifn | vif to run on. |
| id | the VRRP router id. |
| void VrrpTarget::check_vif | ( | VrrpVif & | vif | ) | [private] |
Check whether configuration changes affect a specific interface.
| vif | the interface to check. |
| XrlCmdError VrrpTarget::common_0_1_get_status | ( | uint32_t & | status, |
| string & | reason | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Get status of Xrl Target
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::common_0_1_get_target_name | ( | string & | name | ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Get name of Xrl Target
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::common_0_1_get_version | ( | string & | version | ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Get version string from Xrl Target
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::common_0_1_shutdown | ( | ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Request clean shutdown of Xrl Target
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::common_0_1_startup | ( | ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Request a startup of Xrl Target
Implements XrlVrrpTargetBase.
| void VrrpTarget::delete_mac | ( | const string & | ifname, |
| const Mac & | mac | ||
| ) |
| void VrrpTarget::delete_vrid | ( | const string & | ifn, |
| const string & | vifn, | ||
| uint32_t | id | ||
| ) | [private] |
| VrrpVif * VrrpTarget::find_vif | ( | const string & | ifn, |
| const string & | vifn, | ||
| bool | add = false |
||
| ) | [private] |
| Vrrp & VrrpTarget::find_vrid | ( | const string & | ifn, |
| const string & | vifn, | ||
| uint32_t | id | ||
| ) | [private] |
| Vrrp * VrrpTarget::find_vrid_ptr | ( | const string & | ifn, |
| const string & | vifn, | ||
| uint32_t | id | ||
| ) | [private] |
| void VrrpTarget::join_mcast | ( | const string & | ifname, |
| const string & | vifname | ||
| ) |
| void VrrpTarget::leave_mcast | ( | const string & | ifname, |
| const string & | vifname | ||
| ) |
| XrlCmdError VrrpTarget::raw_link_client_0_1_recv | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const Mac & | src_address, | ||
| const Mac & | dst_address, | ||
| const uint32_t & | ether_type, | ||
| const vector< uint8_t > & | payload | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Receive a raw link-level packet on an interface.
| if_name | the interface name the packet arrived on. |
| vif_name | the vif name the packet arrived on. |
| src_address | the MAC source address. |
| dst_address | the MAC destination address. |
| ether_type | the EtherType protocol number or the Destination SAP. It must be between 1536 and 65535 to specify the EtherType, or between 1 and 255 to specify the Destination SAP for IEEE 802.2 LLC frames. |
| payload | the payload, everything after the MAC header. |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::raw_packet4_client_0_1_recv | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const IPv4 & | src_address, | ||
| const IPv4 & | dst_address, | ||
| const uint32_t & | ip_protocol, | ||
| const int32_t & | ip_ttl, | ||
| const int32_t & | ip_tos, | ||
| const bool & | ip_router_alert, | ||
| const bool & | ip_internet_control, | ||
| const vector< uint8_t > & | payload | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Receive an IPv4 packet from a raw socket.
| if_name | the interface name the packet arrived on. |
| vif_name | the vif name the packet arrived on. |
| src_address | the IP source address. |
| dst_address | the IP destination address. |
| ip_protocol | the IP protocol number. |
| ip_ttl | the IP TTL (hop-limit). If it has a negative value, then the received value is unknown. |
| ip_tos | the Type of Service (Diffserv/ECN bits for IPv4). If it has a negative value, then the received value is unknown. |
| ip_router_alert | if true, the IP Router Alert option was included in the IP packet. |
| ip_internet_control | if true, then this is IP control traffic. |
| payload | the payload, everything after the IP header and options. |
Implements XrlVrrpTargetBase.
| bool VrrpTarget::running | ( | ) | const |
Check whether VRRP is running.
| void VrrpTarget::start_arps | ( | const string & | ifname, |
| const string & | vifname | ||
| ) |
| void VrrpTarget::stop_arps | ( | const string & | ifname, |
| const string & | vifname | ||
| ) |
| XrlCmdError VrrpTarget::vrrp_0_1_add_ip | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| const IPv4 & | ip | ||
| ) | [protected, virtual] |
| XrlCmdError VrrpTarget::vrrp_0_1_add_vrid | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Create a VRRP instance.
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_delete_ip | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| const IPv4 & | ip | ||
| ) | [protected, virtual] |
| XrlCmdError VrrpTarget::vrrp_0_1_delete_vrid | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Remove a VRRP instance.
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_get_ifs | ( | XrlAtomList & | ifs | ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Get the physical interfaces on which VRRP is running.
| ifs | a list of interface names (strings). |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_get_vifs | ( | const string & | ifname, |
| XrlAtomList & | vifs | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
For a given physical interface, get the virtual interfaces on which VRRP is running.
| ifname | the physical interface name. |
| vifs | a list of virtual interface names (strings). |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_get_vrid_info | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| string & | state, | ||
| IPv4 & | master | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Get state information from a particular VRRP instance.
| ifname | the interface on which the VRRP instance is running. |
| vifname | the vif on which the instance is running. |
| vrid | the virtual router ID of the VRRP instance. |
| state | the state of the router (initialize, master, backup). |
| master | the IP address of the master. Only valid when running. |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_get_vrids | ( | const string & | ifname, |
| const string & | vifname, | ||
| XrlAtomList & | vrids | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Get the virtual router IDs of all the VRRP instances running on a network interface.
| ifname | the physical interface name. |
| vifname | the logical interface name. |
| vrids | a list of VRRP router IDs (integers). |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_set_disable | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| const bool & | disable | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Start or stop a VRRP instance.
| ifname | the interface on which VRRP is running. |
| vifname | the vif on which VRRP is running. |
| vrid | the VRRP router ID. |
| disable | if true, stop VRRP. Start it otherwise. |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_set_interval | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| const uint32_t & | interval | ||
| ) | [protected, virtual] |
| XrlCmdError VrrpTarget::vrrp_0_1_set_preempt | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| const bool & | preempt | ||
| ) | [protected, virtual] |
Pure-virtual function that needs to be implemented to:
Set whether a high priority backup router should preempt a low priority router that is acting as a master.
| ifname | the interface on which VRRP is running. |
| vifname | the vif on which VRRP is running. |
| vrid | the VRRP router ID. |
| preempt | true if preemption should occur. |
Implements XrlVrrpTargetBase.
| XrlCmdError VrrpTarget::vrrp_0_1_set_priority | ( | const string & | ifname, |
| const string & | vifname, | ||
| const uint32_t & | vrid, | ||
| const uint32_t & | priority | ||
| ) | [protected, virtual] |
| void VrrpTarget::xrl_cb | ( | const XrlError & | xrl_error | ) | [private] |