-#include <tcpdump-stdinc.h>
-
-#include <stdio.h>
-#include <pcap.h>
-
-#include "interface.h"
-#include "addrtoname.h"
-
-/* The header in OpenBSD pflog files. */
-
-struct pfloghdr {
- u_int32_t af;
- char ifname[16];
- int16_t rnr;
- u_int16_t reason;
- u_int16_t action;
- u_int16_t dir;
-};
-#define PFLOG_HDRLEN sizeof(struct pfloghdr)
-
-/* Actions */
-#define PF_PASS 0
-#define PF_DROP 1
-#define PF_SCRUB 2
-
-/* Directions */
-#define PF_IN 0
-#define PF_OUT 1
-
-static struct tok pf_reasons[] = {
- { 0, "match" },
- { 1, "bad-offset" },
- { 2, "fragment" },
- { 3, "short" },
- { 4, "normalize" },
- { 5, "memory" },
+#ifndef HAVE_NET_PFVAR_H
+#error "No pf headers available"
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <net/pfvar.h>
+#include <net/if_pflog.h>
+
+#include <netdissect-stdinc.h>
+
+#include "netdissect.h"
+#include "extract.h"
+
+static const char tstr[] = "[|pflog]";
+
+static const struct tok pf_reasons[] = {
+ { 0, "0(match)" },
+ { 1, "1(bad-offset)" },
+ { 2, "2(fragment)" },
+ { 3, "3(short)" },
+ { 4, "4(normalize)" },
+ { 5, "5(memory)" },
+ { 6, "6(bad-timestamp)" },
+ { 7, "7(congestion)" },
+ { 8, "8(ip-option)" },
+ { 9, "9(proto-cksum)" },
+ { 10, "10(state-mismatch)" },
+ { 11, "11(state-insert)" },
+ { 12, "12(state-limit)" },
+ { 13, "13(src-limit)" },
+ { 14, "14(synproxy)" },