]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_labelpool.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / bgpd / bgp_labelpool.h
index 9526cba0ce30a738a15938b52fb09064ec68e0c4..b33527186e0a10b876494ec4a9db104a48352c36 100644 (file)
@@ -17,6 +17,7 @@
  */
 #define LP_TYPE_VRF    0x00000001
 #define LP_TYPE_BGP_LU 0x00000002
+#define LP_TYPE_NEXTHOP 0x00000003
 
 PREDECL_LIST(lp_fifo);
 
@@ -41,4 +42,55 @@ extern void bgp_lp_event_zebra_down(void);
 extern void bgp_lp_event_zebra_up(void);
 extern void bgp_lp_vty_init(void);
 
+struct bgp_label_per_nexthop_cache;
+PREDECL_RBTREE_UNIQ(bgp_label_per_nexthop_cache);
+
+extern int
+bgp_label_per_nexthop_cache_cmp(const struct bgp_label_per_nexthop_cache *a,
+                               const struct bgp_label_per_nexthop_cache *b);
+
+struct bgp_label_per_nexthop_cache {
+
+       /* RB-tree entry. */
+       struct bgp_label_per_nexthop_cache_item entry;
+
+       /* the nexthop is the key of the list */
+       struct prefix nexthop;
+
+       /* calculated label */
+       mpls_label_t label;
+
+       /* number of path_vrfs */
+       unsigned int path_count;
+
+       /* back pointer to bgp instance */
+       struct bgp *to_bgp;
+
+       /* copy a nexthop resolution from bgp nexthop tracking
+        * used to extract the interface nexthop
+        */
+       struct nexthop *nh;
+
+       /* list of path_vrfs using it */
+       LIST_HEAD(path_lists, bgp_path_info) paths;
+
+       time_t last_update;
+
+       /* Back pointer to the cache tree this entry belongs to. */
+       struct bgp_label_per_nexthop_cache_head *tree;
+};
+
+DECLARE_RBTREE_UNIQ(bgp_label_per_nexthop_cache,
+                   struct bgp_label_per_nexthop_cache, entry,
+                   bgp_label_per_nexthop_cache_cmp);
+
+void bgp_label_per_nexthop_free(struct bgp_label_per_nexthop_cache *blnc);
+
+struct bgp_label_per_nexthop_cache *
+bgp_label_per_nexthop_new(struct bgp_label_per_nexthop_cache_head *tree,
+                         struct prefix *nexthop);
+struct bgp_label_per_nexthop_cache *
+bgp_label_per_nexthop_find(struct bgp_label_per_nexthop_cache_head *tree,
+                          struct prefix *nexthop);
+void bgp_label_per_nexthop_init(void);
 #endif /* _FRR_BGP_LABELPOOL_H */