]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/nexthop.h
lib, bgpd: Remove UNDEFINED_NODE
[mirror_frr.git] / lib / nexthop.h
index eb9b27ea9e3250957e247471c36b219d68d7fbab..83c5b850b8f90def607723447c286287aa71b302 100644 (file)
 #define _LIB_NEXTHOP_H
 
 #include "prefix.h"
+#include "mpls.h"
+
+/* Maximum next hop string length - gateway + ifindex */
+#define NEXTHOP_STRLEN (INET6_ADDRSTRLEN + 30)
 
 union g_addr {
   struct in_addr ipv4;
@@ -41,6 +45,14 @@ enum nexthop_types_t
   NEXTHOP_TYPE_BLACKHOLE,        /* Null0 nexthop.  */
 };
 
+/* Nexthop label structure. */
+struct nexthop_label
+{
+  u_int8_t num_labels;
+  u_int8_t reserved[3];
+  mpls_label_t label[0]; /* 1 or more labels. */
+};
+
 /* Nexthop structure. */
 struct nexthop
 {
@@ -48,7 +60,7 @@ struct nexthop
   struct nexthop *prev;
 
   /* Interface index. */
-  unsigned int ifindex;
+  ifindex_t ifindex;
 
   enum nexthop_types_t type;
 
@@ -72,6 +84,12 @@ struct nexthop
    * obtained by recursive resolution will be added to `resolved'.
    * Only one level of recursive resolution is currently supported. */
   struct nexthop *resolved;
+
+  /* Type of label(s), if any */
+  enum lsp_types_t nh_label_type;
+
+  /* Label(s) associated with this nexthop. */
+  struct nexthop_label *nh_label;
 };
 
 extern int zebra_rnh_ip_default_route;
@@ -94,7 +112,12 @@ void copy_nexthops (struct nexthop **tnh, struct nexthop *nh);
 void nexthop_free (struct nexthop *nexthop);
 void nexthops_free (struct nexthop *nexthop);
 
+void nexthop_add_labels (struct nexthop *, enum lsp_types_t, u_int8_t, mpls_label_t *);
+void nexthop_del_labels (struct nexthop *);
+
 extern const char *nexthop_type_to_str (enum nexthop_types_t nh_type);
 extern int nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2);
+extern int nexthop_labels_match (struct nexthop *nh1, struct nexthop *nh2);
 
+extern const char * nexthop2str (struct nexthop *nexthop, char *str, int size);
 #endif /*_LIB_NEXTHOP_H */