summaryrefslogtreecommitdiffstats
path: root/lib/vrf.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vrf.h')
-rw-r--r--lib/vrf.h132
1 files changed, 60 insertions, 72 deletions
diff --git a/lib/vrf.h b/lib/vrf.h
index dcbc9b5e6..bdc0db9c9 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -37,11 +37,7 @@
/* Pending: May need to refine this. */
#ifndef IFLA_VRF_MAX
-enum {
- IFLA_VRF_UNSPEC,
- IFLA_VRF_TABLE,
- __IFLA_VRF_MAX
-};
+enum { IFLA_VRF_UNSPEC, IFLA_VRF_TABLE, __IFLA_VRF_MAX };
#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1)
#endif
@@ -60,102 +56,97 @@ enum {
* Pass some OS specific data up through
* to the daemons
*/
-struct vrf_data
-{
- union
- {
- struct {
- uint32_t table_id;
- } l;
- };
+struct vrf_data {
+ union {
+ struct {
+ uint32_t table_id;
+ } l;
+ };
};
-struct vrf
-{
- RB_ENTRY(vrf) id_entry, name_entry;
+struct vrf {
+ RB_ENTRY(vrf) id_entry, name_entry;
- /* Identifier, same as the vector index */
- vrf_id_t vrf_id;
+ /* Identifier, same as the vector index */
+ vrf_id_t vrf_id;
- /* Name */
- char name[VRF_NAMSIZ + 1];
+ /* Name */
+ char name[VRF_NAMSIZ + 1];
- /* Zebra internal VRF status */
- u_char status;
+ /* Zebra internal VRF status */
+ u_char status;
#define VRF_ACTIVE (1 << 0)
- /* Master list of interfaces belonging to this VRF */
- struct list *iflist;
+ /* Master list of interfaces belonging to this VRF */
+ struct list *iflist;
- /* User data */
- void *info;
+ /* User data */
+ void *info;
- /* The table_id from the kernel */
- struct vrf_data data;
+ /* The table_id from the kernel */
+ struct vrf_data data;
- QOBJ_FIELDS
+ QOBJ_FIELDS
};
-RB_HEAD (vrf_id_head, vrf);
-RB_PROTOTYPE (vrf_id_head, vrf, id_entry, vrf_id_compare)
-RB_HEAD (vrf_name_head, vrf);
-RB_PROTOTYPE (vrf_name_head, vrf, name_entry, vrf_name_compare)
+RB_HEAD(vrf_id_head, vrf);
+RB_PROTOTYPE(vrf_id_head, vrf, id_entry, vrf_id_compare)
+RB_HEAD(vrf_name_head, vrf);
+RB_PROTOTYPE(vrf_name_head, vrf, name_entry, vrf_name_compare)
DECLARE_QOBJ_TYPE(vrf)
extern struct vrf_id_head vrfs_by_id;
extern struct vrf_name_head vrfs_by_name;
-extern struct vrf *vrf_lookup_by_id (vrf_id_t);
-extern struct vrf *vrf_lookup_by_name (const char *);
-extern struct vrf *vrf_get (vrf_id_t, const char *);
-extern vrf_id_t vrf_name_to_id (const char *);
-
-#define VRF_GET_ID(V,NAME) \
- do { \
- struct vrf *vrf; \
- if (!(vrf = vrf_lookup_by_name(NAME))) \
- { \
- vty_out (vty, "%% VRF %s not found\n", NAME);\
- return CMD_WARNING; \
- } \
- if (vrf->vrf_id == VRF_UNKNOWN) \
- { \
- vty_out (vty, "%% VRF %s not active\n", NAME);\
- return CMD_WARNING; \
- } \
- (V) = vrf->vrf_id; \
- } while (0)
+extern struct vrf *vrf_lookup_by_id(vrf_id_t);
+extern struct vrf *vrf_lookup_by_name(const char *);
+extern struct vrf *vrf_get(vrf_id_t, const char *);
+extern vrf_id_t vrf_name_to_id(const char *);
+
+#define VRF_GET_ID(V, NAME) \
+ do { \
+ struct vrf *vrf; \
+ if (!(vrf = vrf_lookup_by_name(NAME))) { \
+ vty_out(vty, "%% VRF %s not found\n", NAME); \
+ return CMD_WARNING; \
+ } \
+ if (vrf->vrf_id == VRF_UNKNOWN) { \
+ vty_out(vty, "%% VRF %s not active\n", NAME); \
+ return CMD_WARNING; \
+ } \
+ (V) = vrf->vrf_id; \
+ } while (0)
/*
* Utilities to obtain the user data
*/
/* Get the data pointer of the specified VRF. If not found, create one. */
-extern void *vrf_info_get (vrf_id_t);
+extern void *vrf_info_get(vrf_id_t);
/* Look up the data pointer of the specified VRF. */
-extern void *vrf_info_lookup (vrf_id_t);
+extern void *vrf_info_lookup(vrf_id_t);
/*
* Utilities to obtain the interface list
*/
/* Look up the interface list of the specified VRF. */
-extern struct list *vrf_iflist (vrf_id_t);
+extern struct list *vrf_iflist(vrf_id_t);
/* Get the interface list of the specified VRF. Create one if not find. */
-extern struct list *vrf_iflist_get (vrf_id_t);
+extern struct list *vrf_iflist_get(vrf_id_t);
/*
* VRF bit-map: maintaining flags, one bit per VRF ID
*/
-typedef void * vrf_bitmap_t;
+typedef void *vrf_bitmap_t;
#define VRF_BITMAP_NULL NULL
-extern vrf_bitmap_t vrf_bitmap_init (void);
-extern void vrf_bitmap_free (vrf_bitmap_t);
-extern void vrf_bitmap_set (vrf_bitmap_t, vrf_id_t);
-extern void vrf_bitmap_unset (vrf_bitmap_t, vrf_id_t);
-extern int vrf_bitmap_check (vrf_bitmap_t, vrf_id_t);
+extern vrf_bitmap_t vrf_bitmap_init(void);
+extern void vrf_bitmap_free(vrf_bitmap_t);
+extern void vrf_bitmap_set(vrf_bitmap_t, vrf_id_t);
+extern void vrf_bitmap_unset(vrf_bitmap_t, vrf_id_t);
+extern int vrf_bitmap_check(vrf_bitmap_t, vrf_id_t);
/*
* VRF initializer/destructor
@@ -177,27 +168,24 @@ extern int vrf_bitmap_check (vrf_bitmap_t, vrf_id_t);
* delete -> Called back when a vrf is being deleted from
* the system ( 2 and 3 ) above.
*/
-extern void vrf_init (int (*create)(struct vrf *),
- int (*enable)(struct vrf *),
- int (*disable)(struct vrf *),
- int (*delete)(struct vrf *));
+extern void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
+ int (*disable)(struct vrf *), int (*delete)(struct vrf *));
/*
* Call vrf_terminate when the protocol is being shutdown
*/
-extern void vrf_terminate (void);
+extern void vrf_terminate(void);
-extern void vrf_cmd_init (int (*writefunc)(struct vty *vty));
+extern void vrf_cmd_init(int (*writefunc)(struct vty *vty));
/*
* VRF utilities
*/
/* Create a socket serving for the given VRF */
-extern int vrf_socket (int, int, int, vrf_id_t);
+extern int vrf_socket(int, int, int, vrf_id_t);
/*
* VRF Debugging
*/
-extern void vrf_install_commands (void);
+extern void vrf_install_commands(void);
#endif /*_ZEBRA_VRF_H*/
-