This class implements the state machine of the VRRP protocol. It receive events and responds to them.
static const Mac mcast_mac | mcast_mac |
Vrrp (VrrpInterface& vif, EventLoop& e, uint32_t vrid)
| Vrrp |
Parameters:
vif | the VRRP interface on which this instance is running. |
e | eventloop. |
vrid | the VRRP id of this instance. |
~Vrrp ()
| ~Vrrp |
void set_priority (uint32_t priority)
| set_priority |
Set the priority of the router.
Parameters:
priority | the priority of this router. |
void set_interval (uint32_t interval)
| set_interval |
Set the advertisement interval.
Parameters:
interval | the interval for sending advertisements. |
void set_preempt (bool preempt)
| set_preempt |
Set whether a high priority backup router should preempt backup routers with lower priority acting as masters.
Parameters:
preempt | whether a high priority backup should preempt a low one. |
void set_disable (bool disable)
| set_disable |
Stop or start this VRRP instance.
Parameters:
disable | stop this VRRP instance. |
void add_ip (const IPv4& ip)
| add_ip |
Add an IP to the virtual router.
Parameters:
ip | IP address to add to the virtual router. |
void delete_ip (const IPv4& ip)
| delete_ip |
Delete an IP from the virtual router.
Parameters:
ip | IP address to remove from the virtual router. |
bool running ()
| running |
[const]
Check whether this instance is running.
Returns: whether this VRRP instance is running.
uint32_t priority ()
| priority |
[const]
Obtain the priority of this router.
Returns: priority of router.
void start ()
| start |
void stop ()
| stop |
void check_ownership ()
| check_ownership |
Check whether the router owns all IPs configured for the virtual router. This must be called after updating IP addresses.
void recv (const IPv4& from, const VrrpHeader& vh)
| recv |
Must be called when a VRRP packet is received.
Parameters:
from | IP address sending the packet. |
vh | the VRRP packet received, starting from the VRRP header. |
ARPd& arpd ()
| arpd |
Obtain an instance to the ARP daemon.
Returns: an instance of the ARP daemon.
void get_info (string& state, IPv4& master)
| get_info |
[const]
Returns information about the state of the protocol.
Parameters:
state | the state of the router (output parameter). |
master | the IP address of the master (output parameter). |