]> git.proxmox.com Git - mirror_frr.git/blobdiff - vrrpd/vrrp.h
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / vrrpd / vrrp.h
index 08ef84ec1694b3a69866c58e63bd22ff0f5b5578..502d7b82b6137f8dead0a4f7606635a7e9d9dd44 100644 (file)
 #include <zebra.h>
 #include <netinet/ip.h>
 
+#include "lib/memory.h"
 #include "lib/hash.h"
 #include "lib/hook.h"
 #include "lib/if.h"
 #include "lib/linklist.h"
+#include "lib/northbound.h"
 #include "lib/privs.h"
 #include "lib/stream.h"
 #include "lib/thread.h"
@@ -45,6 +47,8 @@
 #define VRRP_LOGPFX_FAM "[%s] "
 
 /* Default defaults */
+#define VRRP_XPATH_FULL "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group"
+#define VRRP_XPATH "./frr-vrrpd:vrrp/vrrp-group"
 #define VRRP_DEFAULT_PRIORITY 100
 #define VRRP_DEFAULT_ADVINT 100
 #define VRRP_DEFAULT_PREEMPT true
 /* User compatibility constant */
 #define CS2MS 10
 
+DECLARE_MGROUP(VRRPD)
+
+/* Northbound */
+extern const struct frr_yang_module_info frr_vrrpd_info;
+
 /* Configured defaults */
 struct vrrp_defaults {
+       uint8_t version;
        uint8_t priority;
        uint16_t advertisement_interval;
        bool preempt_mode;
@@ -265,6 +275,14 @@ struct vrrp_vrouter {
  */
 void vrrp_init(void);
 
+/*
+ * Destroy all VRRP instances and gracefully shutdown.
+ *
+ * For instances in Master state, VRRP advertisements with 0 priority will be
+ * sent if possible to notify Backup routers that we are going away.
+ */
+void vrrp_fini(void);
+
 
 /* Creation and destruction ------------------------------------------------ */
 
@@ -329,7 +347,7 @@ void vrrp_set_advertisement_interval(struct vrrp_vrouter *vr,
 /*
  * Add an IPvX address to a VRRP Virtual Router.
  *
- * r
+ * vr
  *    Virtual Router to add IPvx address to
  *
  * ip
@@ -343,7 +361,7 @@ void vrrp_set_advertisement_interval(struct vrrp_vrouter *vr,
  *    -1 on error
  *     0 otherwise
  */
-int vrrp_add_ip(struct vrrp_router *r, struct ipaddr *ip);
+int vrrp_add_ip(struct vrrp_vrouter *vr, struct ipaddr *ip);
 
 /*
  * Add an IPv4 address to a VRRP Virtual Router.
@@ -386,7 +404,7 @@ int vrrp_add_ipv6(struct vrrp_vrouter *vr, struct in6_addr v6);
 /*
  * Remove an IP address from a VRRP Virtual Router.
  *
- * r
+ * vr
  *    Virtual Router to remove IP address from
  *
  * ip
@@ -402,7 +420,7 @@ int vrrp_add_ipv6(struct vrrp_vrouter *vr, struct in6_addr v6);
  *    -1 on error
  *     0 otherwise
  */
-int vrrp_del_ip(struct vrrp_router *r, struct ipaddr *ip);
+int vrrp_del_ip(struct vrrp_vrouter *vr, struct ipaddr *ip);
 
 /*
  * Remove an IPv4 address from a VRRP Virtual Router.
@@ -454,8 +472,7 @@ int vrrp_del_ipv6(struct vrrp_vrouter *vr, struct in6_addr v6);
 #define VRRP_EVENT_STARTUP 0
 #define VRRP_EVENT_SHUTDOWN 1
 
-extern const char *vrrp_state_names[3];
-extern const char *vrrp_event_names[2];
+extern const char *const vrrp_state_names[3];
 
 /*
  * This hook called whenever the state of a Virtual Router changes, after the
@@ -464,7 +481,7 @@ extern const char *vrrp_event_names[2];
  * Use this if you need to react to state changes to perform non-critical
  * tasks. Critical tasks should go in the internal state change handlers.
  */
-DECLARE_HOOK(vrrp_change_state_hook, (struct vrrp_router * r, int to), (r, to));
+DECLARE_HOOK(vrrp_change_state_hook, (struct vrrp_router *r, int to), (r, to));
 
 /*
  * Trigger a VRRP event on a given Virtual Router..
@@ -532,17 +549,6 @@ void vrrp_if_address_del(struct interface *ifp);
 
 /* Other ------------------------------------------------------------------- */
 
-/*
- * Write interface block-level configuration to vty.
- *
- * vty
- *    vty to write config to
- *
- * Returns:
- *    # of lines written
- */
-int vrrp_config_write_interface(struct vty *vty);
-
 /*
  * Write global level configuration to vty.
  *
@@ -557,6 +563,6 @@ int vrrp_config_write_global(struct vty *vty);
 /*
  * Find VRRP Virtual Router by Virtual Router ID
  */
-struct vrrp_vrouter *vrrp_lookup(struct interface *ifp, uint8_t vrid);
+struct vrrp_vrouter *vrrp_lookup(const struct interface *ifp, uint8_t vrid);
 
 #endif /* __VRRP_H__ */