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
This commit is contained in:
parent
586e1b6fca
commit
d7e6e0e384
|
@ -1,7 +1,7 @@
|
||||||
/* Edit capture files. We can delete records, or simply convert from one
|
/* Edit capture files. We can delete records, or simply convert from one
|
||||||
* format to another format.
|
* 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.
|
* Originally written by Richard Sharpe.
|
||||||
* Improved by Guy Harris.
|
* Improved by Guy Harris.
|
||||||
|
@ -130,7 +130,7 @@ typedef struct {
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_callback(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
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;
|
callback_arg *argp = (callback_arg *)user;
|
||||||
int err;
|
int err;
|
||||||
|
|
10
file.c
10
file.c
|
@ -1,7 +1,7 @@
|
||||||
/* file.c
|
/* file.c
|
||||||
* File I/O routines
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -94,7 +94,7 @@ static guint32 firstsec, firstusec;
|
||||||
static guint32 prevsec, prevusec;
|
static guint32 prevsec, prevusec;
|
||||||
|
|
||||||
static void wtap_dispatch_cb(u_char *, const struct wtap_pkthdr *, int,
|
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);
|
static void set_selected_row(int row);
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ apply_color_filter(gpointer filter_arg, gpointer argp)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
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;
|
apply_color_filter_args args;
|
||||||
gint i, row;
|
gint i, row;
|
||||||
|
@ -634,7 +634,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
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;
|
frame_data *fdata;
|
||||||
capture_file *cf = (capture_file *) user;
|
capture_file *cf = (capture_file *) user;
|
||||||
|
@ -1422,7 +1422,7 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered,
|
||||||
wtap_dumper *pdh;
|
wtap_dumper *pdh;
|
||||||
frame_data *fdata;
|
frame_data *fdata;
|
||||||
struct wtap_pkthdr hdr;
|
struct wtap_pkthdr hdr;
|
||||||
union pseudo_header pseudo_header;
|
union wtap_pseudo_header pseudo_header;
|
||||||
guint8 pd[65536];
|
guint8 pd[65536];
|
||||||
|
|
||||||
name_ptr = get_basename(fname);
|
name_ptr = get_basename(fname);
|
||||||
|
|
4
file.h
4
file.h
|
@ -1,7 +1,7 @@
|
||||||
/* file.h
|
/* file.h
|
||||||
* Definitions for file structures and routines
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -100,7 +100,7 @@ typedef struct _capture_file {
|
||||||
#endif
|
#endif
|
||||||
gchar *sfilter; /* Search filter string */
|
gchar *sfilter; /* Search filter string */
|
||||||
gboolean sbackward; /* TRUE if search is backward, FALSE if forward */
|
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 */
|
guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */
|
||||||
GMemChunk *plist_chunk; /* Memory chunk for frame_data structures */
|
GMemChunk *plist_chunk; /* Memory chunk for frame_data structures */
|
||||||
frame_data *plist; /* Packet list */
|
frame_data *plist; /* Packet list */
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
struct PacketWinData {
|
struct PacketWinData {
|
||||||
gint cap_len;
|
gint cap_len;
|
||||||
gint encoding;
|
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 */
|
guint8 *pd; /* Data for packet */
|
||||||
proto_tree *protocol_tree; /* Protocol tree for packet */
|
proto_tree *protocol_tree; /* Protocol tree for packet */
|
||||||
GtkWidget *main;
|
GtkWidget *main;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-ascend.c
|
/* packet-ascend.c
|
||||||
* Routines for decoding Lucent/Ascend packet traces
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -53,13 +53,13 @@ static const value_string encaps_vals[] = {
|
||||||
{0, NULL } };
|
{0, NULL } };
|
||||||
|
|
||||||
void
|
void
|
||||||
dissect_ascend( tvbuff_t *tvb, const union pseudo_header *pseudo_header,
|
dissect_ascend(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
packet_info *pinfo, proto_tree *tree)
|
|
||||||
{
|
{
|
||||||
proto_tree *fh_tree;
|
proto_tree *fh_tree;
|
||||||
proto_item *ti;
|
proto_item *ti;
|
||||||
const guint8 *pd;
|
const guint8 *pd;
|
||||||
int offset;
|
int offset;
|
||||||
|
union wtap_pseudo_header *pseudo_header = pinfo->pseudo_header;
|
||||||
|
|
||||||
pinfo->current_proto = "Lucent/Ascend";
|
pinfo->current_proto = "Lucent/Ascend";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* packet-ascend.h
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -22,5 +22,4 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void dissect_ascend(tvbuff_t *, const union pseudo_header *, packet_info *,
|
void dissect_ascend(tvbuff_t *, packet_info *, proto_tree *);
|
||||||
proto_tree *);
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-atm.c
|
/* packet-atm.c
|
||||||
* Routines for ATM packet disassembly
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* 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
|
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)
|
int offset, frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
tvbuff_t *next_tvb;
|
tvbuff_t *next_tvb;
|
||||||
|
@ -485,7 +485,7 @@ static const value_string ipsilon_type_vals[] = {
|
||||||
* We at least know it's AAL5....
|
* We at least know it's AAL5....
|
||||||
*/
|
*/
|
||||||
static void
|
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)
|
frame_data *fd)
|
||||||
{
|
{
|
||||||
if (pseudo_header->ngsniffer_atm.Vpi == 0) {
|
if (pseudo_header->ngsniffer_atm.Vpi == 0) {
|
||||||
|
@ -550,7 +550,7 @@ atm_guess_content(union pseudo_header *pseudo_header, const u_char *pd,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* packet-atm.h
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -22,5 +22,5 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 *);
|
proto_tree *);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Routines for lapb frame disassembly
|
* Routines for lapb frame disassembly
|
||||||
* Olivier Abad <abad@daba.dhis.net>
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -50,7 +50,7 @@ static gint ett_lapb = -1;
|
||||||
static gint ett_lapb_control = -1;
|
static gint ett_lapb_control = -1;
|
||||||
|
|
||||||
void
|
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)
|
frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
proto_tree *lapb_tree, *ti;
|
proto_tree *lapb_tree, *ti;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* packet-lapb.h
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -22,5 +22,5 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 *);
|
proto_tree *);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Routines for LAPD frame disassembly
|
* Routines for LAPD frame disassembly
|
||||||
* Gilbert Ramirez <gram@xiexie.org>
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -84,7 +84,7 @@ static const value_string lapd_sapi_vals[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
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)
|
frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
proto_tree *lapd_tree, *addr_tree;
|
proto_tree *lapd_tree, *addr_tree;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* packet-lapd.h
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -22,5 +22,5 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 *);
|
proto_tree *);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Routines for v120 frame disassembly
|
* Routines for v120 frame disassembly
|
||||||
* Bert Driehuis <driehuis@playbeing.org>
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* 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);
|
static int dissect_v120_header(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
|
||||||
|
|
||||||
void
|
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)
|
frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
proto_tree *v120_tree, *ti, *tc, *address_tree;
|
proto_tree *v120_tree, *ti, *tc, *address_tree;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* packet-v120.h
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -22,5 +22,5 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 *);
|
proto_tree *);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Routines for x25 packet disassembly
|
* Routines for x25 packet disassembly
|
||||||
* Olivier Abad <abad@daba.dhis.net>
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -1366,7 +1366,7 @@ static const value_string sharing_strategy_vals[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
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)
|
int offset, frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
proto_tree *x25_tree=0, *ti;
|
proto_tree *x25_tree=0, *ti;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* packet-x25.h
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -22,5 +22,5 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 *);
|
proto_tree *);
|
||||||
|
|
9
packet.c
9
packet.c
|
@ -1,7 +1,7 @@
|
||||||
/* packet.c
|
/* packet.c
|
||||||
* Routines for packet disassembly
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -1066,7 +1066,7 @@ void blank_packetinfo(void)
|
||||||
pi.ptype = PT_NONE;
|
pi.ptype = PT_NONE;
|
||||||
pi.srcport = 0;
|
pi.srcport = 0;
|
||||||
pi.destport = 0;
|
pi.destport = 0;
|
||||||
pi.current_proto = "";
|
pi.current_proto = "<Missing Protocol Name>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do all one-time initialization. */
|
/* Do all one-time initialization. */
|
||||||
|
@ -1120,7 +1120,7 @@ init_all_protocols(void)
|
||||||
|
|
||||||
/* this routine checks the frame type from the cf structure */
|
/* this routine checks the frame type from the cf structure */
|
||||||
void
|
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)
|
frame_data *fd, proto_tree *tree)
|
||||||
{
|
{
|
||||||
proto_tree *fh_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);
|
tvb = tvb_new_real_data(pd, fd->cap_len, -1);
|
||||||
pi.fd = fd;
|
pi.fd = fd;
|
||||||
pi.compat_top_tvb = tvb;
|
pi.compat_top_tvb = tvb;
|
||||||
|
pi.pseudo_header = pseudo_header;
|
||||||
|
|
||||||
TRY {
|
TRY {
|
||||||
switch (fd->lnk_t) {
|
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);
|
dissect_atm(pseudo_header, pd, fd, tree);
|
||||||
break;
|
break;
|
||||||
case WTAP_ENCAP_ASCEND :
|
case WTAP_ENCAP_ASCEND :
|
||||||
dissect_ascend(tvb, pseudo_header, &pi, tree);
|
dissect_ascend(tvb, &pi, tree);
|
||||||
break;
|
break;
|
||||||
case WTAP_ENCAP_LAPD :
|
case WTAP_ENCAP_LAPD :
|
||||||
dissect_lapd(pseudo_header, pd, fd, tree);
|
dissect_lapd(pseudo_header, pd, fd, tree);
|
||||||
|
|
10
packet.h
10
packet.h
|
@ -1,7 +1,7 @@
|
||||||
/* packet.h
|
/* packet.h
|
||||||
* Definitions for packet disassembly structures and routines
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* 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;
|
/* 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
|
should we keep around a separate data structure for that, to save
|
||||||
memory?
|
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? */
|
|
||||||
typedef struct _frame_data {
|
typedef struct _frame_data {
|
||||||
struct _frame_data *next; /* Next element in list */
|
struct _frame_data *next; /* Next element in list */
|
||||||
struct _frame_data *prev; /* Previous 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 */
|
const char *current_proto; /* name of protocol currently being dissected */
|
||||||
frame_data *fd;
|
frame_data *fd;
|
||||||
tvbuff_t *compat_top_tvb; /* only needed while converting Ethereal to use tvbuffs */
|
tvbuff_t *compat_top_tvb; /* only needed while converting Ethereal to use tvbuffs */
|
||||||
|
union wtap_pseudo_header *pseudo_header;
|
||||||
int len;
|
int len;
|
||||||
int captured_len;
|
int captured_len;
|
||||||
address dl_src; /* link-layer source address */
|
address dl_src; /* link-layer source address */
|
||||||
|
@ -344,7 +342,7 @@ void init_dissect_rpc(void);
|
||||||
* tree *
|
* tree *
|
||||||
* They should never modify the packet data.
|
* 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 *);
|
proto_tree *);
|
||||||
void dissect_data(const u_char *, int, 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);
|
void dissect_data_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Creates random packet traces. Useful for debugging sniffers by testing
|
* Creates random packet traces. Useful for debugging sniffers by testing
|
||||||
* assumptions about the veracity of the data found in the packet.
|
* 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>
|
* Copyright (C) 1999 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
*
|
*
|
||||||
|
@ -225,7 +225,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
wtap_dumper *dump;
|
wtap_dumper *dump;
|
||||||
struct wtap_pkthdr pkthdr;
|
struct wtap_pkthdr pkthdr;
|
||||||
union pseudo_header ps_header;
|
union wtap_pseudo_header ps_header;
|
||||||
int i, j, len_this_pkt, len_random, err;
|
int i, j, len_this_pkt, len_random, err;
|
||||||
guint8 buffer[65536];
|
guint8 buffer[65536];
|
||||||
|
|
||||||
|
|
12
tethereal.c
12
tethereal.c
|
@ -1,6 +1,6 @@
|
||||||
/* tethereal.c
|
/* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -111,9 +111,9 @@ typedef struct {
|
||||||
|
|
||||||
static int load_cap_file(capture_file *, int);
|
static int load_cap_file(capture_file *, int);
|
||||||
static void wtap_dispatch_cb_write(u_char *, const struct wtap_pkthdr *, 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,
|
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);
|
static gchar *col_info(frame_data *, gint);
|
||||||
|
|
||||||
packet_info pi;
|
packet_info pi;
|
||||||
|
@ -747,7 +747,7 @@ out:
|
||||||
static void
|
static void
|
||||||
fill_in_fdata(frame_data *fdata, capture_file *cf,
|
fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||||
const struct wtap_pkthdr *phdr,
|
const struct wtap_pkthdr *phdr,
|
||||||
const union pseudo_header *pseudo_header, int offset)
|
const union wtap_pseudo_header *pseudo_header, int offset)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -815,7 +815,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
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;
|
cb_args_t *args = (cb_args_t *) user;
|
||||||
capture_file *cf = args->cf;
|
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
|
static void
|
||||||
wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
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;
|
cb_args_t *args = (cb_args_t *) user;
|
||||||
capture_file *cf = args->cf;
|
capture_file *cf = args->cf;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%{
|
%{
|
||||||
/* ascend-grammar.y
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -56,7 +56,7 @@ WD_DIALOUT_DISP: chunk 2515EE type IP.
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "ascend.h"
|
#include "ascend.h"
|
||||||
#include "ascend-int.h"
|
#include "ascend-int.h"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%{
|
%{
|
||||||
/* ascend-scanner.l
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
#include <io.h> /* for isatty() on win32 */
|
#include <io.h> /* for isatty() on win32 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "ascend.h"
|
#include "ascend.h"
|
||||||
#include "ascend-grammar.h"
|
#include "ascend-grammar.h"
|
||||||
#include "ascend-int.h"
|
#include "ascend-int.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ascend.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "ascend.h"
|
#include "ascend.h"
|
||||||
#include "ascend-int.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_read(wtap *wth, int *err);
|
||||||
static int ascend_seek_read (wtap *wth, int seek_off,
|
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);
|
static void ascend_close(wtap *wth);
|
||||||
|
|
||||||
/* Seeks to the beginning of the next packet, and returns the
|
/* 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,
|
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);
|
file_seek(wth->random_fh, seek_off - 1, SEEK_SET);
|
||||||
return parse_ascend(wth->random_fh, pd, &pseudo_header->ascend, NULL, len);
|
return parse_ascend(wth->random_fh, pd, &pseudo_header->ascend, NULL, len);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* file.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
#include <io.h> /* open/close on win32 */
|
#include <io.h> /* open/close on win32 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lanalyzer.h"
|
#include "lanalyzer.h"
|
||||||
|
@ -97,7 +97,7 @@ static int (*open_routines[])(wtap *, int *) = {
|
||||||
};
|
};
|
||||||
|
|
||||||
int wtap_def_seek_read(wtap *wth, int seek_off,
|
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);
|
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,
|
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);
|
return (wdh->subtype_write)(wdh, phdr, pseudo_header, pd, err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* file_wrappers.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* i4btrace.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
|
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
|
||||||
|
@ -27,14 +27,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "i4b_trace.h"
|
#include "i4b_trace.h"
|
||||||
|
|
||||||
static int i4btrace_read(wtap *wth, int *err);
|
static int i4btrace_read(wtap *wth, int *err);
|
||||||
static int i4btrace_seek_read(wtap *wth, int seek_off,
|
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 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 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);
|
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
|
static int
|
||||||
i4btrace_seek_read(wtap *wth, int seek_off,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
int err; /* XXX - return this */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* iptrace.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -27,22 +27,22 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "iptrace.h"
|
#include "iptrace.h"
|
||||||
|
|
||||||
static int iptrace_read_1_0(wtap *wth, int *err);
|
static int iptrace_read_1_0(wtap *wth, int *err);
|
||||||
static int iptrace_seek_read_1_0(wtap *wth, int seek_off,
|
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_read_2_0(wtap *wth, int *err);
|
||||||
static int iptrace_seek_read_2_0(wtap *wth, int seek_off,
|
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,
|
static int iptrace_read_rec_header(FILE_T fh, guint8 *header, int header_len,
|
||||||
int *err);
|
int *err);
|
||||||
static int iptrace_read_rec_data(FILE_T fh, guint8 *data_ptr, int packet_size,
|
static int iptrace_read_rec_data(FILE_T fh, guint8 *data_ptr, int packet_size,
|
||||||
int *err);
|
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);
|
guint8 *header);
|
||||||
static int wtap_encap_ift(unsigned int ift);
|
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,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
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,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
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.
|
* in some fashion what sort of traffic it is, or being told by the user.
|
||||||
*/
|
*/
|
||||||
static void
|
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 if_text[9];
|
||||||
char *decimal;
|
char *decimal;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* lanalyzer.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lanalyzer.h"
|
#include "lanalyzer.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* libpcap.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "libpcap.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 adjust_header(wtap *wth, struct pcaprec_hdr *hdr);
|
||||||
static void libpcap_close(wtap *wth);
|
static void libpcap_close(wtap *wth);
|
||||||
static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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
|
* 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.
|
/* Write a record for a packet to a dump file.
|
||||||
Returns TRUE on success, FALSE on failure. */
|
Returns TRUE on success, FALSE on failure. */
|
||||||
static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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;
|
struct pcaprec_modified_hdr rec_hdr;
|
||||||
int hdr_size;
|
int hdr_size;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* netmon.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "netmon.h"
|
#include "netmon.h"
|
||||||
|
@ -97,7 +97,7 @@ struct netmonrec_2_x_hdr {
|
||||||
static int netmon_read(wtap *wth, int *err);
|
static int netmon_read(wtap *wth, int *err);
|
||||||
static void netmon_close(wtap *wth);
|
static void netmon_close(wtap *wth);
|
||||||
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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);
|
static gboolean netmon_dump_close(wtap_dumper *wdh, int *err);
|
||||||
|
|
||||||
int netmon_open(wtap *wth, 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.
|
/* Write a record for a packet to a dump file.
|
||||||
Returns TRUE on success, FALSE on failure. */
|
Returns TRUE on success, FALSE on failure. */
|
||||||
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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;
|
netmon_dump_t *netmon = wdh->dump.netmon;
|
||||||
struct netmonrec_1_x_hdr rec_1_x_hdr;
|
struct netmonrec_1_x_hdr rec_1_x_hdr;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* nettl.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "nettl.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_read(wtap *wth, int *err);
|
||||||
static int nettl_seek_read(wtap *wth, int seek_off,
|
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,
|
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);
|
int *err);
|
||||||
static int nettl_read_rec_data(FILE_T fh, char *pd, int length, int *err);
|
static int nettl_read_rec_data(FILE_T fh, char *pd, int length, int *err);
|
||||||
static void nettl_close(wtap *wth);
|
static void nettl_close(wtap *wth);
|
||||||
|
@ -151,7 +151,7 @@ static int nettl_read(wtap *wth, int *err)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nettl_seek_read(wtap *wth, int seek_off,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
int err; /* XXX - return this */
|
||||||
|
@ -175,7 +175,7 @@ nettl_seek_read(wtap *wth, int seek_off,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
|
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;
|
int bytes_read;
|
||||||
struct nettlrec_sx25l2_hdr lapb_hdr;
|
struct nettlrec_sx25l2_hdr lapb_hdr;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* netxray.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "netxray.h"
|
#include "netxray.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
@ -93,7 +93,7 @@ struct netxrayrec_2_x_hdr {
|
||||||
static int netxray_read(wtap *wth, int *err);
|
static int netxray_read(wtap *wth, int *err);
|
||||||
static void netxray_close(wtap *wth);
|
static void netxray_close(wtap *wth);
|
||||||
static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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);
|
static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err);
|
||||||
|
|
||||||
int netxray_open(wtap *wth, 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.
|
/* Write a record for a packet to a dump file.
|
||||||
Returns TRUE on success, FALSE on failure. */
|
Returns TRUE on success, FALSE on failure. */
|
||||||
static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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;
|
netxray_dump_t *netxray = wdh->dump.netxray;
|
||||||
guint32 timestamp;
|
guint32 timestamp;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ngsniffer.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "ngsniffer.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_read(wtap *wth, int *err);
|
||||||
static int ngsniffer_seek_read(wtap *wth, int seek_off,
|
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,
|
static int ngsniffer_read_rec_header(FILE_T fh, guint16 *typep,
|
||||||
guint16 *lengthp, int *err);
|
guint16 *lengthp, int *err);
|
||||||
static int ngsniffer_read_frame2(FILE_T fh, struct frame2_rec *frame2,
|
static int ngsniffer_read_frame2(FILE_T fh, struct frame2_rec *frame2,
|
||||||
int *err);
|
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);
|
struct frame2_rec *frame2);
|
||||||
static int ngsniffer_read_frame4(FILE_T fh, struct frame4_rec *frame4,
|
static int ngsniffer_read_frame4(FILE_T fh, struct frame4_rec *frame4,
|
||||||
int *err);
|
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);
|
struct frame4_rec *frame4);
|
||||||
static int ngsniffer_read_rec_data(FILE_T fh, char *pd, int length, int *err);
|
static int ngsniffer_read_rec_data(FILE_T fh, char *pd, int length, int *err);
|
||||||
static void ngsniffer_close(wtap *wth);
|
static void ngsniffer_close(wtap *wth);
|
||||||
static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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);
|
static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err);
|
||||||
|
|
||||||
int ngsniffer_open(wtap *wth, int *err)
|
int ngsniffer_open(wtap *wth, int *err)
|
||||||
|
@ -577,7 +577,7 @@ found:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ngsniffer_seek_read(wtap *wth, int seek_off,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
int err; /* XXX - return this */
|
||||||
|
@ -684,7 +684,7 @@ static int ngsniffer_read_frame2(FILE_T fh, struct frame2_rec *frame2,
|
||||||
return 0;
|
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)
|
struct frame2_rec *frame2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -728,7 +728,7 @@ static int ngsniffer_read_frame4(FILE_T fh, struct frame4_rec *frame4,
|
||||||
return 0;
|
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)
|
struct frame4_rec *frame4)
|
||||||
{
|
{
|
||||||
pseudo_header->ngsniffer_atm.AppTrafType = frame4->atm_info.AppTrafType;
|
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.
|
/* Write a record for a packet to a dump file.
|
||||||
Returns TRUE on success, FALSE on failure. */
|
Returns TRUE on success, FALSE on failure. */
|
||||||
static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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;
|
ngsniffer_dump_t *priv = wdh->dump.ngsniffer;
|
||||||
struct frame2_rec rec_hdr;
|
struct frame2_rec rec_hdr;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* radcom.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "radcom.h"
|
#include "radcom.h"
|
||||||
|
@ -69,7 +69,7 @@ struct radcomrec_hdr {
|
||||||
|
|
||||||
static int radcom_read(wtap *wth, int *err);
|
static int radcom_read(wtap *wth, int *err);
|
||||||
static int radcom_seek_read(wtap *wth, int seek_off,
|
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,
|
static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr,
|
||||||
int *err);
|
int *err);
|
||||||
static int radcom_read_rec_data(FILE_T fh, char *pd, int length, 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
|
static int
|
||||||
radcom_seek_read(wtap *wth, int seek_off,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
int err; /* XXX - return this */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* snoop.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "snoop.h"
|
#include "snoop.h"
|
||||||
|
@ -57,12 +57,12 @@ struct snooprec_hdr {
|
||||||
|
|
||||||
static int snoop_read(wtap *wth, int *err);
|
static int snoop_read(wtap *wth, int *err);
|
||||||
static int snoop_seek_read(wtap *wth, int seek_off,
|
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,
|
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 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,
|
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
|
* See
|
||||||
|
@ -320,7 +320,7 @@ static int snoop_read(wtap *wth, int *err)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
snoop_seek_read(wtap *wth, int seek_off,
|
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 ret;
|
||||||
int err; /* XXX - return this */
|
int err; /* XXX - return this */
|
||||||
|
@ -343,7 +343,7 @@ snoop_seek_read(wtap *wth, int seek_off,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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)
|
int *err)
|
||||||
{
|
{
|
||||||
char atm_phdr[4];
|
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.
|
/* Write a record for a packet to a dump file.
|
||||||
Returns TRUE on success, FALSE on failure. */
|
Returns TRUE on success, FALSE on failure. */
|
||||||
static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
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;
|
struct snooprec_hdr rec_hdr;
|
||||||
int nwritten;
|
int nwritten;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* toshiba.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "toshiba.h"
|
#include "toshiba.h"
|
||||||
#include "file_wrappers.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])
|
#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_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 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_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err);
|
||||||
static int parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
|
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
|
/* Seeks to the beginning of the next packet, and returns the
|
||||||
byte offset. Returns -1 on failure. */
|
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 */
|
/* Used to read packets in random-access fashion */
|
||||||
static int
|
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)
|
guint8 *pd, int len)
|
||||||
{
|
{
|
||||||
int pkt_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. */
|
/* Parses a packet record header. */
|
||||||
static int
|
static int
|
||||||
parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
|
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];
|
char line[TOSHIBA_LINE_LENGTH];
|
||||||
int num_items_scanned;
|
int num_items_scanned;
|
||||||
|
|
|
@ -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__ */
|
|
@ -1,6 +1,6 @@
|
||||||
/* wtap.c
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include "wtap.h"
|
#include "wtap-int.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
#include "buffer.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,
|
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);
|
return wth->subtype_seek_read(wth, seek_off, pseudo_header, pd, len);
|
||||||
}
|
}
|
||||||
|
|
218
wiretap/wtap.h
218
wiretap/wtap.h
|
@ -1,6 +1,6 @@
|
||||||
/* wtap.h
|
/* 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
|
* Wiretap Library
|
||||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
|
||||||
|
@ -142,63 +142,6 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdio.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. */
|
/* Packet "pseudo-header" information for X.25 capture files. */
|
||||||
struct x25_phdr {
|
struct x25_phdr {
|
||||||
guint8 flags; /* ENCAP_LAPB : 1st bit means From DCE */
|
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_FRAGMENTS 0xc /* VCMX: Fragments */
|
||||||
#define AHLT_VCMX_BPDU 0xe /* VCMX: BPDU */
|
#define AHLT_VCMX_BPDU 0xe /* VCMX: BPDU */
|
||||||
|
|
||||||
union pseudo_header {
|
union wtap_pseudo_header {
|
||||||
struct x25_phdr x25;
|
struct x25_phdr x25;
|
||||||
struct ngsniffer_atm_phdr ngsniffer_atm;
|
struct ngsniffer_atm_phdr ngsniffer_atm;
|
||||||
struct ascend_phdr ascend;
|
struct ascend_phdr ascend;
|
||||||
|
@ -307,89 +250,14 @@ struct wtap_pkthdr {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*wtap_handler)(u_char*, const 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 wtap;
|
||||||
struct Buffer;
|
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;
|
struct wtap_dumper;
|
||||||
|
|
||||||
typedef gboolean (*subtype_write_func)(struct wtap_dumper*,
|
typedef struct wtap wtap;
|
||||||
const struct wtap_pkthdr*, const union pseudo_header*,
|
typedef struct wtap_dumper wtap_dumper;
|
||||||
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;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On failure, "wtap_open_offline()" returns NULL, and puts into the
|
* 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.
|
* 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_loop(wtap *wth, int, wtap_handler, u_char*, int*);
|
||||||
int wtap_read(wtap *wth, int *err);
|
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_sequential_close(wtap *wth);
|
||||||
void wtap_close(wtap *wth);
|
void wtap_close(wtap *wth);
|
||||||
int wtap_seek_read (wtap *wth, int seek_off,
|
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,
|
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_open(int filetype);
|
||||||
gboolean wtap_dump_can_write_encap(int filetype, int encap);
|
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,
|
wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen,
|
||||||
int *err);
|
int *err);
|
||||||
gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *,
|
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 *);
|
FILE* wtap_dump_file(wtap_dumper *);
|
||||||
gboolean wtap_dump_close(wtap_dumper *, int *);
|
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_MAX -100
|
||||||
#define WTAP_ERR_ZLIB_MIN -300
|
#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__ */
|
#endif /* __WTAP_H__ */
|
||||||
|
|
Loading…
Reference in New Issue