aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>2000-05-19 23:07:04 +0000
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>2000-05-19 23:07:04 +0000
commit476367857a8b56f584106293d25e19e8024f24c5 (patch)
tree349138fc92b8d0ed8fa5f5f4be28c0be0ed92b41 /wiretap
parent9dcf169879c7cda3403bc2458b6c33317865a0c9 (diff)
Add wtap-int.h. Move definitions relevant to the internal workins of wiretap
to that file, leave public definitions in wtap.h. Rename "union pseudo_header" to "union wtap_pseudo_header". Make the wtap_pseudo_header pointer available in packet_info struct. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1989 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ascend-grammar.y4
-rw-r--r--wiretap/ascend-scanner.l4
-rw-r--r--wiretap/ascend.c8
-rw-r--r--wiretap/file.c8
-rw-r--r--wiretap/file_wrappers.c4
-rw-r--r--wiretap/i4btrace.c8
-rw-r--r--wiretap/iptrace.c16
-rw-r--r--wiretap/lanalyzer.c4
-rw-r--r--wiretap/libpcap.c8
-rw-r--r--wiretap/netmon.c8
-rw-r--r--wiretap/nettl.c12
-rw-r--r--wiretap/netxray.c8
-rw-r--r--wiretap/ngsniffer.c20
-rw-r--r--wiretap/radcom.c8
-rw-r--r--wiretap/snoop.c16
-rw-r--r--wiretap/toshiba.c13
-rw-r--r--wiretap/wtap-int.h250
-rw-r--r--wiretap/wtap.c6
-rw-r--r--wiretap/wtap.h218
19 files changed, 337 insertions, 286 deletions
diff --git a/wiretap/ascend-grammar.y b/wiretap/ascend-grammar.y
index c218c2ddb1..033f1fcd95 100644
--- a/wiretap/ascend-grammar.y
+++ b/wiretap/ascend-grammar.y
@@ -1,7 +1,7 @@
%{
/* ascend-grammar.y
*
- * $Id: ascend-grammar.y,v 1.12 2000/05/19 08:18:14 guy Exp $
+ * $Id: ascend-grammar.y,v 1.13 2000/05/19 23:06:46 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -56,7 +56,7 @@ WD_DIALOUT_DISP: chunk 2515EE type IP.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "buffer.h"
#include "ascend.h"
#include "ascend-int.h"
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index 8f11adb35c..3200a30827 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -1,7 +1,7 @@
%{
/* ascend-scanner.l
*
- * $Id: ascend-scanner.l,v 1.15 2000/05/19 08:18:14 guy Exp $
+ * $Id: ascend-scanner.l,v 1.16 2000/05/19 23:06:46 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -34,7 +34,7 @@
#include <io.h> /* for isatty() on win32 */
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "ascend.h"
#include "ascend-grammar.h"
#include "ascend-int.h"
diff --git a/wiretap/ascend.c b/wiretap/ascend.c
index f7484e7f71..84fafc2f33 100644
--- a/wiretap/ascend.c
+++ b/wiretap/ascend.c
@@ -1,6 +1,6 @@
/* ascend.c
*
- * $Id: ascend.c,v 1.15 2000/05/18 09:09:21 guy Exp $
+ * $Id: ascend.c,v 1.16 2000/05/19 23:06:47 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -23,7 +23,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "buffer.h"
#include "ascend.h"
#include "ascend-int.h"
@@ -99,7 +99,7 @@ static const char ascend_w2magic[] = { 'W', 'D', '_', 'D', 'I', 'A', 'L', 'O', '
static int ascend_read(wtap *wth, int *err);
static int ascend_seek_read (wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len);
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
static void ascend_close(wtap *wth);
/* Seeks to the beginning of the next packet, and returns the
@@ -229,7 +229,7 @@ static int ascend_read(wtap *wth, int *err)
}
static int ascend_seek_read (wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len)
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
file_seek(wth->random_fh, seek_off - 1, SEEK_SET);
return parse_ascend(wth->random_fh, pd, &pseudo_header->ascend, NULL, len);
diff --git a/wiretap/file.c b/wiretap/file.c
index bf4c4ee31d..04313967d1 100644
--- a/wiretap/file.c
+++ b/wiretap/file.c
@@ -1,6 +1,6 @@
/* file.c
*
- * $Id: file.c,v 1.51 2000/05/18 09:09:25 guy Exp $
+ * $Id: file.c,v 1.52 2000/05/19 23:06:48 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -35,7 +35,7 @@
#include <io.h> /* open/close on win32 */
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "lanalyzer.h"
@@ -97,7 +97,7 @@ static int (*open_routines[])(wtap *, int *) = {
};
int wtap_def_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len)
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
file_seek(wth->random_fh, seek_off, SEEK_SET);
@@ -444,7 +444,7 @@ FILE* wtap_dump_file(wtap_dumper *wdh)
}
gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
return (wdh->subtype_write)(wdh, phdr, pseudo_header, pd, err);
}
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 4b2f68b191..61ff2261be 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -1,6 +1,6 @@
/* file_wrappers.c
*
- * $Id: file_wrappers.c,v 1.6 2000/03/14 18:27:44 guy Exp $
+ * $Id: file_wrappers.c,v 1.7 2000/05/19 23:06:50 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -99,7 +99,7 @@
#include <errno.h>
#include <stdio.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#ifdef HAVE_LIBZ
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index 4cee96cfbe..115fc76017 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -1,6 +1,6 @@
/* i4btrace.c
*
- * $Id: i4btrace.c,v 1.6 2000/05/19 08:18:15 guy Exp $
+ * $Id: i4btrace.c,v 1.7 2000/05/19 23:06:50 gram Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@@ -27,14 +27,14 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "i4b_trace.h"
static int i4btrace_read(wtap *wth, int *err);
static int i4btrace_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length);
static int i4b_read_rec_header(FILE_T fh, i4b_trace_hdr_t *hdr, int *err);
static void i4b_byte_swap_header(wtap *wth, i4b_trace_hdr_t *hdr);
static int i4b_read_rec_data(FILE_T fh, char *pd, int length, int *err);
@@ -195,7 +195,7 @@ static int i4btrace_read(wtap *wth, int *err)
static int
i4btrace_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;
int err; /* XXX - return this */
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
index 73e6f189b5..91cffe0f9c 100644
--- a/wiretap/iptrace.c
+++ b/wiretap/iptrace.c
@@ -1,6 +1,6 @@
/* iptrace.c
*
- * $Id: iptrace.c,v 1.28 2000/05/19 08:18:15 guy Exp $
+ * $Id: iptrace.c,v 1.29 2000/05/19 23:06:51 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -27,22 +27,22 @@
#include <errno.h>
#include <time.h>
#include <string.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "iptrace.h"
static int iptrace_read_1_0(wtap *wth, int *err);
static int iptrace_seek_read_1_0(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int packet_size);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size);
static int iptrace_read_2_0(wtap *wth, int *err);
static int iptrace_seek_read_2_0(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int packet_size);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size);
static int iptrace_read_rec_header(FILE_T fh, guint8 *header, int header_len,
int *err);
static int iptrace_read_rec_data(FILE_T fh, guint8 *data_ptr, int packet_size,
int *err);
-static void get_atm_pseudo_header(union pseudo_header *pseudo_header,
+static void get_atm_pseudo_header(union wtap_pseudo_header *pseudo_header,
guint8 *header);
static int wtap_encap_ift(unsigned int ift);
@@ -164,7 +164,7 @@ static int iptrace_read_1_0(wtap *wth, int *err)
}
static int iptrace_seek_read_1_0(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int packet_size)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size)
{
int ret;
int err; /* XXX - return this */
@@ -277,7 +277,7 @@ static int iptrace_read_2_0(wtap *wth, int *err)
}
static int iptrace_seek_read_2_0(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int packet_size)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size)
{
int ret;
int err; /* XXX - return this */
@@ -354,7 +354,7 @@ iptrace_read_rec_data(FILE_T fh, guint8 *data_ptr, int packet_size, int *err)
* in some fashion what sort of traffic it is, or being told by the user.
*/
static void
-get_atm_pseudo_header(union pseudo_header *pseudo_header, guint8 *header)
+get_atm_pseudo_header(union wtap_pseudo_header *pseudo_header, guint8 *header)
{
char if_text[9];
char *decimal;
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index 68b1378b75..79242d00f9 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -1,6 +1,6 @@
/* lanalyzer.c
*
- * $Id: lanalyzer.c,v 1.22 2000/05/18 09:09:31 guy Exp $
+ * $Id: lanalyzer.c,v 1.23 2000/05/19 23:06:52 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "lanalyzer.h"
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index 737cab784a..e59115f925 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -1,6 +1,6 @@
/* libpcap.c
*
- * $Id: libpcap.c,v 1.34 2000/05/18 09:09:32 guy Exp $
+ * $Id: libpcap.c,v 1.35 2000/05/19 23:06:53 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -25,7 +25,7 @@
#endif
#include <stdlib.h>
#include <errno.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "libpcap.h"
@@ -90,7 +90,7 @@ static int libpcap_read(wtap *wth, int *err);
static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr);
static void libpcap_close(wtap *wth);
static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err);
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
/*
* XXX - this is a bit of a mess. OpenBSD, and perhaps NetBSD, and
@@ -564,7 +564,7 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
struct pcaprec_modified_hdr rec_hdr;
int hdr_size;
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 8154babf2b..0cc1dd3c29 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -1,6 +1,6 @@
/* netmon.c
*
- * $Id: netmon.c,v 1.30 2000/05/18 09:09:36 guy Exp $
+ * $Id: netmon.c,v 1.31 2000/05/19 23:06:55 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -26,7 +26,7 @@
#include <errno.h>
#include <time.h>
#include <string.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "netmon.h"
@@ -97,7 +97,7 @@ struct netmonrec_2_x_hdr {
static int netmon_read(wtap *wth, int *err);
static void netmon_close(wtap *wth);
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err);
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
static gboolean netmon_dump_close(wtap_dumper *wdh, int *err);
int netmon_open(wtap *wth, int *err)
@@ -472,7 +472,7 @@ gboolean netmon_dump_open(wtap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
netmon_dump_t *netmon = wdh->dump.netmon;
struct netmonrec_1_x_hdr rec_1_x_hdr;
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 401fa53b77..6597a97260 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -1,6 +1,6 @@
/* nettl.c
*
- * $Id: nettl.c,v 1.12 2000/05/19 08:18:15 guy Exp $
+ * $Id: nettl.c,v 1.13 2000/05/19 23:06:57 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "nettl.h"
@@ -66,9 +66,9 @@ struct nettlrec_ns_ls_ip_hdr {
static int nettl_read(wtap *wth, int *err);
static int nettl_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length);
static int nettl_read_rec_header(wtap *wth, FILE_T fh,
- struct wtap_pkthdr *phdr, union pseudo_header *pseudo_header,
+ struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header,
int *err);
static int nettl_read_rec_data(FILE_T fh, char *pd, int length, int *err);
static void nettl_close(wtap *wth);
@@ -151,7 +151,7 @@ static int nettl_read(wtap *wth, int *err)
static int
nettl_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;
int err; /* XXX - return this */
@@ -175,7 +175,7 @@ nettl_seek_read(wtap *wth, int seek_off,
static int
nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
- union pseudo_header *pseudo_header, int *err)
+ union wtap_pseudo_header *pseudo_header, int *err)
{
int bytes_read;
struct nettlrec_sx25l2_hdr lapb_hdr;
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 400d002ffc..63d7ce5cdd 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1,6 +1,6 @@
/* netxray.c
*
- * $Id: netxray.c,v 1.27 2000/05/18 09:09:39 guy Exp $
+ * $Id: netxray.c,v 1.28 2000/05/19 23:06:58 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -28,7 +28,7 @@
#include <errno.h>
#include <time.h>
#include <string.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "netxray.h"
#include "buffer.h"
@@ -93,7 +93,7 @@ struct netxrayrec_2_x_hdr {
static int netxray_read(wtap *wth, int *err);
static void netxray_close(wtap *wth);
static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err);
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err);
int netxray_open(wtap *wth, int *err)
@@ -362,7 +362,7 @@ gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
netxray_dump_t *netxray = wdh->dump.netxray;
guint32 timestamp;
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index b7c352a848..465bacea89 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.41 2000/05/19 08:18:16 guy Exp $
+ * $Id: ngsniffer.c,v 1.42 2000/05/19 23:06:59 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -63,7 +63,7 @@
#include <errno.h>
#include <time.h>
#include <string.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "ngsniffer.h"
@@ -248,21 +248,21 @@ static double Usec[] = { 15.0, 0.838096, 15.0, 0.5, 2.0, 1.0, 0.1 };
static int ngsniffer_read(wtap *wth, int *err);
static int ngsniffer_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int packet_size);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size);
static int ngsniffer_read_rec_header(FILE_T fh, guint16 *typep,
guint16 *lengthp, int *err);
static int ngsniffer_read_frame2(FILE_T fh, struct frame2_rec *frame2,
int *err);
-static void set_pseudo_header_frame2(union pseudo_header *pseudo_header,
+static void set_pseudo_header_frame2(union wtap_pseudo_header *pseudo_header,
struct frame2_rec *frame2);
static int ngsniffer_read_frame4(FILE_T fh, struct frame4_rec *frame4,
int *err);
-static void set_pseudo_header_frame4(union pseudo_header *pseudo_header,
+static void set_pseudo_header_frame4(union wtap_pseudo_header *pseudo_header,
struct frame4_rec *frame4);
static int ngsniffer_read_rec_data(FILE_T fh, char *pd, int length, int *err);
static void ngsniffer_close(wtap *wth);
static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err);
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err);
int ngsniffer_open(wtap *wth, int *err)
@@ -577,7 +577,7 @@ found:
}
static int ngsniffer_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int packet_size)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size)
{
int ret;
int err; /* XXX - return this */
@@ -684,7 +684,7 @@ static int ngsniffer_read_frame2(FILE_T fh, struct frame2_rec *frame2,
return 0;
}
-static void set_pseudo_header_frame2(union pseudo_header *pseudo_header,
+static void set_pseudo_header_frame2(union wtap_pseudo_header *pseudo_header,
struct frame2_rec *frame2)
{
/*
@@ -728,7 +728,7 @@ static int ngsniffer_read_frame4(FILE_T fh, struct frame4_rec *frame4,
return 0;
}
-static void set_pseudo_header_frame4(union pseudo_header *pseudo_header,
+static void set_pseudo_header_frame4(union wtap_pseudo_header *pseudo_header,
struct frame4_rec *frame4)
{
pseudo_header->ngsniffer_atm.AppTrafType = frame4->atm_info.AppTrafType;
@@ -834,7 +834,7 @@ gboolean ngsniffer_dump_open(wtap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
ngsniffer_dump_t *priv = wdh->dump.ngsniffer;
struct frame2_rec rec_hdr;
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 1030649844..dfeb0ea5be 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -1,6 +1,6 @@
/* radcom.c
*
- * $Id: radcom.c,v 1.22 2000/05/19 08:18:16 guy Exp $
+ * $Id: radcom.c,v 1.23 2000/05/19 23:07:01 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "radcom.h"
@@ -69,7 +69,7 @@ struct radcomrec_hdr {
static int radcom_read(wtap *wth, int *err);
static int radcom_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length);
static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr,
int *err);
static int radcom_read_rec_data(FILE_T fh, char *pd, int length, int *err);
@@ -292,7 +292,7 @@ static int radcom_read(wtap *wth, int *err)
static int
radcom_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;
int err; /* XXX - return this */
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index bc1595a414..5f2b6ce868 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -1,6 +1,6 @@
/* snoop.c
*
- * $Id: snoop.c,v 1.27 2000/05/19 08:18:17 guy Exp $
+ * $Id: snoop.c,v 1.28 2000/05/19 23:07:02 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -24,7 +24,7 @@
#include "config.h"
#endif
#include <errno.h>
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "snoop.h"
@@ -57,12 +57,12 @@ struct snooprec_hdr {
static int snoop_read(wtap *wth, int *err);
static int snoop_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length);
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length);
static int snoop_read_atm_pseudoheader(FILE_T fh,
- union pseudo_header *pseudo_header, int *err);
+ union wtap_pseudo_header *pseudo_header, int *err);
static int snoop_read_rec_data(FILE_T fh, char *pd, int length, int *err);
static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err);
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
/*
* See
@@ -320,7 +320,7 @@ static int snoop_read(wtap *wth, int *err)
static int
snoop_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, u_char *pd, int length)
+ union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;
int err; /* XXX - return this */
@@ -343,7 +343,7 @@ snoop_seek_read(wtap *wth, int seek_off,
}
static int
-snoop_read_atm_pseudoheader(FILE_T fh, union pseudo_header *pseudo_header,
+snoop_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
int *err)
{
char atm_phdr[4];
@@ -471,7 +471,7 @@ gboolean snoop_dump_open(wtap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
struct snooprec_hdr rec_hdr;
int nwritten;
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c
index 2072e41190..caa0b6c249 100644
--- a/wiretap/toshiba.c
+++ b/wiretap/toshiba.c
@@ -1,6 +1,6 @@
/* toshiba.c
*
- * $Id: toshiba.c,v 1.10 2000/05/19 08:18:17 guy Exp $
+ * $Id: toshiba.c,v 1.11 2000/05/19 23:07:03 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -23,7 +23,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "buffer.h"
#include "toshiba.h"
#include "file_wrappers.h"
@@ -105,11 +105,12 @@ static const char toshiba_rec_magic[] = { '[', 'N', 'o', '.' };
#define TOSHIBA_REC_MAGIC_SIZE (sizeof toshiba_rec_magic / sizeof toshiba_rec_magic[0])
static int toshiba_read(wtap *wth, int *err);
-static int toshiba_seek_read(wtap *wth, int seek_off, union pseudo_header *pseudo_header, guint8 *pd, int len);
+static int toshiba_seek_read(wtap *wth, int seek_off,
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, int byte_offset);
static int parse_toshiba_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err);
static int parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
- union pseudo_header *pseudo_header, int *err);
+ union wtap_pseudo_header *pseudo_header, int *err);
/* Seeks to the beginning of the next packet, and returns the
byte offset. Returns -1 on failure. */
@@ -228,7 +229,7 @@ static int toshiba_read(wtap *wth, int *err)
/* Used to read packets in random-access fashion */
static int
-toshiba_seek_read (wtap *wth, int seek_off, union pseudo_header *pseudo_header,
+toshiba_seek_read (wtap *wth, int seek_off, union wtap_pseudo_header *pseudo_header,
guint8 *pd, int len)
{
int pkt_len;
@@ -251,7 +252,7 @@ toshiba_seek_read (wtap *wth, int seek_off, union pseudo_header *pseudo_header,
/* Parses a packet record header. */
static int
parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
- union pseudo_header *pseudo_header, int *err)
+ union wtap_pseudo_header *pseudo_header, int *err)
{
char line[TOSHIBA_LINE_LENGTH];
int num_items_scanned;
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h
new file mode 100644
index 0000000000..5429769868
--- /dev/null
+++ b/wiretap/wtap-int.h
@@ -0,0 +1,250 @@
+/* wtap-int.h
+ *
+ * $Id: wtap-int.h,v 1.1 2000/05/19 23:07:04 gram Exp $
+ *
+ * Wiretap Library
+ * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __WTAP_INT_H__
+#define __WTAP_INT_H__
+
+
+#include <sys/types.h>
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <glib.h>
+#include <stdio.h>
+
+#ifdef HAVE_LIBZ
+#include "zlib.h"
+#define FILE_T gzFile
+#else /* No zLib */
+#define FILE_T FILE *
+#endif /* HAVE_LIBZ */
+
+#include "wtap.h"
+
+typedef struct {
+ double timeunit;
+ time_t start;
+ int is_atm;
+} ngsniffer_t;
+
+typedef struct {
+ gboolean byte_swapped;
+ int bchannel_prot[2]; /* For the V.120 heuristic */
+} i4btrace_t;
+
+typedef struct {
+ gboolean is_hpux_11;
+} nettl_t;
+
+typedef struct {
+ time_t start;
+} lanalyzer_t;
+
+typedef struct {
+ gboolean byte_swapped;
+ gboolean modified;
+ guint16 version_major;
+ guint16 version_minor;
+} libpcap_t;
+
+typedef struct {
+ time_t start_secs;
+ guint32 start_usecs;
+ guint8 version_major;
+ guint32 *frame_table;
+ int frame_table_size;
+ int current_frame;
+} netmon_t;
+
+typedef struct {
+ time_t start_time;
+ double timeunit;
+ double start_timestamp;
+ int wrapped;
+ int end_offset;
+ int version_major;
+} netxray_t;
+
+typedef struct {
+ time_t inittime;
+ int adjusted;
+ int seek_add;
+} ascend_t;
+
+
+typedef int (*subtype_read_func)(struct wtap*, int*);
+typedef int (*subtype_seek_read_func)(struct wtap*, int, union wtap_pseudo_header*,
+ guint8*, int);
+struct wtap {
+ FILE_T fh;
+ int fd; /* File descriptor for cap file */
+ FILE_T random_fh; /* Secondary FILE_T for random access */
+ int file_type;
+ int snapshot_length;
+ struct Buffer *frame_buffer;
+ struct wtap_pkthdr phdr;
+ union wtap_pseudo_header pseudo_header;
+
+ long data_offset;
+
+ union {
+ libpcap_t *pcap;
+ lanalyzer_t *lanalyzer;
+ ngsniffer_t *ngsniffer;
+ i4btrace_t *i4btrace;
+ nettl_t *nettl;
+ netmon_t *netmon;
+ netxray_t *netxray;
+ ascend_t *ascend;
+ } capture;
+
+ subtype_read_func subtype_read;
+ subtype_seek_read_func subtype_seek_read;
+ void (*subtype_close)(struct wtap*);
+ int file_encap; /* per-file, for those
+ file formats that have
+ per-file encapsulation
+ types */
+};
+
+struct wtap_dumper;
+
+typedef gboolean (*subtype_write_func)(struct wtap_dumper*,
+ const struct wtap_pkthdr*, const union wtap_pseudo_header*,
+ const u_char*, int*);
+typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*);
+
+typedef struct {
+ gboolean first_frame;
+ time_t start;
+} ngsniffer_dump_t;
+
+typedef struct {
+ gboolean first_frame;
+ struct timeval start;
+ guint32 nframes;
+} netxray_dump_t;
+
+typedef struct {
+ gboolean got_first_record_time;
+ struct timeval first_record_time;
+ guint32 frame_table_offset;
+ guint32 *frame_table;
+ int frame_table_index;
+ int frame_table_size;
+} netmon_dump_t;
+
+struct wtap_dumper {
+ FILE* fh;
+ int file_type;
+ int snaplen;
+ int encap;
+
+ union {
+ void *opaque;
+ ngsniffer_dump_t *ngsniffer;
+ netmon_dump_t *netmon;
+ netxray_dump_t *netxray;
+ } dump;
+
+ subtype_write_func subtype_write;
+ subtype_close_func subtype_close;
+};
+
+
+/* Macros to byte-swap 32-bit and 16-bit quantities. */
+#define BSWAP32(x) \
+ ((((x)&0xFF000000)>>24) | \
+ (((x)&0x00FF0000)>>8) | \
+ (((x)&0x0000FF00)<<8) | \
+ (((x)&0x000000FF)<<24))
+#define BSWAP16(x) \
+ ((((x)&0xFF00)>>8) | \
+ (((x)&0x00FF)<<8))
+
+/* Turn host-byte-order values into little-endian values. */
+#ifdef WORDS_BIGENDIAN
+#define htoles(s) ((guint16) \
+ ((guint16)((s) & 0x00FF)<<8| \
+ (guint16)((s) & 0xFF00)>>8))
+
+#define htolel(l) ((guint32)((l) & 0x000000FF)<<24| \
+ (guint32)((l) & 0x0000FF00)<<8| \
+ (guint32)((l) & 0x00FF0000)>>8| \
+ (guint32)((l) & 0xFF000000)>>24)
+#else
+#define htoles(s) (s)
+#define htolel(l) (l)
+#endif
+
+/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
+ * byte array, returns the value of the two or four bytes at the pointer.
+ * The pletoh[sl] versions return the little-endian representation.
+ */
+
+#ifndef pntohs
+#define pntohs(p) ((guint16) \
+ ((guint16)*((guint8 *)p+0)<<8| \
+ (guint16)*((guint8 *)p+1)<<0))
+#endif
+
+#ifndef pntohl
+#define pntohl(p) ((guint32)*((guint8 *)p+0)<<24| \
+ (guint32)*((guint8 *)p+1)<<16| \
+ (guint32)*((guint8 *)p+2)<<8| \
+ (guint32)*((guint8 *)p+3)<<0)
+#endif
+
+#ifndef phtons
+#define phtons(p) ((guint16) \
+ ((guint16)*((guint8 *)p+0)<<8| \
+ (guint16)*((guint8 *)p+1)<<0))
+#endif
+
+#ifndef phtonl
+#define phtonl(p) ((guint32)*((guint8 *)p+0)<<24| \
+ (guint32)*((guint8 *)p+1)<<16| \
+ (guint32)*((guint8 *)p+2)<<8| \
+ (guint32)*((guint8 *)p+3)<<0)
+#endif
+
+#ifndef pletohs
+#define pletohs(p) ((guint16) \
+ ((guint16)*((guint8 *)p+1)<<8| \
+ (guint16)*((guint8 *)p+0)<<0))
+#endif
+
+#ifndef pletohl
+#define pletohl(p) ((guint32)*((guint8 *)p+3)<<24| \
+ (guint32)*((guint8 *)p+2)<<16| \
+ (guint32)*((guint8 *)p+1)<<8| \
+ (guint32)*((guint8 *)p+0)<<0)
+#endif
+
+#endif /* __WTAP_INT_H__ */
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 4762e14cbb..4ce9b263a3 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1,6 +1,6 @@
/* wtap.c
*
- * $Id: wtap.c,v 1.42 2000/05/19 05:33:32 guy Exp $
+ * $Id: wtap.c,v 1.43 2000/05/19 23:07:04 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -26,7 +26,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -242,7 +242,7 @@ int wtap_loop(wtap *wth, int count, wtap_handler callback, u_char* user,
}
int wtap_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len)
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
return wth->subtype_seek_read(wth, seek_off, pseudo_header, pd, len);
}
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index f4e4c70e2f..82de7bdca3 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.70 2000/05/18 09:09:50 guy Exp $
+ * $Id: wtap.h,v 1.71 2000/05/19 23:07:04 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -142,63 +142,6 @@
#include <glib.h>
#include <stdio.h>
-#ifdef HAVE_LIBZ
-#include "zlib.h"
-#define FILE_T gzFile
-#else /* No zLib */
-#define FILE_T FILE *
-#endif /* HAVE_LIBZ */
-
-typedef struct {
- double timeunit;
- time_t start;
- int is_atm;
-} ngsniffer_t;
-
-typedef struct {
- gboolean byte_swapped;
- int bchannel_prot[2]; /* For the V.120 heuristic */
-} i4btrace_t;
-
-typedef struct {
- gboolean is_hpux_11;
-} nettl_t;
-
-typedef struct {
- time_t start;
-} lanalyzer_t;
-
-typedef struct {
- gboolean byte_swapped;
- gboolean modified;
- guint16 version_major;
- guint16 version_minor;
-} libpcap_t;
-
-typedef struct {
- time_t start_secs;
- guint32 start_usecs;
- guint8 version_major;
- guint32 *frame_table;
- int frame_table_size;
- int current_frame;
-} netmon_t;
-
-typedef struct {
- time_t start_time;
- double timeunit;
- double start_timestamp;
- int wrapped;
- int end_offset;
- int version_major;
-} netxray_t;
-
-typedef struct {
- time_t inittime;
- int adjusted;
- int seek_add;
-} ascend_t;
-
/* Packet "pseudo-header" information for X.25 capture files. */
struct x25_phdr {
guint8 flags; /* ENCAP_LAPB : 1st bit means From DCE */
@@ -292,7 +235,7 @@ struct lapd_phdr {
#define AHLT_VCMX_FRAGMENTS 0xc /* VCMX: Fragments */
#define AHLT_VCMX_BPDU 0xe /* VCMX: BPDU */
-union pseudo_header {
+union wtap_pseudo_header {
struct x25_phdr x25;
struct ngsniffer_atm_phdr ngsniffer_atm;
struct ascend_phdr ascend;
@@ -307,89 +250,14 @@ struct wtap_pkthdr {
};
typedef void (*wtap_handler)(u_char*, const struct wtap_pkthdr*,
- int, union pseudo_header *pseudo_header, const u_char *);
+ int, union wtap_pseudo_header *pseudo_header, const u_char *);
struct wtap;
struct Buffer;
-
-typedef int (*subtype_read_func)(struct wtap*, int*);
-typedef int (*subtype_seek_read_func)(struct wtap*, int, union pseudo_header*,
- guint8*, int);
-typedef struct wtap {
- FILE_T fh;
- int fd; /* File descriptor for cap file */
- FILE_T random_fh; /* Secondary FILE_T for random access */
- int file_type;
- int snapshot_length;
- struct Buffer *frame_buffer;
- struct wtap_pkthdr phdr;
- union pseudo_header pseudo_header;
-
- long data_offset;
-
- union {
- libpcap_t *pcap;
- lanalyzer_t *lanalyzer;
- ngsniffer_t *ngsniffer;
- i4btrace_t *i4btrace;
- nettl_t *nettl;
- netmon_t *netmon;
- netxray_t *netxray;
- ascend_t *ascend;
- } capture;
-
- subtype_read_func subtype_read;
- subtype_seek_read_func subtype_seek_read;
- void (*subtype_close)(struct wtap*);
- int file_encap; /* per-file, for those
- file formats that have
- per-file encapsulation
- types */
-} wtap;
-
struct wtap_dumper;
-typedef gboolean (*subtype_write_func)(struct wtap_dumper*,
- const struct wtap_pkthdr*, const union pseudo_header*,
- const u_char*, int*);
-typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*);
-
-typedef struct {
- gboolean first_frame;
- time_t start;
-} ngsniffer_dump_t;
-
-typedef struct {
- gboolean first_frame;
- struct timeval start;
- guint32 nframes;
-} netxray_dump_t;
-
-typedef struct {
- gboolean got_first_record_time;
- struct timeval first_record_time;
- guint32 frame_table_offset;
- guint32 *frame_table;
- int frame_table_index;
- int frame_table_size;
-} netmon_dump_t;
-
-typedef struct wtap_dumper {
- FILE* fh;
- int file_type;
- int snaplen;
- int encap;
-
- union {
- void *opaque;
- ngsniffer_dump_t *ngsniffer;
- netmon_dump_t *netmon;
- netxray_dump_t *netxray;
- } dump;
-
- subtype_write_func subtype_write;
- subtype_close_func subtype_close;
-} wtap_dumper;
+typedef struct wtap wtap;
+typedef struct wtap_dumper wtap_dumper;
/*
* On failure, "wtap_open_offline()" returns NULL, and puts into the
@@ -399,7 +267,7 @@ typedef struct wtap_dumper {
*
* a negative number, indicating the type of error, on other failures.
*/
-wtap* wtap_open_offline(const char *filename, int *err, gboolean do_random);
+struct wtap* wtap_open_offline(const char *filename, int *err, gboolean do_random);
int wtap_loop(wtap *wth, int, wtap_handler, u_char*, int*);
int wtap_read(wtap *wth, int *err);
@@ -421,9 +289,9 @@ const char *wtap_strerror(int err);
void wtap_sequential_close(wtap *wth);
void wtap_close(wtap *wth);
int wtap_seek_read (wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len);
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
int wtap_def_seek_read (wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len);
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
gboolean wtap_dump_can_open(int filetype);
gboolean wtap_dump_can_write_encap(int filetype, int encap);
@@ -432,7 +300,7 @@ wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen,
int *err);
gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *,
- const union pseudo_header *pseudo_header, const u_char *, int *err);
+ const union wtap_pseudo_header *pseudo_header, const u_char *, int *err);
FILE* wtap_dump_file(wtap_dumper *);
gboolean wtap_dump_close(wtap_dumper *, int *);
@@ -480,73 +348,5 @@ int wtap_pcap_encap_to_wtap_encap(int encap);
#define WTAP_ERR_ZLIB_MAX -100
#define WTAP_ERR_ZLIB_MIN -300
-/* Macros to byte-swap 32-bit and 16-bit quantities. */
-#define BSWAP32(x) \
- ((((x)&0xFF000000)>>24) | \
- (((x)&0x00FF0000)>>8) | \
- (((x)&0x0000FF00)<<8) | \
- (((x)&0x000000FF)<<24))
-#define BSWAP16(x) \
- ((((x)&0xFF00)>>8) | \
- (((x)&0x00FF)<<8))
-
-/* Turn host-byte-order values into little-endian values. */
-#ifdef WORDS_BIGENDIAN
-#define htoles(s) ((guint16) \
- ((guint16)((s) & 0x00FF)<<8| \
- (guint16)((s) & 0xFF00)>>8))
-
-#define htolel(l) ((guint32)((l) & 0x000000FF)<<24| \
- (guint32)((l) & 0x0000FF00)<<8| \
- (guint32)((l) & 0x00FF0000)>>8| \
- (guint32)((l) & 0xFF000000)>>24)
-#else
-#define htoles(s) (s)
-#define htolel(l) (l)
-#endif
-
-/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
- * byte array, returns the value of the two or four bytes at the pointer.
- * The pletoh[sl] versions return the little-endian representation.
- */
-
-#ifndef pntohs
-#define pntohs(p) ((guint16) \
- ((guint16)*((guint8 *)p+0)<<8| \
- (guint16)*((guint8 *)p+1)<<0))
-#endif
-
-#ifndef pntohl
-#define pntohl(p) ((guint32)*((guint8 *)p+0)<<24| \
- (guint32)*((guint8 *)p+1)<<16| \
- (guint32)*((guint8 *)p+2)<<8| \
- (guint32)*((guint8 *)p+3)<<0)
-#endif
-
-#ifndef phtons
-#define phtons(p) ((guint16) \
- ((guint16)*((guint8 *)p+0)<<8| \
- (guint16)*((guint8 *)p+1)<<0))
-#endif
-
-#ifndef phtonl
-#define phtonl(p) ((guint32)*((guint8 *)p+0)<<24| \
- (guint32)*((guint8 *)p+1)<<16| \
- (guint32)*((guint8 *)p+2)<<8| \
- (guint32)*((guint8 *)p+3)<<0)
-#endif
-
-#ifndef pletohs
-#define pletohs(p) ((guint16) \
- ((guint16)*((guint8 *)p+1)<<8| \
- (guint16)*((guint8 *)p+0)<<0))
-#endif
-
-#ifndef pletohl
-#define pletohl(p) ((guint32)*((guint8 *)p+3)<<24| \
- (guint32)*((guint8 *)p+2)<<16| \
- (guint32)*((guint8 *)p+1)<<8| \
- (guint32)*((guint8 *)p+0)<<0)
-#endif
#endif /* __WTAP_H__ */