]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
MPLS: Putting internal objects aside
authorMaria Matejka <mq@ucw.cz>
Thu, 23 Nov 2023 10:41:49 +0000 (11:41 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 8 Jan 2024 12:03:25 +0000 (13:03 +0100)
nest/mpls-internal.h [new file with mode: 0644]
nest/mpls.c
nest/mpls.h

diff --git a/nest/mpls-internal.h b/nest/mpls-internal.h
new file mode 100644 (file)
index 0000000..e5393b9
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *     BIRD Internet Routing Daemon -- MPLS Structures
+ *
+ *     (c) 2022 Ondrej Zajicek <santiago@crfreenet.org>
+ *     (c) 2022 CZ.NIC z.s.p.o.
+ *
+ *     Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#ifndef _BIRD_MPLS_INTERNAL_H_
+#define _BIRD_MPLS_INTERNAL_H_
+
+#include "nest/bird.h"
+#include "lib/bitmap.h"
+#include "lib/hash.h"
+#include "nest/route.h"
+#include "nest/protocol.h"
+#include "nest/mpls.h"
+
+
+struct mpls_domain {
+  node n;                              /* Node in global list of MPLS domains (mpls_domains) */
+  struct mpls_domain_config *cf;       /* Our config */
+  const char *name;
+  pool *pool;                          /* Pool for the domain and associated objects */
+
+  struct lmap labels;                  /* Bitmap of allocated labels */
+  uint label_count;                    /* Number of allocated labels */
+  uint use_count;                      /* Reference counter */
+
+  struct config *removed;              /* Deconfigured, waiting for zero use_count,
+                                          while keeping config obstacle */
+
+  list ranges;                         /* List of label ranges (struct mpls_range) */
+  list handles;                                /* List of label handles (struct mpls_handle) */
+};
+
+struct mpls_range {
+  node n;                              /* Node in mpls_domain.ranges */
+  struct mpls_range_config *cf;                /* Our config */
+  const char *name;
+
+  uint lo, hi;                         /* Label range interval */
+  uint label_count;                    /* Number of allocated labels */
+  uint use_count;                      /* Reference counter */
+  u8 removed;                          /* Deconfigured, waiting for zero use_count */
+};
+
+struct mpls_handle {
+  node n;                              /* Node in mpls_domain.handles */
+
+  struct mpls_range *range;            /* Associated range, keeping reference */
+  uint label_count;                    /* Number of allocated labels */
+};
+
+uint mpls_new_label(struct mpls_domain *m, struct mpls_handle *h, uint n);
+void mpls_free_label(struct mpls_domain *m, struct mpls_handle *h, uint n);
+void mpls_move_label(struct mpls_domain *m, struct mpls_handle *fh, struct mpls_handle *th, uint n);
+
+#endif
index 944659f920841d30aa48d64220f050f60893ba23..d384e41c28e9aa82827986074c15b03d67cecff8 100644 (file)
@@ -83,7 +83,7 @@
 
 #include "nest/bird.h"
 #include "nest/route.h"
-#include "nest/mpls.h"
+#include "nest/mpls-internal.h"
 #include "nest/cli.h"
 
 static struct mpls_range *mpls_new_range(struct mpls_domain *m, struct mpls_range_config *cf);
index 2c1ab50f800b0ed87ec2bb3a8834cdcefe93b342..60c382957919762228b9059c9871b0d80af63ff7 100644 (file)
@@ -38,23 +38,6 @@ struct mpls_domain_config {
   struct mpls_range_config *dynamic_range; /* Default dynamic label range */
 };
 
-struct mpls_domain {
-  node n;                              /* Node in global list of MPLS domains (mpls_domains) */
-  struct mpls_domain_config *cf;       /* Our config */
-  const char *name;
-  pool *pool;                          /* Pool for the domain and associated objects */
-
-  struct lmap labels;                  /* Bitmap of allocated labels */
-  uint label_count;                    /* Number of allocated labels */
-  uint use_count;                      /* Reference counter */
-
-  struct config *removed;              /* Deconfigured, waiting for zero use_count,
-                                          while keeping config obstacle */
-
-  list ranges;                         /* List of label ranges (struct mpls_range) */
-  list handles;                                /* List of label handles (struct mpls_handle) */
-};
-
 struct mpls_range_config {
   node n;                              /* Node in mpls_domain_config.ranges */
   struct mpls_range *range;            /* Our instance */
@@ -66,23 +49,7 @@ struct mpls_range_config {
   u8 implicit;                         /* Implicitly defined range */
 };
 
-struct mpls_range {
-  node n;                              /* Node in mpls_domain.ranges */
-  struct mpls_range_config *cf;                /* Our config */
-  const char *name;
-
-  uint lo, hi;                         /* Label range interval */
-  uint label_count;                    /* Number of allocated labels */
-  uint use_count;                      /* Reference counter */
-  u8 removed;                          /* Deconfigured, waiting for zero use_count */
-};
-
-struct mpls_handle {
-  node n;                              /* Node in mpls_domain.handles */
-
-  struct mpls_range *range;            /* Associated range, keeping reference */
-  uint label_count;                    /* Number of allocated labels */
-};
+struct mpls_handle;
 
 
 void mpls_init(void);
@@ -91,9 +58,6 @@ void mpls_domain_postconfig(struct mpls_domain_config *cf);
 struct mpls_range_config * mpls_range_config_new(struct mpls_domain_config *m, struct symbol *s);
 void mpls_preconfig(struct config *c);
 void mpls_commit(struct config *new, struct config *old);
-uint mpls_new_label(struct mpls_domain *m, struct mpls_handle *h, uint n);
-void mpls_free_label(struct mpls_domain *m, struct mpls_handle *h, uint n);
-void mpls_move_label(struct mpls_domain *m, struct mpls_handle *fh, struct mpls_handle *th, uint n);
 
 static inline struct mpls_domain_config *cf_default_mpls_domain(struct config *cfg)
 { return EMPTY_LIST(cfg->mpls_domains) ? NULL : HEAD(cfg->mpls_domains); }