summaryrefslogtreecommitdiff
path: root/lib/prefix.h
diff options
context:
space:
mode:
authorpaul <paul>2005-05-06 21:25:49 +0000
committerpaul <paul>2005-05-06 21:25:49 +0000
commit8cc4198f9fabe5f10f5a773de1503d82f33a01fb (patch)
tree77045da709ff66629bd12029b9ee17700360909b /lib/prefix.h
parente7fe8c88c3d552400e1ae3ae9243319ab95d6f2d (diff)
2005-05-06 Paul Jakma <paul@dishone.st>
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
Diffstat (limited to 'lib/prefix.h')
-rw-r--r--lib/prefix.h83
1 files changed, 43 insertions, 40 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index 506d644e..7afe7a1e 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -23,6 +23,8 @@
#ifndef _ZEBRA_PREFIX_H
#define _ZEBRA_PREFIX_H
+#include "sockunion.h"
+
/*
* A struct prefix contains an address family, a prefix length, and an
* address. This can represent either a 'network prefix' as defined
@@ -125,58 +127,59 @@ struct prefix_rd
#define PREFIX_FAMILY(p) ((p)->family)
/* Prototypes. */
-int afi2family (int);
-int family2afi (int);
-
-struct prefix *prefix_new ();
-void prefix_free (struct prefix *);
-const char *prefix_family_str (const struct prefix *);
-int prefix_blen (const struct prefix *);
-int str2prefix (const char *, struct prefix *);
-int prefix2str (const struct prefix *, char *, int);
-int prefix_match (const struct prefix *, const struct prefix *);
-int prefix_same (const struct prefix *, const struct prefix *);
-int prefix_cmp (const struct prefix *, const struct prefix *);
-void prefix_copy (struct prefix *dest, const struct prefix *src);
-void apply_mask (struct prefix *);
-
-struct prefix *sockunion2prefix ();
-struct prefix *sockunion2hostprefix ();
-
-struct prefix_ipv4 *prefix_ipv4_new ();
-void prefix_ipv4_free (struct prefix_ipv4 *);
-int str2prefix_ipv4 (const char *, struct prefix_ipv4 *);
-void apply_mask_ipv4 (struct prefix_ipv4 *);
-
-int prefix_ipv4_any (const struct prefix_ipv4 *);
-void apply_classful_mask_ipv4 (struct prefix_ipv4 *);
-
-u_char ip_masklen (struct in_addr);
-void masklen2ip (int, struct in_addr *);
+extern int afi2family (int);
+extern int family2afi (int);
+
+extern struct prefix *prefix_new (void);
+extern void prefix_free (struct prefix *);
+extern const char *prefix_family_str (const struct prefix *);
+extern int prefix_blen (const struct prefix *);
+extern int str2prefix (const char *, struct prefix *);
+extern int prefix2str (const struct prefix *, char *, int);
+extern int prefix_match (const struct prefix *, const struct prefix *);
+extern int prefix_same (const struct prefix *, const struct prefix *);
+extern int prefix_cmp (const struct prefix *, const struct prefix *);
+extern void prefix_copy (struct prefix *dest, const struct prefix *src);
+extern void apply_mask (struct prefix *);
+
+extern struct prefix *sockunion2prefix (const union sockunion *dest,
+ const union sockunion *mask);
+extern struct prefix *sockunion2hostprefix (const union sockunion *);
+
+extern struct prefix_ipv4 *prefix_ipv4_new (void);
+extern void prefix_ipv4_free (struct prefix_ipv4 *);
+extern int str2prefix_ipv4 (const char *, struct prefix_ipv4 *);
+extern void apply_mask_ipv4 (struct prefix_ipv4 *);
+
+extern int prefix_ipv4_any (const struct prefix_ipv4 *);
+extern void apply_classful_mask_ipv4 (struct prefix_ipv4 *);
+
+extern u_char ip_masklen (struct in_addr);
+extern void masklen2ip (int, struct in_addr *);
/* returns the network portion of the host address */
-in_addr_t ipv4_network_addr (in_addr_t hostaddr, int masklen);
+extern in_addr_t ipv4_network_addr (in_addr_t hostaddr, int masklen);
/* given the address of a host on a network and the network mask length,
* calculate the broadcast address for that network;
* special treatment for /31: returns the address of the other host
* on the network by flipping the host bit */
-in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen);
+extern in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen);
-int netmask_str2prefix_str (const char *, const char *, char *);
+extern int netmask_str2prefix_str (const char *, const char *, char *);
#ifdef HAVE_IPV6
-struct prefix_ipv6 *prefix_ipv6_new ();
-void prefix_ipv6_free (struct prefix_ipv6 *);
-int str2prefix_ipv6 (const char *, struct prefix_ipv6 *);
-void apply_mask_ipv6 (struct prefix_ipv6 *);
+extern struct prefix_ipv6 *prefix_ipv6_new (void);
+extern void prefix_ipv6_free (struct prefix_ipv6 *);
+extern int str2prefix_ipv6 (const char *, struct prefix_ipv6 *);
+extern void apply_mask_ipv6 (struct prefix_ipv6 *);
-int ip6_masklen (struct in6_addr);
-void masklen2ip6 (int, struct in6_addr *);
+extern int ip6_masklen (struct in6_addr);
+extern void masklen2ip6 (int, struct in6_addr *);
-void str2in6_addr (const char *, struct in6_addr *);
-const char *inet6_ntoa (struct in6_addr);
+extern void str2in6_addr (const char *, struct in6_addr *);
+extern const char *inet6_ntoa (struct in6_addr);
#endif /* HAVE_IPV6 */
-int all_digit (const char *);
+extern int all_digit (const char *);
#endif /* _ZEBRA_PREFIX_H */