summaryrefslogtreecommitdiffstats
path: root/lib/if.h
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@hpe.com>2016-01-18 10:12:10 +0000
committerPaul Jakma <paul.jakma@hpe.com>2016-02-26 14:11:46 +0000
commit9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744 (patch)
tree1ce5d2e4ecff6b57eb00d40b1a91b3f363ff35fe /lib/if.h
parent954c7d6bcd04c2cf037965adda0f9d11afdcd165 (diff)
downloadquagga-9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744.tar.bz2
quagga-9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744.tar.xz
*: use an ifindex_t type, defined in lib/if.h, for ifindex values
Diffstat (limited to 'lib/if.h')
-rw-r--r--lib/if.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/if.h b/lib/if.h
index 0cb2202a..b3d14ba4 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */
#ifndef _ZEBRA_IF_H
#define _ZEBRA_IF_H
+#include "zebra.h"
#include "linklist.h"
/* Interface link-layer type, if known. Derived from:
@@ -96,6 +97,8 @@ enum zebra_link_type {
#define INTERFACE_NAMSIZ 20
#define INTERFACE_HWADDR_MAX 20
+typedef signed int ifindex_t;
+
#ifdef HAVE_PROC_NET_DEV
struct if_stats
{
@@ -142,7 +145,7 @@ struct interface
/* Interface index (should be IFINDEX_INTERNAL for non-kernel or
deleted interfaces). */
- unsigned int ifindex;
+ ifindex_t ifindex;
#define IFINDEX_INTERNAL 0
/* Zebra internal interface status */
@@ -294,15 +297,14 @@ struct connected
/* Prototypes. */
extern int if_cmp_func (struct interface *, struct interface *);
extern struct interface *if_create (const char *name, int namelen);
-extern struct interface *if_lookup_by_index (unsigned int);
+extern struct interface *if_lookup_by_index (ifindex_t);
extern struct interface *if_lookup_exact_address (struct in_addr);
extern struct interface *if_lookup_address (struct in_addr);
extern struct interface *if_lookup_prefix (struct prefix *prefix);
extern struct interface *if_create_vrf (const char *name, int namelen,
vrf_id_t vrf_id);
-extern struct interface *if_lookup_by_index_vrf (unsigned int,
- 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 (struct in_addr,
vrf_id_t vrf_id);
extern struct interface *if_lookup_address_vrf (struct in_addr,
@@ -359,14 +361,14 @@ extern const char *if_link_type_str (enum zebra_link_type);
/* 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 (unsigned int);
-extern const char *ifindex2ifname_vrf (unsigned int, vrf_id_t vrf_id);
+extern const char *ifindex2ifname (ifindex_t);
+extern const char *ifindex2ifname_vrf (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 unsigned int ifname2ifindex(const char *ifname);
-extern unsigned int ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id);
+extern ifindex_t ifname2ifindex(const char *ifname);
+extern ifindex_t ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id);
/* Connected address functions. */
extern struct connected *connected_new (void);
@@ -381,10 +383,10 @@ extern struct connected *connected_lookup_address (struct interface *,
struct in_addr);
#ifndef HAVE_IF_NAMETOINDEX
-extern unsigned int if_nametoindex (const char *);
+extern ifindex_t if_nametoindex (const char *);
#endif
#ifndef HAVE_IF_INDEXTONAME
-extern char *if_indextoname (unsigned int, char *);
+extern char *if_indextoname (ifindex_t, char *);
#endif
/* Exported variables. */