summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw/ipfw2.h
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2009-01-28 11:43:12 +0000
committerluigi <luigi@FreeBSD.org>2009-01-28 11:43:12 +0000
commit427f135f75c140223e2978bc16a1990f7b3b47c6 (patch)
treef55b582cfbe060377a4736be789dcfb2db1ee80a /sbin/ipfw/ipfw2.h
parent80224e0059786ec867e9a331953166fa6d8e2894 (diff)
downloadFreeBSD-src-427f135f75c140223e2978bc16a1990f7b3b47c6.zip
FreeBSD-src-427f135f75c140223e2978bc16a1990f7b3b47c6.tar.gz
Avoid the use of duplicated typedefs -- see the comment for details.
Diffstat (limited to 'sbin/ipfw/ipfw2.h')
-rw-r--r--sbin/ipfw/ipfw2.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h
index dfbb17e..94b21a1 100644
--- a/sbin/ipfw/ipfw2.h
+++ b/sbin/ipfw/ipfw2.h
@@ -210,12 +210,18 @@ struct in6_addr;
void n2mask(struct in6_addr *mask, int n);
int contigmask(uint8_t *p, int len);
-/* forward declarations to avoid header dependency */
-typedef struct _ipfw_insn ipfw_insn;
-typedef struct _ipfw_insn_u32 ipfw_insn_u32;
-typedef struct _ipfw_insn_ip6 ipfw_insn_ip6;
-typedef struct _ipfw_insn_icmp6 ipfw_insn_icmp6;
-
+/*
+ * Forward declarations to avoid include way too many headers.
+ * C does not allow duplicated typedefs, so we use the base struct
+ * that the typedef points to.
+ * Should the typedefs use a different type, the compiler will
+ * still detect the change when compiling the body of the
+ * functions involved, so we do not lose error checking.
+ */
+struct _ipfw_insn;
+struct _ipfw_insn_u32;
+struct _ipfw_insn_ip6;
+struct _ipfw_insn_icmp6;
/*
* The reserved set numer. This is a constant in ip_fw.h
@@ -243,15 +249,15 @@ int ipfw_delete_pipe(int pipe_or_queue, int n);
/* ipv6.c */
void print_unreach6_code(uint16_t code);
-void print_ip6(ipfw_insn_ip6 *cmd, char const *s);
-void print_flow6id( ipfw_insn_u32 *cmd);
-void print_icmp6types(ipfw_insn_u32 *cmd);
-void print_ext6hdr( ipfw_insn *cmd );
+void print_ip6(struct _ipfw_insn_ip6 *cmd, char const *s);
+void print_flow6id(struct _ipfw_insn_u32 *cmd);
+void print_icmp6types(struct _ipfw_insn_u32 *cmd);
+void print_ext6hdr(struct _ipfw_insn *cmd );
-ipfw_insn *add_srcip6(ipfw_insn *cmd, char *av);
-ipfw_insn *add_dstip6(ipfw_insn *cmd, char *av);
+struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av);
+struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av);
-void fill_flow6( ipfw_insn_u32 *cmd, char *av );
+void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av );
void fill_unreach6_code(u_short *codep, char *str);
-void fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av);
-int fill_ext6hdr( ipfw_insn *cmd, char *av);
+void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av);
+int fill_ext6hdr(struct _ipfw_insn *cmd, char *av);
OpenPOWER on IntegriCloud