]> The Tcpdump Group git mirrors - tcpdump/blobdiff - interface.h
As with libpcap, get rid of autom4te.cache when doing "make distclean".
[tcpdump] / interface.h
index c301e37d8f4f205f2ef58cd33eebab95b77dd788..b8acc7d9b5cb78459835d6e09aa9e2f921c324f7 100644 (file)
 #define __attribute__(x)
 #endif
 
+/*
+ * Used to declare a structure unaligned, so that the C compiler,
+ * if necessary, generates code that doesn't assume alignment.
+ * This is required because there is no guarantee that the packet
+ * data we get from libpcap/WinPcap is properly aligned.
+ *
+ * This assumes that, for all compilers that support __attribute__:
+ *
+ *     1) they support __attribute__((packed));
+ *
+ *     2) for all instruction set architectures requiring strict
+ *        alignment, declaring a structure with that attribute
+ *        causes the compiler to generate code that handles
+ *        misaligned 2-byte, 4-byte, and 8-byte integral
+ *        quantities.
+ *
+ * It does not (yet) handle compilers where you can get the compiler
+ * to generate code of that sort by some other means.
+ *
+ * This is required in order to, for example, keep the compiler from
+ * generating, for
+ *
+ *     if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
+ *
+ * in print-bootp.c, code that loads the first 4-byte word of a
+ * "struct bootp", masking out the bp_hops field, and comparing the result
+ * against 0x01010600.
+ *
+ * Note: this also requires that padding be put into the structure,
+ * at least for compilers where it's implemented as __attribute__((packed)).
+ */
+#define UNALIGNED      __attribute__((packed))
+
 /* snprintf et al */
 
 #include <stdarg.h>
@@ -273,7 +306,6 @@ extern u_int juniper_ppp_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
-extern u_int ieee802_15_4_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void snmp_print(const u_char *, u_int);
 extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
 extern u_int symantec_if_print(const struct pcap_pkthdr *, const u_char *);
@@ -357,6 +389,7 @@ extern netdissect_options *gndo;
 #define bflag gndo->ndo_bflag 
 #define eflag gndo->ndo_eflag 
 #define fflag gndo->ndo_fflag 
+#define jflag gndo->ndo_jflag
 #define Kflag gndo->ndo_Kflag 
 #define nflag gndo->ndo_nflag 
 #define Nflag gndo->ndo_Nflag 
@@ -385,6 +418,7 @@ extern netdissect_options *gndo;
 #define Cflag_count gndo->ndo_Cflag_count
 #define Gflag_count gndo->ndo_Gflag_count
 #define Gflag_time gndo->ndo_Gflag_time 
+#define hflag gndo->ndo_hflag
 #define snaplen     gndo->ndo_snaplen
 #define snapend     gndo->ndo_snapend