aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2000-05-19 23:07:04 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2000-05-19 23:07:04 +0000
commitd7e6e0e384967a4d3ac1f57d6446f5a04e83b3c6 (patch)
tree349138fc92b8d0ed8fa5f5f4be28c0be0ed92b41
parent586e1b6fca8da9b031bb99b7010c3c77fbd85045 (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. svn path=/trunk/; revision=1989
-rw-r--r--editcap.c4
-rw-r--r--file.c10
-rw-r--r--file.h4
-rw-r--r--gtk/packet_win.c4
-rw-r--r--packet-ascend.c14
-rw-r--r--packet-ascend.h5
-rw-r--r--packet-atm.c8
-rw-r--r--packet-atm.h4
-rw-r--r--packet-lapb.c4
-rw-r--r--packet-lapb.h4
-rw-r--r--packet-lapd.c4
-rw-r--r--packet-lapd.h4
-rw-r--r--packet-v120.c4
-rw-r--r--packet-v120.h4
-rw-r--r--packet-x25.c4
-rw-r--r--packet-x25.h4
-rw-r--r--packet.c9
-rw-r--r--packet.h10
-rw-r--r--randpkt.c4
-rw-r--r--tethereal.c12
-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
39 files changed, 396 insertions, 347 deletions
diff --git a/editcap.c b/editcap.c
index 11def37864..d0d477e14f 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1,7 +1,7 @@
/* Edit capture files. We can delete records, or simply convert from one
* format to another format.
*
- * $Id: editcap.c,v 1.10 2000/05/18 09:05:29 guy Exp $
+ * $Id: editcap.c,v 1.11 2000/05/19 23:06:06 gram Exp $
*
* Originally written by Richard Sharpe.
* Improved by Guy Harris.
@@ -130,7 +130,7 @@ typedef struct {
static void
edit_callback(u_char *user, const struct wtap_pkthdr *phdr, int offset,
- union pseudo_header *pseudo_header, const u_char *buf)
+ union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
callback_arg *argp = (callback_arg *)user;
int err;
diff --git a/file.c b/file.c
index cfb3eb096b..31e5e64080 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.188 2000/05/18 09:05:30 guy Exp $
+ * $Id: file.c,v 1.189 2000/05/19 23:06:06 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -94,7 +94,7 @@ static guint32 firstsec, firstusec;
static guint32 prevsec, prevusec;
static void wtap_dispatch_cb(u_char *, const struct wtap_pkthdr *, int,
- union pseudo_header *, const u_char *);
+ union wtap_pseudo_header *, const u_char *);
static void set_selected_row(int row);
@@ -500,7 +500,7 @@ apply_color_filter(gpointer filter_arg, gpointer argp)
static int
add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
- union pseudo_header *pseudo_header, const u_char *buf)
+ union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
apply_color_filter_args args;
gint i, row;
@@ -634,7 +634,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
static void
wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset,
- union pseudo_header *pseudo_header, const u_char *buf)
+ union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
frame_data *fdata;
capture_file *cf = (capture_file *) user;
@@ -1422,7 +1422,7 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered,
wtap_dumper *pdh;
frame_data *fdata;
struct wtap_pkthdr hdr;
- union pseudo_header pseudo_header;
+ union wtap_pseudo_header pseudo_header;
guint8 pd[65536];
name_ptr = get_basename(fname);
diff --git a/file.h b/file.h
index c3a2a87378..3788d28605 100644
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.67 2000/05/18 09:05:36 guy Exp $
+ * $Id: file.h,v 1.68 2000/05/19 23:06:07 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -100,7 +100,7 @@ typedef struct _capture_file {
#endif
gchar *sfilter; /* Search filter string */
gboolean sbackward; /* TRUE if search is backward, FALSE if forward */
- union pseudo_header pseudo_header; /* Packet pseudo_header */
+ union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */
guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */
GMemChunk *plist_chunk; /* Memory chunk for frame_data structures */
frame_data *plist; /* Packet list */
diff --git a/gtk/packet_win.c b/gtk/packet_win.c
index 76c6d4517c..ae100ae37d 100644
--- a/gtk/packet_win.c
+++ b/gtk/packet_win.c
@@ -3,7 +3,7 @@
*
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet_win.c,v 1.7 2000/05/18 09:08:20 guy Exp $
+ * $Id: packet_win.c,v 1.8 2000/05/19 23:06:32 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -73,7 +73,7 @@
struct PacketWinData {
gint cap_len;
gint encoding;
- union pseudo_header pseudo_header; /* Pseudo-header for packet */
+ union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */
guint8 *pd; /* Data for packet */
proto_tree *protocol_tree; /* Protocol tree for packet */
GtkWidget *main;
diff --git a/packet-ascend.c b/packet-ascend.c
index 11eeb80d21..2bd557aa4b 100644
--- a/packet-ascend.c
+++ b/packet-ascend.c
@@ -1,7 +1,7 @@
/* packet-ascend.c
* Routines for decoding Lucent/Ascend packet traces
*
- * $Id: packet-ascend.c,v 1.13 2000/05/18 09:05:38 guy Exp $
+ * $Id: packet-ascend.c,v 1.14 2000/05/19 23:06:08 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -53,13 +53,13 @@ static const value_string encaps_vals[] = {
{0, NULL } };
void
-dissect_ascend( tvbuff_t *tvb, const union pseudo_header *pseudo_header,
- packet_info *pinfo, proto_tree *tree)
+dissect_ascend(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_tree *fh_tree;
- proto_item *ti;
- const guint8 *pd;
- int offset;
+ proto_tree *fh_tree;
+ proto_item *ti;
+ const guint8 *pd;
+ int offset;
+ union wtap_pseudo_header *pseudo_header = pinfo->pseudo_header;
pinfo->current_proto = "Lucent/Ascend";
diff --git a/packet-ascend.h b/packet-ascend.h
index 86cd233f69..6be7701497 100644
--- a/packet-ascend.h
+++ b/packet-ascend.h
@@ -1,6 +1,6 @@
/* packet-ascend.h
*
- * $Id: packet-ascend.h,v 1.3 2000/05/18 09:05:40 guy Exp $
+ * $Id: packet-ascend.h,v 1.4 2000/05/19 23:06:08 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -22,5 +22,4 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_ascend(tvbuff_t *, const union pseudo_header *, packet_info *,
- proto_tree *);
+void dissect_ascend(tvbuff_t *, packet_info *, proto_tree *);
diff --git a/packet-atm.c b/packet-atm.c
index 1de50ed766..5a7bbcfb59 100644
--- a/packet-atm.c
+++ b/packet-atm.c
@@ -1,7 +1,7 @@
/* packet-atm.c
* Routines for ATM packet disassembly
*
- * $Id: packet-atm.c,v 1.19 2000/05/18 09:05:40 guy Exp $
+ * $Id: packet-atm.c,v 1.20 2000/05/19 23:06:08 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -372,7 +372,7 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre
}
static void
-dissect_lane(const union pseudo_header *pseudo_header, const u_char *pd,
+dissect_lane(const union wtap_pseudo_header *pseudo_header, const u_char *pd,
int offset, frame_data *fd, proto_tree *tree)
{
tvbuff_t *next_tvb;
@@ -485,7 +485,7 @@ static const value_string ipsilon_type_vals[] = {
* We at least know it's AAL5....
*/
static void
-atm_guess_content(union pseudo_header *pseudo_header, const u_char *pd,
+atm_guess_content(union wtap_pseudo_header *pseudo_header, const u_char *pd,
frame_data *fd)
{
if (pseudo_header->ngsniffer_atm.Vpi == 0) {
@@ -550,7 +550,7 @@ atm_guess_content(union pseudo_header *pseudo_header, const u_char *pd,
}
void
-dissect_atm(union pseudo_header *pseudo_header, const u_char *pd,
+dissect_atm(union wtap_pseudo_header *pseudo_header, const u_char *pd,
frame_data *fd, proto_tree *tree)
{
int offset = 0;
diff --git a/packet-atm.h b/packet-atm.h
index c828ee050b..440f62bc2e 100644
--- a/packet-atm.h
+++ b/packet-atm.h
@@ -1,6 +1,6 @@
/* packet-atm.h
*
- * $Id: packet-atm.h,v 1.2 2000/05/18 09:05:43 guy Exp $
+ * $Id: packet-atm.h,v 1.3 2000/05/19 23:06:08 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -22,5 +22,5 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_atm(union pseudo_header *, const u_char *, frame_data *,
+void dissect_atm(union wtap_pseudo_header *, const u_char *, frame_data *,
proto_tree *);
diff --git a/packet-lapb.c b/packet-lapb.c
index e05ded16fc..8af56122cc 100644
--- a/packet-lapb.c
+++ b/packet-lapb.c
@@ -2,7 +2,7 @@
* Routines for lapb frame disassembly
* Olivier Abad <abad@daba.dhis.net>
*
- * $Id: packet-lapb.c,v 1.14 2000/05/18 09:05:44 guy Exp $
+ * $Id: packet-lapb.c,v 1.15 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -50,7 +50,7 @@ static gint ett_lapb = -1;
static gint ett_lapb_control = -1;
void
-dissect_lapb(const union pseudo_header *pseudo_header, const u_char *pd,
+dissect_lapb(const union wtap_pseudo_header *pseudo_header, const u_char *pd,
frame_data *fd, proto_tree *tree)
{
proto_tree *lapb_tree, *ti;
diff --git a/packet-lapb.h b/packet-lapb.h
index 1b31fa370e..ff46719fb1 100644
--- a/packet-lapb.h
+++ b/packet-lapb.h
@@ -1,6 +1,6 @@
/* packet-lapb.h
*
- * $Id: packet-lapb.h,v 1.2 2000/05/18 09:05:45 guy Exp $
+ * $Id: packet-lapb.h,v 1.3 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -22,5 +22,5 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_lapb(const union pseudo_header *, const u_char *, frame_data *,
+void dissect_lapb(const union wtap_pseudo_header *, const u_char *, frame_data *,
proto_tree *);
diff --git a/packet-lapd.c b/packet-lapd.c
index 59df31b6d6..51aa4b0599 100644
--- a/packet-lapd.c
+++ b/packet-lapd.c
@@ -2,7 +2,7 @@
* Routines for LAPD frame disassembly
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-lapd.c,v 1.7 2000/05/18 09:05:46 guy Exp $
+ * $Id: packet-lapd.c,v 1.8 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -84,7 +84,7 @@ static const value_string lapd_sapi_vals[] = {
};
void
-dissect_lapd(const union pseudo_header *pseudo_header, const u_char *pd,
+dissect_lapd(const union wtap_pseudo_header *pseudo_header, const u_char *pd,
frame_data *fd, proto_tree *tree)
{
proto_tree *lapd_tree, *addr_tree;
diff --git a/packet-lapd.h b/packet-lapd.h
index 02c3a9e41b..f5c0834d7a 100644
--- a/packet-lapd.h
+++ b/packet-lapd.h
@@ -1,6 +1,6 @@
/* packet-lapd.h
*
- * $Id: packet-lapd.h,v 1.2 2000/05/18 09:05:47 guy Exp $
+ * $Id: packet-lapd.h,v 1.3 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -22,5 +22,5 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_lapd(const union pseudo_header *, const u_char *, frame_data *,
+void dissect_lapd(const union wtap_pseudo_header *, const u_char *, frame_data *,
proto_tree *);
diff --git a/packet-v120.c b/packet-v120.c
index 8a14de4c94..bc802d06ad 100644
--- a/packet-v120.c
+++ b/packet-v120.c
@@ -2,7 +2,7 @@
* Routines for v120 frame disassembly
* Bert Driehuis <driehuis@playbeing.org>
*
- * $Id: packet-v120.c,v 1.7 2000/05/18 09:05:48 guy Exp $
+ * $Id: packet-v120.c,v 1.8 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -54,7 +54,7 @@ static gint ett_v120_header = -1;
static int dissect_v120_header(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
void
-dissect_v120(const union pseudo_header *pseudo_header, const u_char *pd,
+dissect_v120(const union wtap_pseudo_header *pseudo_header, const u_char *pd,
frame_data *fd, proto_tree *tree)
{
proto_tree *v120_tree, *ti, *tc, *address_tree;
diff --git a/packet-v120.h b/packet-v120.h
index d1b886ee67..78fc99f9a1 100644
--- a/packet-v120.h
+++ b/packet-v120.h
@@ -1,6 +1,6 @@
/* packet-v120.h
*
- * $Id: packet-v120.h,v 1.2 2000/05/18 09:05:49 guy Exp $
+ * $Id: packet-v120.h,v 1.3 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -22,5 +22,5 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_v120(const union pseudo_header *, const u_char *, frame_data *,
+void dissect_v120(const union wtap_pseudo_header *, const u_char *, frame_data *,
proto_tree *);
diff --git a/packet-x25.c b/packet-x25.c
index 4b15f7f564..5f004a9d7b 100644
--- a/packet-x25.c
+++ b/packet-x25.c
@@ -2,7 +2,7 @@
* Routines for x25 packet disassembly
* Olivier Abad <abad@daba.dhis.net>
*
- * $Id: packet-x25.c,v 1.26 2000/05/18 09:05:49 guy Exp $
+ * $Id: packet-x25.c,v 1.27 2000/05/19 23:06:09 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -1366,7 +1366,7 @@ static const value_string sharing_strategy_vals[] = {
};
void
-dissect_x25(const union pseudo_header *pseudo_header, const u_char *pd,
+dissect_x25(const union wtap_pseudo_header *pseudo_header, const u_char *pd,
int offset, frame_data *fd, proto_tree *tree)
{
proto_tree *x25_tree=0, *ti;
diff --git a/packet-x25.h b/packet-x25.h
index c257199575..aea5350dd3 100644
--- a/packet-x25.h
+++ b/packet-x25.h
@@ -1,6 +1,6 @@
/* packet-x25.h
*
- * $Id: packet-x25.h,v 1.4 2000/05/18 09:05:54 guy Exp $
+ * $Id: packet-x25.h,v 1.5 2000/05/19 23:06:10 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -22,5 +22,5 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_x25(const union pseudo_header *, const u_char *, int, frame_data *,
+void dissect_x25(const union wtap_pseudo_header *, const u_char *, int, frame_data *,
proto_tree *);
diff --git a/packet.c b/packet.c
index 463b910f26..f09ae353e2 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.87 2000/05/19 21:47:38 gram Exp $
+ * $Id: packet.c,v 1.88 2000/05/19 23:06:10 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -1066,7 +1066,7 @@ void blank_packetinfo(void)
pi.ptype = PT_NONE;
pi.srcport = 0;
pi.destport = 0;
- pi.current_proto = "";
+ pi.current_proto = "<Missing Protocol Name>";
}
/* Do all one-time initialization. */
@@ -1120,7 +1120,7 @@ init_all_protocols(void)
/* this routine checks the frame type from the cf structure */
void
-dissect_packet(union pseudo_header *pseudo_header, const u_char *pd,
+dissect_packet(union wtap_pseudo_header *pseudo_header, const u_char *pd,
frame_data *fd, proto_tree *tree)
{
proto_tree *fh_tree;
@@ -1171,6 +1171,7 @@ dissect_packet(union pseudo_header *pseudo_header, const u_char *pd,
tvb = tvb_new_real_data(pd, fd->cap_len, -1);
pi.fd = fd;
pi.compat_top_tvb = tvb;
+ pi.pseudo_header = pseudo_header;
TRY {
switch (fd->lnk_t) {
@@ -1205,7 +1206,7 @@ dissect_packet(union pseudo_header *pseudo_header, const u_char *pd,
dissect_atm(pseudo_header, pd, fd, tree);
break;
case WTAP_ENCAP_ASCEND :
- dissect_ascend(tvb, pseudo_header, &pi, tree);
+ dissect_ascend(tvb, &pi, tree);
break;
case WTAP_ENCAP_LAPD :
dissect_lapd(pseudo_header, pd, fd, tree);
diff --git a/packet.h b/packet.h
index 7c22f3bbf8..b483dbc214 100644
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.187 2000/05/19 04:54:35 gram Exp $
+ * $Id: packet.h,v 1.188 2000/05/19 23:06:11 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -125,10 +125,7 @@ typedef struct _frame_proto_data {
/* XXX - some of this stuff is used only while a packet is being dissected;
should we keep around a separate data structure for that, to save
- memory?
-
- Also, should the pseudo-header be supplied by Wiretap when you do a
- seek-and-read, so that we don't have to save it for all frames? */
+ memory? */
typedef struct _frame_data {
struct _frame_data *next; /* Next element in list */
struct _frame_data *prev; /* Previous element in list */
@@ -188,6 +185,7 @@ typedef struct _packet_info {
const char *current_proto; /* name of protocol currently being dissected */
frame_data *fd;
tvbuff_t *compat_top_tvb; /* only needed while converting Ethereal to use tvbuffs */
+ union wtap_pseudo_header *pseudo_header;
int len;
int captured_len;
address dl_src; /* link-layer source address */
@@ -344,7 +342,7 @@ void init_dissect_rpc(void);
* tree *
* They should never modify the packet data.
*/
-void dissect_packet(union pseudo_header *, const u_char *, frame_data *,
+void dissect_packet(union wtap_pseudo_header *, const u_char *, frame_data *,
proto_tree *);
void dissect_data(const u_char *, int, frame_data *, proto_tree *);
void dissect_data_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
diff --git a/randpkt.c b/randpkt.c
index ca68a4d95c..eed8c9c951 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -4,7 +4,7 @@
* Creates random packet traces. Useful for debugging sniffers by testing
* assumptions about the veracity of the data found in the packet.
*
- * $Id: randpkt.c,v 1.6 2000/05/19 02:42:16 gram Exp $
+ * $Id: randpkt.c,v 1.7 2000/05/19 23:06:11 gram Exp $
*
* Copyright (C) 1999 by Gilbert Ramirez <gram@xiexie.org>
*
@@ -225,7 +225,7 @@ main(int argc, char **argv)
wtap_dumper *dump;
struct wtap_pkthdr pkthdr;
- union pseudo_header ps_header;
+ union wtap_pseudo_header ps_header;
int i, j, len_this_pkt, len_random, err;
guint8 buffer[65536];
diff --git a/tethereal.c b/tethereal.c
index d61ad668d3..047aa85737 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.28 2000/05/18 09:06:03 guy Exp $
+ * $Id: tethereal.c,v 1.29 2000/05/19 23:06:12 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -111,9 +111,9 @@ typedef struct {
static int load_cap_file(capture_file *, int);
static void wtap_dispatch_cb_write(u_char *, const struct wtap_pkthdr *, int,
- union pseudo_header *, const u_char *);
+ union wtap_pseudo_header *, const u_char *);
static void wtap_dispatch_cb_print(u_char *, const struct wtap_pkthdr *, int,
- union pseudo_header *, const u_char *);
+ union wtap_pseudo_header *, const u_char *);
static gchar *col_info(frame_data *, gint);
packet_info pi;
@@ -747,7 +747,7 @@ out:
static void
fill_in_fdata(frame_data *fdata, capture_file *cf,
const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, int offset)
+ const union wtap_pseudo_header *pseudo_header, int offset)
{
int i;
@@ -815,7 +815,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
static void
wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr, int offset,
- union pseudo_header *pseudo_header, const u_char *buf)
+ union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
cb_args_t *args = (cb_args_t *) user;
capture_file *cf = args->cf;
@@ -845,7 +845,7 @@ wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr, int offset,
static void
wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset,
- union pseudo_header *pseudo_header, const u_char *buf)
+ union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
cb_args_t *args = (cb_args_t *) user;
capture_file *cf = args->cf;
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__ */