#include "zebra.h"
#include "linklist.h"
+#include "memory.h"
+#include "qobj.h"
+
+DECLARE_MTYPE(IF)
+DECLARE_MTYPE(CONNECTED_LABEL)
/* Interface link-layer type, if known. Derived from:
*
#define MAX_CLASS_TYPE 8
#define MAX_PKT_LOSS 50.331642
-/* Link Parameters Status: 0: unset, 1: set, */
+/*
+ * Link Parameters Status:
+ * equal to 0: unset
+ * different from 0: set
+ */
#define LP_UNSET 0x0000
-#define LP_TE 0x0001
+#define LP_TE_METRIC 0x0001
#define LP_MAX_BW 0x0002
#define LP_MAX_RSV_BW 0x0004
#define LP_UNRSV_BW 0x0008
struct if_link_params {
u_int32_t lp_status; /* Status of Link Parameters: */
u_int32_t te_metric; /* Traffic Engineering metric */
+ float default_bw;
float max_bw; /* Maximum Bandwidth */
float max_rsv_bw; /* Maximum Reservable Bandwidth */
float unrsv_bw[MAX_CLASS_TYPE]; /* Unreserved Bandwidth per Class Type (8) */
uint64_t flags;
/* Interface metric */
- int metric;
+ uint32_t metric;
+
+ /* Interface Speed in Mb/s */
+ uint32_t speed;
/* Interface MTU. */
unsigned int mtu; /* IPv4 MTU */
struct route_node *node;
vrf_id_t vrf_id;
+
+ QOBJ_FIELDS
};
+DECLARE_QOBJ_TYPE(interface)
/* Connected address structure. */
struct connected
/* Prototypes. */
extern int if_cmp_name_func (char *, char *);
-extern struct interface *if_create (const char *name, int namelen);
-extern struct interface *if_lookup_by_index (ifindex_t);
-extern struct interface *if_lookup_exact_address (void *matchaddr, int family);
-extern struct interface *if_lookup_address (void *matchaddr, int family);
-extern struct interface *if_lookup_prefix (struct prefix *prefix);
-extern void if_update_vrf (struct interface *, const char *name, int namelen,
- vrf_id_t vrf_id);
-extern struct interface *if_create_vrf (const char *name, int namelen,
- vrf_id_t vrf_id);
-extern struct interface *if_lookup_by_index_vrf (ifindex_t, vrf_id_t vrf_id);
-extern struct interface *if_lookup_exact_address_vrf (void *matchaddr, int family,
- vrf_id_t vrf_id);
-extern struct interface *if_lookup_address_vrf (void *matchaddr, int family,
- vrf_id_t vrf_id);
-extern struct interface *if_lookup_prefix_vrf (struct prefix *prefix,
+extern void if_update (struct interface *, const char *name, int namelen,
+ vrf_id_t vrf_id);
+extern struct interface *if_create (const char *name, int namelen,
+ vrf_id_t vrf_id);
+extern struct interface *if_lookup_by_index (ifindex_t, vrf_id_t vrf_id);
+extern struct interface *if_lookup_exact_address (void *matchaddr, int family,
+ vrf_id_t vrf_id);
+extern struct connected *if_lookup_address (void *matchaddr, int family,
+ vrf_id_t vrf_id);
+extern struct interface *if_lookup_prefix (struct prefix *prefix,
vrf_id_t vrf_id);
-/* These 2 functions are to be used when the ifname argument is terminated
+/* These 3 functions are to be used when the ifname argument is terminated
by a '\0' character: */
-extern struct interface *if_lookup_by_name (const char *ifname);
-extern struct interface *if_get_by_name (const char *ifname);
-
extern struct interface *if_lookup_by_name_all_vrf (const char *ifname);
-extern struct interface *if_lookup_by_name_vrf (const char *ifname,
- vrf_id_t vrf_id);
-extern struct interface *if_get_by_name_vrf (const char *ifname,
+extern struct interface *if_lookup_by_name (const char *ifname,
+ vrf_id_t vrf_id);
+extern struct interface *if_get_by_name (const char *ifname,
vrf_id_t vrf_id);
/* For these 2 functions, the namelen argument should be the precise length
of the ifname string (not counting any optional trailing '\0' character).
In most cases, strnlen should be used to calculate the namelen value. */
extern struct interface *if_lookup_by_name_len(const char *ifname,
- size_t namelen);
-extern struct interface *if_get_by_name_len(const char *ifname,size_t namelen);
-
-extern struct interface *if_lookup_by_name_len_vrf(const char *ifname,
- size_t namelen, vrf_id_t vrf_id);
-extern struct interface *if_get_by_name_len_vrf(const char *ifname,
+ size_t namelen, vrf_id_t vrf_id);
+extern struct interface *if_get_by_name_len(const char *ifname,
size_t namelen, vrf_id_t vrf_id, int vty);
extern int if_is_multicast (struct interface *);
extern void if_add_hook (int, int (*)(struct interface *));
extern void if_init (struct list **);
+extern void if_cmd_init (void);
extern void if_terminate (struct list **);
extern void if_dump_all (void);
extern const char *if_flag_dump(unsigned long);
/* Please use ifindex2ifname instead of if_indextoname where possible;
ifindex2ifname uses internal interface info, whereas if_indextoname must
make a system call. */
-extern const char *ifindex2ifname (ifindex_t);
-extern const char *ifindex2ifname_vrf (ifindex_t, vrf_id_t vrf_id);
+extern const char *ifindex2ifname (ifindex_t, vrf_id_t vrf_id);
/* Please use ifname2ifindex instead of if_nametoindex where possible;
ifname2ifindex uses internal interface info, whereas if_nametoindex must
make a system call. */
-extern ifindex_t ifname2ifindex(const char *ifname);
-extern ifindex_t ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id);
+extern ifindex_t ifname2ifindex(const char *ifname, vrf_id_t vrf_id);
/* Connected address functions. */
extern struct connected *connected_new (void);
extern void nbr_connected_free (struct nbr_connected *);
struct nbr_connected *nbr_connected_check (struct interface *, struct prefix *);
-#ifndef HAVE_IF_NAMETOINDEX
-extern ifindex_t if_nametoindex (const char *);
-#endif
-#ifndef HAVE_IF_INDEXTONAME
-extern char *if_indextoname (ifindex_t, char *);
-#endif
-
/* link parameters */
struct if_link_params *if_link_params_get (struct interface *);
void if_link_params_free (struct interface *);
-/* Exported variables. */
-extern struct cmd_element interface_desc_cmd;
-extern struct cmd_element no_interface_desc_cmd;
-extern struct cmd_element interface_cmd;
-extern struct cmd_element no_interface_cmd;
-extern struct cmd_element interface_vrf_cmd;
-extern struct cmd_element no_interface_vrf_cmd;
-extern struct cmd_element interface_pseudo_cmd;
-extern struct cmd_element no_interface_pseudo_cmd;
-extern struct cmd_element show_address_cmd;
-extern struct cmd_element show_address_vrf_cmd;
-extern struct cmd_element show_address_vrf_all_cmd;
-extern struct cmd_element vrf_cmd;
-extern struct cmd_element no_vrf_cmd;
-
#endif /* _ZEBRA_IF_H */