-static void decode_ether(u_char *, const struct pcap_pkthdr *,
- const u_char *);
-static void decode_loop(u_char *, const struct pcap_pkthdr *,
- const u_char *);
-static void decode_ppp(u_char *, const struct pcap_pkthdr *,
- const u_char *);
-static void decode_pppoe(u_char *, const struct pcap_pkthdr *,
- const u_char *);
-static void decode_pppoe_real(const u_char *pdata, const uint32_t len,
- struct pktsummary *sm);
-static void decode_linux_sll(u_char *, const struct pcap_pkthdr *,
- const u_char *);
-static void decode_raw(u_char *, const struct pcap_pkthdr *,
- const u_char *);
-static void decode_ip(const u_char *pdata, const uint32_t len,
- struct pktsummary *sm);
-static void decode_ipv6(const u_char *pdata, const uint32_t len,
- struct pktsummary *sm);
+#define PPP_HDR_LEN 4
+#define FDDI_HDR_LEN 21
+#define IP_HDR_LEN sizeof(struct ip)
+#define IPV6_HDR_LEN sizeof(struct ip6_hdr)
+#define TCP_HDR_LEN sizeof(struct tcphdr)
+#define UDP_HDR_LEN sizeof(struct udphdr)
+#define NULL_HDR_LEN 4
+#define SLL_HDR_LEN 16
+#define RAW_HDR_LEN 0
+
+#ifndef IPV6_VERSION
+# define IPV6_VERSION 0x60
+#endif
+
+#ifndef IPV6_VERSION_MASK
+# define IPV6_VERSION_MASK 0xF0
+#endif
+
+static int decode_ether(DECODER_ARGS);
+static int decode_loop(DECODER_ARGS);
+static int decode_null(DECODER_ARGS);
+static int decode_ppp(DECODER_ARGS);
+static int decode_pppoe(DECODER_ARGS);
+#ifdef DLT_LINUX_SLL
+static int decode_linux_sll(DECODER_ARGS);
+#endif
+static int decode_raw(DECODER_ARGS);
+
+#define HELPER_ARGS const u_char *pdata, \
+ const uint32_t len, \
+ struct pktsummary *sm
+
+static int helper_pppoe(HELPER_ARGS);
+static int helper_ip(HELPER_ARGS);
+static int helper_ipv6(HELPER_ARGS);
+static void helper_ip_deeper(HELPER_ARGS); /* protocols like TCP/UDP */