]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap/dlt.h
Redo DLT_/LINKTYPE_ translation.
[libpcap] / pcap / dlt.h
index e7f8cedf254b8986f1af15eb8a8f1cfcbdd036b5..2155891818757a4e2d6035c2921c9662c6471732 100644 (file)
 /*
  * These are the types that are the same on all platforms, and that
  * have been defined by <net/bpf.h> for ages.
+ *
+ * DLT_LOW_MATCHING_MIN is the lowest such value; DLT_LOW_MATCHING_MAX
+ * is the highest such value.
  */
+#define DLT_LOW_MATCHING_MIN   0
+
 #define DLT_NULL       0       /* BSD loopback encapsulation */
 #define DLT_EN10MB     1       /* Ethernet (10Mb) */
 #define DLT_EN3MB      2       /* Experimental Ethernet (3Mb) */
 #define DLT_PPP                9       /* Point-to-point Protocol */
 #define DLT_FDDI       10      /* FDDI */
 
+/*
+ * In case the code that includes this file (directly or indirectly)
+ * has also included OS files that happen to define DLT_LOW_MATCHING_MAX,
+ * with a different value (perhaps because that OS hasn't picked up
+ * the latest version of our DLT definitions), we undefine the
+ * previous value of DLT_LOW_MATCHING_MAX.
+ *
+ * (They shouldn't, because only those 10 values were assigned in
+ * the Good Old Days, before DLT_ code assignment became a bit of
+ * a free-for-all.  Perhaps 11 is DLT_ATM_RFC1483 everywhere 11
+ * is used at all, but 12 is DLT_RAW on some platforms but not
+ * OpenBSD, and the fun continues for several other values.)
+ */
+#ifdef DLT_LOW_MATCHING_MAX
+#undef DLT_LOW_MATCHING_MAX
+#endif
+
+#define DLT_LOW_MATCHING_MAX   DLT_FDDI        /* highest value in this "matching" range */
+
 /*
  * These are types that are different on some platforms, and that
  * have been defined by <net/bpf.h> for ages.  We use #ifdefs to
  * libpcap <net/bpf.h>
  *
  * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS,
- * but I don't know what the right #define is for BSD/OS.
+ * but I don't know what the right #define is for BSD/OS.  The last
+ * release was in October 2003; if anybody cares about making this
+ * work on BSD/OS, give us a pull request for a change to make it work.
  */
 #define DLT_ATM_RFC1483        11      /* LLC-encapsulated ATM */
 
  * anything and doesn't appear to have ever used it for anything.)
  *
  * We define it as 18 on those platforms; it is, unfortunately, used
- * for DLT_CIP in SUSE 6.3, so we don't define it as DLT_PFSYNC
- * in general.  As the packet format for it, like that for
- * DLT_PFLOG, is not only OS-dependent but OS-version-dependent,
- * we don't support printing it in tcpdump except on OSes that
- * have the relevant header files, so it's not that useful on
- * other platforms.
+ * for DLT_CIP in SUSE 6.3, so we don't define it as 18 on all
+ * platforms. We define it as 121 on FreeBSD and as the same
+ * value that we assigned to LINKTYPE_PFSYNC on all remaining
+ * platforms.
  */
 #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 #define DLT_PFSYNC     18
  * and the LINKTYPE_ value that appears in capture files, are the
  * same.
  *
- * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is
+ * DLT_HIGH_MATCHING_MIN is the lowest such value; DLT_HIGH_MATCHING_MAX is
  * the highest such value.
  */
-#define DLT_MATCHING_MIN       104
+#define DLT_HIGH_MATCHING_MIN  104
 
 /*
  * This value was defined by libpcap 0.5; platforms that have defined
 
 /*
  * In case the code that includes this file (directly or indirectly)
- * has also included OS files that happen to define DLT_MATCHING_MAX,
+ * has also included OS files that happen to define DLT_HIGH_MATCHING_MAX,
  * with a different value (perhaps because that OS hasn't picked up
  * the latest version of our DLT definitions), we undefine the
- * previous value of DLT_MATCHING_MAX.
+ * previous value of DLT_HIGH_MATCHING_MAX.
  */
-#ifdef DLT_MATCHING_MAX
-#undef DLT_MATCHING_MAX
+#ifdef DLT_HIGH_MATCHING_MAX
+#undef DLT_HIGH_MATCHING_MAX
 #endif
 
-#define DLT_MATCHING_MAX       299     /* highest value in the "matching" range */
+#define DLT_HIGH_MATCHING_MAX  299     /* highest value in the "matching" range */
 
 #endif /* !defined(lib_pcap_dlt_h) */