Use longs as file offsets, so that on platforms with 64-bit "long" we

can handle capture files bigger than 2GB.

svn path=/trunk/; revision=3993
This commit is contained in:
Guy Harris 2001-10-04 08:30:36 +00:00
parent f52303ffc9
commit 3c9efdf478
23 changed files with 114 additions and 112 deletions

View File

@ -1,7 +1,7 @@
/* Edit capture files. We can delete records, adjust timestamps, or
* simply convert from one format to another format.
*
* $Id: editcap.c,v 1.17 2001/07/13 07:55:13 guy Exp $
* $Id: editcap.c,v 1.18 2001/10/04 08:30:33 guy Exp $
*
* Originally written by Richard Sharpe.
* Improved by Guy Harris.
@ -137,7 +137,7 @@ typedef struct {
*/
static void
edit_callback(u_char *user, const struct wtap_pkthdr *phdr, int offset,
edit_callback(u_char *user, const struct wtap_pkthdr *phdr, long offset,
union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
callback_arg *argp = (callback_arg *)user;

12
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.244 2001/08/21 06:39:14 guy Exp $
* $Id: file.c,v 1.245 2001/10/04 08:30:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -98,7 +98,7 @@ extern GtkWidget *packet_list, *byte_nb_ptr, *tree_view;
static guint32 firstsec, firstusec;
static guint32 prevsec, prevusec;
static void read_packet(capture_file *cf, int offset);
static void read_packet(capture_file *cf, long offset);
static void rescan_packets(capture_file *cf, const char *action,
gboolean refilter, gboolean redissect);
@ -314,7 +314,7 @@ read_cap_file(capture_file *cf, int *err)
char *errmsg;
char errmsg_errno[1024+1];
gchar err_str[2048+1];
int data_offset;
long data_offset;
progdlg_t *progbar;
gboolean stop_flag;
int file_pos;
@ -477,7 +477,7 @@ start_tail_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
read_status_t
continue_tail_cap_file(capture_file *cf, int to_read, int *err)
{
int data_offset = 0;
long data_offset = 0;
gtk_clist_freeze(GTK_CLIST(packet_list));
@ -518,7 +518,7 @@ continue_tail_cap_file(capture_file *cf, int to_read, int *err)
read_status_t
finish_tail_cap_file(capture_file *cf, int *err)
{
int data_offset;
long data_offset;
gtk_clist_freeze(GTK_CLIST(packet_list));
@ -758,7 +758,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
}
static void
read_packet(capture_file *cf, int offset)
read_packet(capture_file *cf, long offset)
{
const struct wtap_pkthdr *phdr = wtap_phdr(cf->wth);
union wtap_pseudo_header *pseudo_header = wtap_pseudoheader(cf->wth);

View File

@ -1,6 +1,6 @@
/* Combine two dump files, either by appending or by merging by timestamp
*
* $Id: mergecap.c,v 1.4 2001/07/20 07:22:40 guy Exp $
* $Id: mergecap.c,v 1.5 2001/10/04 08:30:33 guy Exp $
*
* Written by Scott Renfro <scott@renfro.org> based on
* editcap by Richard Sharpe and Guy Harris
@ -47,7 +47,7 @@ typedef struct in_file_t {
const char *filename;
wtap *wth;
int err;
int data_offset;
long data_offset;
gboolean ok;
} in_file_t;
@ -65,7 +65,7 @@ static out_file_t out_file;
* Routine to write frame to output file
*/
static void
write_frame(u_char *user, const struct wtap_pkthdr *phdr, int offset,
write_frame(u_char *user, const struct wtap_pkthdr *phdr, long offset,
union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
wtap_dumper *pdh = (wtap_dumper*)user;

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.91 2001/09/05 05:03:47 guy Exp $
* $Id: tethereal.c,v 1.92 2001/10/04 08:30:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -133,10 +133,10 @@ typedef struct {
} cb_args_t;
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 *, long,
union wtap_pseudo_header *, const u_char *);
static void show_capture_file_io_error(const char *, int, gboolean);
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 *, long,
union wtap_pseudo_header *, const u_char *);
packet_info pi;
@ -974,7 +974,7 @@ out:
static void
fill_in_fdata(frame_data *fdata, capture_file *cf,
const struct wtap_pkthdr *phdr,
const union wtap_pseudo_header *pseudo_header, int offset)
const union wtap_pseudo_header *pseudo_header, long offset)
{
int i;
@ -1050,8 +1050,8 @@ clear_fdata(frame_data *fdata)
}
static void
wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr, int offset,
union wtap_pseudo_header *pseudo_header, const u_char *buf)
wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr,
long offset, union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
cb_args_t *args = (cb_args_t *) user;
capture_file *cf = args->cf;
@ -1147,8 +1147,8 @@ show_capture_file_io_error(const char *fname, int err, gboolean is_close)
}
static void
wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset,
union wtap_pseudo_header *pseudo_header, const u_char *buf)
wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
long offset, union wtap_pseudo_header *pseudo_header, const u_char *buf)
{
cb_args_t *args = (cb_args_t *) user;
capture_file *cf = args->cf;

View File

@ -1,6 +1,6 @@
/* ascend.c
*
* $Id: ascend.c,v 1.24 2001/07/13 00:55:57 guy Exp $
* $Id: ascend.c,v 1.25 2001/10/04 08:30:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -99,8 +99,8 @@ static const char ascend_w2magic[] = { 'W', 'D', '_', 'D', 'I', 'A', 'L', 'O', '
#define ASCEND_W1_SIZE (sizeof ascend_w1magic / sizeof ascend_w1magic[0])
#define ASCEND_W2_SIZE (sizeof ascend_w2magic / sizeof ascend_w2magic[0])
static gboolean ascend_read(wtap *wth, int *err, int *data_offset);
static int ascend_seek_read (wtap *wth, int seek_off,
static gboolean ascend_read(wtap *wth, int *err, long *data_offset);
static int ascend_seek_read (wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
static void ascend_close(wtap *wth);
@ -113,9 +113,10 @@ static void ascend_close(wtap *wth);
at which the seek pointer should be set before this routine is called
to find the packet *after* the packet it finds. */
/* XXX - Handle I/O errors. */
static int ascend_seek(wtap *wth, int max_seek)
static long ascend_seek(wtap *wth, int max_seek)
{
int byte, bytes_read = 0, date_off = -1, cur_off, packet_off;
int byte, bytes_read = 0;
long date_off = -1, cur_off, packet_off;
unsigned int r_level = 0, x_level = 0, w1_level = 0, w2_level = 0;
while (((byte = file_getc(wth->fh)) != EOF) && bytes_read < max_seek) {
@ -201,7 +202,7 @@ found:
/* XXX - return -1 on I/O error and actually do something with 'err'. */
int ascend_open(wtap *wth, int *err)
{
int offset;
long offset;
struct stat statbuf;
/* We haven't yet allocated a data structure for our private stuff;
@ -243,9 +244,9 @@ int ascend_open(wtap *wth, int *err)
}
/* Read the next packet; called from wtap_loop(). */
static gboolean ascend_read(wtap *wth, int *err, int *data_offset)
static gboolean ascend_read(wtap *wth, int *err, long *data_offset)
{
int offset;
long offset;
guint8 *buf = buffer_start_ptr(wth->frame_buffer);
ascend_pkthdr header;
@ -296,7 +297,7 @@ static gboolean ascend_read(wtap *wth, int *err, int *data_offset)
return TRUE;
}
static int ascend_seek_read (wtap *wth, int seek_off,
static int ascend_seek_read (wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
file_seek(wth->random_fh, seek_off, SEEK_SET);

View File

@ -1,6 +1,6 @@
/* csids.c
*
* $Id: csids.c,v 1.7 2001/07/13 00:55:58 guy Exp $
* $Id: csids.c,v 1.8 2001/10/04 08:30:35 guy Exp $
*
* Copyright (c) 2000 by Mike Hall <mlh@io.com>
* Copyright (c) 2000 by Cisco Systems
@ -44,8 +44,8 @@
*
*/
static gboolean csids_read(wtap *wth, int *err, int *data_offset);
static int csids_seek_read(wtap *wth, int seek_off,
static gboolean csids_read(wtap *wth, int *err, long *data_offset);
static int csids_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
struct csids_header {
@ -138,7 +138,7 @@ int csids_open(wtap *wth, int *err)
}
/* Find the next packet and parse it; called from wtap_loop(). */
static gboolean csids_read(wtap *wth, int *err, int *data_offset)
static gboolean csids_read(wtap *wth, int *err, long *data_offset)
{
guint8 *buf;
int bytesRead = 0;
@ -194,7 +194,7 @@ static gboolean csids_read(wtap *wth, int *err, int *data_offset)
/* Used to read packets in random-access fashion */
static int
csids_seek_read (wtap *wth,
int seek_off,
long seek_off,
union wtap_pseudo_header *pseudo_header,
guint8 *pd,
int len)

View File

@ -2,7 +2,7 @@
* Routines for opening etherpeek files
* Copyright (c) 2001, Daniel Thompson <d.thompson@gmx.net>
*
* $Id: etherpeek.c,v 1.4 2001/07/13 00:55:58 guy Exp $
* $Id: etherpeek.c,v 1.5 2001/10/04 08:30:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -112,8 +112,8 @@ static const etherpeek_encap_lookup_t etherpeek_encap[] = {
#define NUM_ETHERPEEK_ENCAPS \
(sizeof (etherpeek_encap) / sizeof (etherpeek_encap[0]))
static gboolean etherpeek_read_m7(wtap *wth, int *err, int *data_offset);
static gboolean etherpeek_read_m56(wtap *wth, int *err, int *data_offset);
static gboolean etherpeek_read_m7(wtap *wth, int *err, long *data_offset);
static gboolean etherpeek_read_m56(wtap *wth, int *err, long *data_offset);
int etherpeek_open(wtap *wth, int *err)
{
@ -206,7 +206,7 @@ int etherpeek_open(wtap *wth, int *err)
return 1;
}
static gboolean etherpeek_read_m7(wtap *wth, int *err, int *data_offset)
static gboolean etherpeek_read_m7(wtap *wth, int *err, long *data_offset)
{
etherpeek_m7_packet_t ep_pkt;
double t;
@ -262,7 +262,7 @@ static gboolean etherpeek_read_m7(wtap *wth, int *err, int *data_offset)
return TRUE;
}
static gboolean etherpeek_read_m56(wtap *wth, int *err, int *data_offset)
static gboolean etherpeek_read_m56(wtap *wth, int *err, long *data_offset)
{
etherpeek_m56_packet_t ep_pkt;
unsigned int i;

View File

@ -1,6 +1,6 @@
/* file.c
*
* $Id: file.c,v 1.67 2001/07/13 00:55:58 guy Exp $
* $Id: file.c,v 1.68 2001/10/04 08:30:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -111,7 +111,7 @@ static int (*open_routines[])(wtap *, int *) = {
#define N_FILE_TYPES (sizeof open_routines / sizeof open_routines[0])
int wtap_def_seek_read(wtap *wth, int seek_off,
int wtap_def_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
file_seek(wth->random_fh, seek_off, SEEK_SET);

View File

@ -1,6 +1,6 @@
/* i4btrace.c
*
* $Id: i4btrace.c,v 1.14 2001/03/10 06:33:57 guy Exp $
* $Id: i4btrace.c,v 1.15 2001/10/04 08:30:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@ -32,8 +32,8 @@
#include "buffer.h"
#include "i4b_trace.h"
static gboolean i4btrace_read(wtap *wth, int *err, int *data_offset);
static int i4btrace_seek_read(wtap *wth, int seek_off,
static gboolean i4btrace_read(wtap *wth, int *err, long *data_offset);
static int i4btrace_seek_read(wtap *wth, long seek_off,
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);
@ -112,7 +112,7 @@ int i4btrace_open(wtap *wth, int *err)
#define V120SABME "\010\001\177"
/* Read the next packet */
static gboolean i4btrace_read(wtap *wth, int *err, int *data_offset)
static gboolean i4btrace_read(wtap *wth, int *err, long *data_offset)
{
int ret;
i4b_trace_hdr_t hdr;
@ -219,7 +219,7 @@ static gboolean i4btrace_read(wtap *wth, int *err, int *data_offset)
}
static int
i4btrace_seek_read(wtap *wth, int seek_off,
i4btrace_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;

View File

@ -1,6 +1,6 @@
/* iptrace.c
*
* $Id: iptrace.c,v 1.33 2001/03/10 06:33:57 guy Exp $
* $Id: iptrace.c,v 1.34 2001/10/04 08:30:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -31,12 +31,12 @@
#include "buffer.h"
#include "iptrace.h"
static gboolean iptrace_read_1_0(wtap *wth, int *err, int *data_offset);
static int iptrace_seek_read_1_0(wtap *wth, int seek_off,
static gboolean iptrace_read_1_0(wtap *wth, int *err, long *data_offset);
static int iptrace_seek_read_1_0(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size);
static gboolean iptrace_read_2_0(wtap *wth, int *err, int *data_offset);
static int iptrace_seek_read_2_0(wtap *wth, int seek_off,
static gboolean iptrace_read_2_0(wtap *wth, int *err, long *data_offset);
static int iptrace_seek_read_2_0(wtap *wth, long seek_off,
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,
@ -96,7 +96,7 @@ typedef struct {
} iptrace_1_0_phdr;
/* Read the next packet */
static gboolean iptrace_read_1_0(wtap *wth, int *err, int *data_offset)
static gboolean iptrace_read_1_0(wtap *wth, int *err, long *data_offset)
{
int ret;
guint32 packet_size;
@ -161,7 +161,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, int *data_offset)
return TRUE;
}
static int iptrace_seek_read_1_0(wtap *wth, int seek_off,
static int iptrace_seek_read_1_0(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size)
{
int ret;
@ -204,7 +204,7 @@ typedef struct {
} iptrace_2_0_phdr;
/* Read the next packet */
static gboolean iptrace_read_2_0(wtap *wth, int *err, int *data_offset)
static gboolean iptrace_read_2_0(wtap *wth, int *err, long *data_offset)
{
int ret;
guint32 packet_size;
@ -273,7 +273,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, int *data_offset)
return TRUE;
}
static int iptrace_seek_read_2_0(wtap *wth, int seek_off,
static int iptrace_seek_read_2_0(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size)
{
int ret;

View File

@ -1,6 +1,6 @@
/* lanalyzer.c
*
* $Id: lanalyzer.c,v 1.28 2001/04/16 22:06:34 guy Exp $
* $Id: lanalyzer.c,v 1.29 2001/10/04 08:30:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -47,7 +47,7 @@
#define BOARD_325 226 /* LANalyzer 325 (Ethernet) */
#define BOARD_325TR 227 /* LANalyzer 325TR (Token-ring) */
static gboolean lanalyzer_read(wtap *wth, int *err, int *data_offset);
static gboolean lanalyzer_read(wtap *wth, int *err, long *data_offset);
static void lanalyzer_close(wtap *wth);
int lanalyzer_open(wtap *wth, int *err)
@ -193,7 +193,7 @@ int lanalyzer_open(wtap *wth, int *err)
#define DESCRIPTOR_LEN 32
/* Read the next packet */
static gboolean lanalyzer_read(wtap *wth, int *err, int *data_offset)
static gboolean lanalyzer_read(wtap *wth, int *err, long *data_offset)
{
int packet_size = 0;
int bytes_read;

View File

@ -1,6 +1,6 @@
/* libpcap.c
*
* $Id: libpcap.c,v 1.50 2001/08/25 03:18:48 guy Exp $
* $Id: libpcap.c,v 1.51 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -47,7 +47,7 @@ typedef enum {
} libpcap_try_t;
static libpcap_try_t libpcap_try(wtap *wth, int *err);
static gboolean libpcap_read(wtap *wth, int *err, int *data_offset);
static gboolean libpcap_read(wtap *wth, int *err, long *data_offset);
static int libpcap_read_header(wtap *wth, int *err,
struct pcaprec_ss990915_hdr *hdr, gboolean silent);
static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr);
@ -705,7 +705,7 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err)
}
/* Read the next packet */
static gboolean libpcap_read(wtap *wth, int *err, int *data_offset)
static gboolean libpcap_read(wtap *wth, int *err, long *data_offset)
{
struct pcaprec_ss990915_hdr hdr;
guint packet_size;

View File

@ -1,6 +1,6 @@
/* netmon.c
*
* $Id: netmon.c,v 1.40 2001/08/25 03:18:48 guy Exp $
* $Id: netmon.c,v 1.41 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -93,7 +93,7 @@ struct netmonrec_2_x_hdr {
guint32 incl_len; /* number of octets captured in file */
};
static gboolean netmon_read(wtap *wth, int *err, int *data_offset);
static gboolean netmon_read(wtap *wth, int *err, long *data_offset);
static void netmon_close(wtap *wth);
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
@ -276,7 +276,7 @@ int netmon_open(wtap *wth, int *err)
}
/* Read the next packet */
static gboolean netmon_read(wtap *wth, int *err, int *data_offset)
static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
{
netmon_t *netmon = wth->capture.netmon;
guint32 packet_size = 0;

View File

@ -1,6 +1,6 @@
/* nettl.c
*
* $Id: nettl.c,v 1.19 2001/03/10 06:33:57 guy Exp $
* $Id: nettl.c,v 1.20 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -66,8 +66,8 @@ struct nettlrec_ns_ls_ip_hdr {
/* header is followed by data and once again the total length (2 bytes) ! */
static gboolean nettl_read(wtap *wth, int *err, int *data_offset);
static int nettl_seek_read(wtap *wth, int seek_off,
static gboolean nettl_read(wtap *wth, int *err, long *data_offset);
static int nettl_seek_read(wtap *wth, long seek_off,
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 wtap_pseudo_header *pseudo_header,
@ -124,7 +124,7 @@ int nettl_open(wtap *wth, int *err)
}
/* Read the next packet */
static gboolean nettl_read(wtap *wth, int *err, int *data_offset)
static gboolean nettl_read(wtap *wth, int *err, long *data_offset)
{
int ret;
@ -150,7 +150,7 @@ static gboolean nettl_read(wtap *wth, int *err, int *data_offset)
}
static int
nettl_seek_read(wtap *wth, int seek_off,
nettl_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;

View File

@ -1,6 +1,6 @@
/* netxray.c
*
* $Id: netxray.c,v 1.40 2001/08/25 03:18:48 guy Exp $
* $Id: netxray.c,v 1.41 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -101,7 +101,7 @@ struct netxrayrec_2_x_hdr {
guint32 xxx[7]; /* unknown */
};
static gboolean netxray_read(wtap *wth, int *err, int *data_offset);
static gboolean netxray_read(wtap *wth, int *err, long *data_offset);
static void netxray_close(wtap *wth);
static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err);
@ -231,7 +231,7 @@ int netxray_open(wtap *wth, int *err)
}
/* Read the next packet */
static gboolean netxray_read(wtap *wth, int *err, int *data_offset)
static gboolean netxray_read(wtap *wth, int *err, long *data_offset)
{
guint32 packet_size;
int bytes_read;

View File

@ -1,6 +1,6 @@
/* ngsniffer.c
*
* $Id: ngsniffer.c,v 1.66 2001/08/25 03:18:48 guy Exp $
* $Id: ngsniffer.c,v 1.67 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -285,8 +285,8 @@ struct frame6_rec {
static double Usec[] = { 15.0, 0.838096, 15.0, 0.5, 2.0, 1.0, 0.1 };
static int skip_header_records(wtap *wth, int *err, gint16 version);
static gboolean ngsniffer_read(wtap *wth, int *err, int *data_offset);
static int ngsniffer_seek_read(wtap *wth, int seek_off,
static gboolean ngsniffer_read(wtap *wth, int *err, long *data_offset);
static int ngsniffer_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size);
static int ngsniffer_read_rec_header(wtap *wth, gboolean is_random,
guint16 *typep, guint16 *lengthp, int *err);
@ -645,7 +645,7 @@ skip_header_records(wtap *wth, int *err, gint16 version)
}
/* Read the next packet */
static gboolean ngsniffer_read(wtap *wth, int *err, int *data_offset)
static gboolean ngsniffer_read(wtap *wth, int *err, long *data_offset)
{
int ret;
guint16 type, length;
@ -858,7 +858,7 @@ found:
return TRUE;
}
static int ngsniffer_seek_read(wtap *wth, int seek_off,
static int ngsniffer_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size)
{
int ret;

View File

@ -1,6 +1,6 @@
/* pppdump.c
*
* $Id: pppdump.c,v 1.8 2001/03/10 06:33:58 guy Exp $
* $Id: pppdump.c,v 1.9 2001/10/04 08:30:36 guy Exp $
*
* Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org>
*
@ -93,8 +93,8 @@ typedef enum {
DIRECTION_RECV
} direction_enum;
static gboolean pppdump_read(wtap *wth, int *err, int *data_offset);
static int pppdump_seek_read(wtap *wth, int seek_off,
static gboolean pppdump_read(wtap *wth, int *err, long *data_offset);
static int pppdump_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
typedef struct {
@ -222,7 +222,7 @@ pppdump_open(wtap *wth, int *err)
/* Find the next packet and parse it; called from wtap_loop(). */
static gboolean
pppdump_read(wtap *wth, int *err, int *data_offset)
pppdump_read(wtap *wth, int *err, long *data_offset)
{
gboolean retval;
int num_bytes;
@ -517,7 +517,7 @@ collate(pppdump_t* state, FILE_T fh, int *err, guint8 *pd, int *num_bytes,
/* Used to read packets in random-access fashion */
static int
pppdump_seek_read (wtap *wth,
int seek_off,
long seek_off,
union wtap_pseudo_header *pseudo_header,
guint8 *pd,
int len)

View File

@ -1,6 +1,6 @@
/* radcom.c
*
* $Id: radcom.c,v 1.29 2001/03/10 06:33:58 guy Exp $
* $Id: radcom.c,v 1.30 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -67,8 +67,8 @@ struct radcomrec_hdr {
char xxw[9]; /* unknown */
};
static gboolean radcom_read(wtap *wth, int *err, int *data_offset);
static int radcom_seek_read(wtap *wth, int seek_off,
static gboolean radcom_read(wtap *wth, int *err, long *data_offset);
static int radcom_seek_read(wtap *wth, long seek_off,
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);
@ -219,7 +219,7 @@ read_error:
}
/* Read the next packet */
static gboolean radcom_read(wtap *wth, int *err, int *data_offset)
static gboolean radcom_read(wtap *wth, int *err, long *data_offset)
{
int ret;
struct radcomrec_hdr hdr;
@ -287,7 +287,7 @@ static gboolean radcom_read(wtap *wth, int *err, int *data_offset)
}
static int
radcom_seek_read(wtap *wth, int seek_off,
radcom_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;

View File

@ -1,6 +1,6 @@
/* snoop.c
*
* $Id: snoop.c,v 1.36 2001/08/25 03:18:48 guy Exp $
* $Id: snoop.c,v 1.37 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -56,8 +56,8 @@ struct snooprec_hdr {
guint32 ts_usec; /* timestamp microseconds */
};
static gboolean snoop_read(wtap *wth, int *err, int *data_offset);
static int snoop_seek_read(wtap *wth, int seek_off,
static gboolean snoop_read(wtap *wth, int *err, long *data_offset);
static int snoop_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length);
static int snoop_read_atm_pseudoheader(FILE_T fh,
union wtap_pseudo_header *pseudo_header, int *err);
@ -294,7 +294,7 @@ int snoop_open(wtap *wth, int *err)
}
/* Read the next packet */
static gboolean snoop_read(wtap *wth, int *err, int *data_offset)
static gboolean snoop_read(wtap *wth, int *err, long *data_offset)
{
guint32 rec_size;
guint32 packet_size;
@ -403,7 +403,7 @@ static gboolean snoop_read(wtap *wth, int *err, int *data_offset)
}
static int
snoop_seek_read(wtap *wth, int seek_off,
snoop_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length)
{
int ret;

View File

@ -1,6 +1,6 @@
/* toshiba.c
*
* $Id: toshiba.c,v 1.15 2001/03/10 06:33:58 guy Exp $
* $Id: toshiba.c,v 1.16 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -104,8 +104,8 @@ static const char toshiba_hdr_magic[] =
static const char toshiba_rec_magic[] = { '[', 'N', 'o', '.' };
#define TOSHIBA_REC_MAGIC_SIZE (sizeof toshiba_rec_magic / sizeof toshiba_rec_magic[0])
static gboolean toshiba_read(wtap *wth, int *err, int *data_offset);
static int toshiba_seek_read(wtap *wth, int seek_off,
static gboolean toshiba_read(wtap *wth, int *err, long *data_offset);
static int toshiba_seek_read(wtap *wth, long 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);
@ -115,7 +115,7 @@ static int parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
/* Seeks to the beginning of the next packet, and returns the
byte offset. Returns -1 on failure. */
/* XXX - Handle I/O errors. */
static int toshiba_seek_next_packet(wtap *wth)
static long toshiba_seek_next_packet(wtap *wth)
{
int byte;
int level = 0;
@ -198,9 +198,9 @@ int toshiba_open(wtap *wth, int *err)
}
/* Find the next packet and parse it; called from wtap_loop(). */
static gboolean toshiba_read(wtap *wth, int *err, int *data_offset)
static gboolean toshiba_read(wtap *wth, int *err, long *data_offset)
{
int offset = 0;
long offset;
guint8 *buf;
int pkt_len;
@ -229,8 +229,8 @@ static gboolean toshiba_read(wtap *wth, int *err, int *data_offset)
/* Used to read packets in random-access fashion */
static int
toshiba_seek_read (wtap *wth, int seek_off, union wtap_pseudo_header *pseudo_header,
guint8 *pd, int len)
toshiba_seek_read (wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
int pkt_len;
int err;

View File

@ -1,6 +1,6 @@
/* wtap-int.h
*
* $Id: wtap-int.h,v 1.13 2001/08/25 03:18:48 guy Exp $
* $Id: wtap-int.h,v 1.14 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -109,15 +109,15 @@ typedef struct {
typedef struct {
time_t inittime;
int adjusted;
int next_packet_seek_start;
long next_packet_seek_start;
} ascend_t;
typedef struct {
gboolean byteswapped;
} csids_t;
typedef int (*subtype_read_func)(struct wtap*, int*, int*);
typedef int (*subtype_seek_read_func)(struct wtap*, int, union wtap_pseudo_header*,
typedef int (*subtype_read_func)(struct wtap*, int*, long*);
typedef int (*subtype_seek_read_func)(struct wtap*, long, union wtap_pseudo_header*,
guint8*, int);
struct wtap {
FILE_T fh;

View File

@ -1,6 +1,6 @@
/* wtap.c
*
* $Id: wtap.c,v 1.54 2001/07/13 00:55:58 guy Exp $
* $Id: wtap.c,v 1.55 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -247,7 +247,7 @@ wtap_close(wtap *wth)
}
gboolean
wtap_read(wtap *wth, int *err, int *data_offset)
wtap_read(wtap *wth, int *err, long *data_offset)
{
return wth->subtype_read(wth, err, data_offset);
}
@ -273,7 +273,8 @@ wtap_buf_ptr(wtap *wth)
gboolean
wtap_loop(wtap *wth, int count, wtap_handler callback, u_char* user, int *err)
{
int data_offset, loop = 0;
long data_offset;
int loop = 0;
/* Start by clearing error flag */
*err = 0;
@ -292,7 +293,7 @@ wtap_loop(wtap *wth, int count, wtap_handler callback, u_char* user, int *err)
}
int
wtap_seek_read(wtap *wth, int seek_off,
wtap_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
return wth->subtype_seek_read(wth, seek_off, pseudo_header, pd, len);

View File

@ -1,6 +1,6 @@
/* wtap.h
*
* $Id: wtap.h,v 1.88 2001/09/23 21:55:21 guy Exp $
* $Id: wtap.h,v 1.89 2001/10/04 08:30:36 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@ -270,7 +270,7 @@ struct wtap_pkthdr {
};
typedef void (*wtap_handler)(u_char*, const struct wtap_pkthdr*,
int, union wtap_pseudo_header *pseudo_header, const u_char *);
long, union wtap_pseudo_header *pseudo_header, const u_char *);
struct wtap;
struct Buffer;
@ -296,7 +296,7 @@ gboolean wtap_loop(wtap *wth, int, wtap_handler, u_char*, int *err);
/* Returns TRUE if read was successful. FALSE if failure. data_offset is
* set the the offset in the file where the data for the read packet is
* located. */
gboolean wtap_read(wtap *wth, int *err, int *data_offset);
gboolean wtap_read(wtap *wth, int *err, long *data_offset);
struct wtap_pkthdr *wtap_phdr(wtap *wth);
union wtap_pseudo_header *wtap_pseudoheader(wtap *wth);
@ -318,9 +318,9 @@ int wtap_short_string_to_encap(const char *short_name);
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,
int wtap_seek_read (wtap *wth, long seek_off,
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, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
gboolean wtap_dump_can_open(int filetype);