From Ivan Sy (with minor modifications):
[obnox/wireshark/wip.git] / wiretap / erf.h
index ff9daa2dbdef6d6d6838d8d58eadd1054840be1a..5c1250cdec9a40472f1b161e7ccdd4dd77255941 100644 (file)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
-* $Id: erf.h,v 1.1 2003/08/26 07:10:38 guy Exp $
+* $Id$
 */
 
 #ifndef __W_ERF_H__
 #define __W_ERF_H__
 
 /* Record type defines */
-#define TYPE_LEGACY    0
-#define TYPE_HDLC_POS  1
-#define TYPE_ETH       2
-#define TYPE_ATM       3
-#define TYPE_AAL5      4
+#define ERF_TYPE_LEGACY             0
+#define ERF_TYPE_HDLC_POS           1
+#define ERF_TYPE_ETH                2
+#define ERF_TYPE_ATM                3
+#define ERF_TYPE_AAL5               4
+#define ERF_TYPE_MC_HDLC            5
+#define ERF_TYPE_MC_RAW             6
+#define ERF_TYPE_MC_ATM             7
+#define ERF_TYPE_MC_RAW_CHANNEL     8
+#define ERF_TYPE_MC_AAL5            9
+#define ERF_TYPE_COLOR_HDLC_POS     10
+#define ERF_TYPE_COLOR_ETH          11
+#define ERF_TYPE_MC_AAL2            12
+#define ERF_TYPE_IP_COUNTER         13
+#define ERF_TYPE_TCP_FLOW_COUNTER   14
+#define ERF_TYPE_DSM_COLOR_HDLC_POS 15
+#define ERF_TYPE_DSM_COLOR_ETH      16
+#define ERF_TYPE_COLOR_MC_HDLC_POS  17
+#define ERF_TYPE_AAL2               18
+#define ERF_TYPE_INFINIBAND         21
+#define ERF_TYPE_IPV4                                          22
+#define ERF_TYPE_IPV6                                          23
+#define ERF_TYPE_RAW_LINK                              24
+
+#define ERF_TYPE_PAD                48
+
+#define ERF_TYPE_MIN  1   /* sanity checking */
+#define ERF_TYPE_MAX  48  /* sanity checking */
 
  /*
   * The timestamp is 64bit unsigned fixed point little-endian value with
-  * 32 bits for second and 32 bits for fraction. For portablility it is
-  * given as two 32 bit valies here, ts[1] == secs, ts[0] == fraction
+  * 32 bits for second and 32 bits for fraction.
   */
-#ifdef G_HAVE_GINT64
 typedef guint64 erf_timestamp_t;
-#else
-typedef guint32        erf_timestamp_t[2];
-#endif
 
 typedef struct erf_record {
        erf_timestamp_t ts;
@@ -65,37 +83,23 @@ typedef struct erf_record {
        guint16         wlen;
 } erf_header_t;
 
-#define MAX_RECORD_LEN 0x10000 /* 64k */
-#define RECORDS_FOR_ERF_CHECK  3
-#define FCS_BITS       32
-
-#ifndef min
-#define min(a, b) ((a) > (b) ? (b) : (a))
-#endif
-
-/*
- * ATM snaplength
- */
-#define ATM_SNAPLEN            48
+typedef struct erf_mc_hdr {
+       guint32 mc;
+} erf_mc_header_t;
 
-/*
- * Size of ATM payload 
- */
-#define ATM_SLEN(h, e)         ATM_SNAPLEN
-#define ATM_WLEN(h, e)         ATM_SNAPLEN
+typedef struct erf_eth_hdr {
+       guint16 eth;
+} erf_eth_header_t;
 
-/*
- * Size of Ethernet payload
- */
-#define ETHERNET_WLEN(h, e)    (g_htons((h)->wlen))
-#define ETHERNET_SLEN(h, e)    min(ETHERNET_WLEN(h, e), g_htons((h)->rlen) - sizeof(*(h)) - 2)
+union erf_subhdr { 
+  struct erf_mc_hdr mc_hdr;
+  struct erf_eth_hdr eth_hdr;
+};
 
-/*
- * Size of HDLC payload
- */
-#define HDLC_WLEN(h, e)                (g_htons((h)->wlen))
-#define HDLC_SLEN(h, e)                min(HDLC_WLEN(h, e), g_htons((h)->rlen) - sizeof(*(h)))
+#define MIN_RECORDS_FOR_ERF_CHECK 3
+#define RECORDS_FOR_ERF_CHECK 20
+#define FCS_BITS       32
 
-int erf_open(wtap *wth, int *err);
+int erf_open(wtap *wth, int *err, gchar **err_info);
 
 #endif /* __W_ERF_H__ */