forked from osmocom/wireshark
change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds! svn path=/trunk/; revision=19814daniel/osmux
parent
ed837bc7a5
commit
59d6c8ea33
|
@ -118,7 +118,7 @@ process_cap_file(wtap *wth, const char *filename)
|
|||
int err;
|
||||
gchar *err_info;
|
||||
gint64 size;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
|
||||
guint32 packet = 0;
|
||||
gint64 bytes = 0;
|
||||
|
|
|
@ -224,7 +224,7 @@ void capture_info_new_packets(int to_read)
|
|||
{
|
||||
int err;
|
||||
gchar *err_info;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
const struct wtap_pkthdr *phdr;
|
||||
union wtap_pseudo_header *pseudo_header;
|
||||
int wtap_linktype;
|
||||
|
|
2
cfile.h
2
cfile.h
|
@ -46,7 +46,7 @@ typedef struct _capture_file {
|
|||
gchar *filename; /* Name of capture file */
|
||||
gboolean is_tempfile; /* Is capture file a temporary file? */
|
||||
gboolean user_saved;/* If capture file is temporary, has it been saved by user yet? */
|
||||
long f_datalen; /* Size of capture file data (uncompressed) */
|
||||
gint64 f_datalen; /* Size of capture file data (uncompressed) */
|
||||
guint16 cd_t; /* File type of capture file */
|
||||
int lnk_t; /* Link-layer type with which to save capture */
|
||||
guint32 vers; /* Version. For tcpdump minor is appended to major */
|
||||
|
|
|
@ -19,6 +19,7 @@ VERSION_EXTRA=
|
|||
# The version of the wiretap library (recommended: leave unchanged)
|
||||
WTAP_VERSION_MAJOR=0
|
||||
WTAP_VERSION_MINOR=3
|
||||
WTAP_VERSION_MICRO=1
|
||||
|
||||
|
||||
|
||||
|
@ -394,8 +395,8 @@ LINK_PLUGINS_WITH_LIBWIRESHARK=USE
|
|||
VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)$(VERSION_EXTRA)
|
||||
RC_VERSION=$(VERSION_MAJOR),$(VERSION_MINOR),$(VERSION_MICRO)
|
||||
|
||||
WTAP_VERSION=$(WTAP_VERSION_MAJOR).$(WTAP_VERSION_MINOR)
|
||||
RC_WTAP_VERSION=$(WTAP_VERSION_MAJOR),$(WTAP_VERSION_MINOR)
|
||||
WTAP_VERSION=$(WTAP_VERSION_MAJOR).$(WTAP_VERSION_MINOR).$(WTAP_VERSION_MICRO)
|
||||
RC_WTAP_VERSION=$(WTAP_VERSION_MAJOR),$(WTAP_VERSION_MINOR),$(WTAP_VERSION_MICRO)
|
||||
|
||||
|
||||
GLIB_CFLAGS=/I$(GLIB_DIR)\include\glib-$(GLIB_VERSION) \
|
||||
|
|
|
@ -355,7 +355,7 @@ int main(int argc, char *argv[])
|
|||
unsigned int choplen = 0; /* No chop */
|
||||
wtap_dumper *pdh;
|
||||
int count = 1;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
struct wtap_pkthdr snap_phdr;
|
||||
const struct wtap_pkthdr *phdr;
|
||||
int err_type;
|
||||
|
|
|
@ -252,9 +252,9 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
|
|||
}
|
||||
|
||||
if (show_file_off) {
|
||||
proto_tree_add_int_format(fh_tree, hf_frame_file_off, tvb,
|
||||
proto_tree_add_int64_format(fh_tree, hf_frame_file_off, tvb,
|
||||
0, 0, pinfo->fd->file_off,
|
||||
"File Offset: %ld (0x%lx)",
|
||||
"File Offset: %lld (0x%llx)",
|
||||
pinfo->fd->file_off, pinfo->fd->file_off);
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ proto_register_frame(void)
|
|||
"", HFILL }},
|
||||
|
||||
{ &hf_frame_file_off,
|
||||
{ "File Offset", "frame.file_off", FT_INT32, BASE_DEC, NULL, 0x0,
|
||||
{ "File Offset", "frame.file_off", FT_INT64, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_frame_marked,
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct _frame_data {
|
|||
nstime_t abs_ts; /* Absolute timestamp */
|
||||
nstime_t rel_ts; /* Relative timestamp (yes, it can be negative) */
|
||||
nstime_t del_ts; /* Delta timestamp (yes, it can be negative) */
|
||||
long file_off; /* File offset */
|
||||
gint64 file_off; /* File offset */
|
||||
int lnk_t; /* Per-packet encapsulation/data-link type */
|
||||
struct {
|
||||
unsigned int passed_dfilter : 1; /* 1 = display, 0 = no display */
|
||||
|
|
12
file.c
12
file.c
|
@ -87,7 +87,7 @@ static guint32 cum_bytes = 0;
|
|||
|
||||
static void cf_reset_state(capture_file *cf);
|
||||
|
||||
static int read_packet(capture_file *cf, long offset);
|
||||
static int read_packet(capture_file *cf, gint64 offset);
|
||||
|
||||
static void rescan_packets(capture_file *cf, const char *action, const char *action_item,
|
||||
gboolean refilter, gboolean redissect);
|
||||
|
@ -366,7 +366,7 @@ cf_read(capture_file *cf)
|
|||
const char *errmsg;
|
||||
char errmsg_errno[1024+1];
|
||||
gchar err_str[2048+1];
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
progdlg_t *progbar = NULL;
|
||||
gboolean stop_flag;
|
||||
gint64 size, file_pos;
|
||||
|
@ -560,7 +560,7 @@ cf_start_tail(capture_file *cf, const char *fname, gboolean is_tempfile, int *er
|
|||
cf_read_status_t
|
||||
cf_continue_tail(capture_file *cf, int to_read, int *err)
|
||||
{
|
||||
long data_offset = 0;
|
||||
gint64 data_offset = 0;
|
||||
gchar *err_info;
|
||||
int newly_displayed_packets = 0;
|
||||
|
||||
|
@ -620,7 +620,7 @@ cf_read_status_t
|
|||
cf_finish_tail(capture_file *cf, int *err)
|
||||
{
|
||||
gchar *err_info;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
|
||||
if(cf->wth == NULL) {
|
||||
cf_close(cf);
|
||||
|
@ -910,7 +910,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
|||
/* read in a new packet */
|
||||
/* returns the row of the new packet in the packet list or -1 if not displayed */
|
||||
static int
|
||||
read_packet(capture_file *cf, long offset)
|
||||
read_packet(capture_file *cf, gint64 offset)
|
||||
{
|
||||
const struct wtap_pkthdr *phdr = wtap_phdr(cf->wth);
|
||||
union wtap_pseudo_header *pseudo_header = wtap_pseudoheader(cf->wth);
|
||||
|
@ -994,7 +994,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
gchar err_str[2048+1];
|
||||
const char *errmsg;
|
||||
gboolean got_read_error = FALSE, got_write_error = FALSE;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
progdlg_t *progbar = NULL;
|
||||
gboolean stop_flag;
|
||||
gint64 f_len, file_pos;
|
||||
|
|
|
@ -200,7 +200,7 @@ preview_do(GtkWidget *prev, wtap *wth)
|
|||
time_t time_current;
|
||||
int err = 0;
|
||||
gchar *err_info;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
const struct wtap_pkthdr *phdr;
|
||||
double start_time = 0; /* seconds, with nsec resolution */
|
||||
double stop_time = 0; /* seconds, with nsec resolution */
|
||||
|
|
|
@ -110,7 +110,7 @@ gsm_map_stat_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* length */
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "Length: %lu", summary.file_length);
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "Length: %lld", summary.file_length);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* format */
|
||||
|
|
18
gtk/main.c
18
gtk/main.c
|
@ -1401,11 +1401,11 @@ set_display_filename(capture_file *cf)
|
|||
|
||||
/* convert file size */
|
||||
if (cf->f_datalen/1024/1024 > 10) {
|
||||
size_str = g_strdup_printf("%ld MB", cf->f_datalen/1024/1024);
|
||||
size_str = g_strdup_printf("%lld MB", cf->f_datalen/1024/1024);
|
||||
} else if (cf->f_datalen/1024 > 10) {
|
||||
size_str = g_strdup_printf("%ld KB", cf->f_datalen/1024);
|
||||
size_str = g_strdup_printf("%lld KB", cf->f_datalen/1024);
|
||||
} else {
|
||||
size_str = g_strdup_printf("%ld Bytes", cf->f_datalen);
|
||||
size_str = g_strdup_printf("%lld Bytes", cf->f_datalen);
|
||||
}
|
||||
|
||||
/* statusbar */
|
||||
|
@ -1657,19 +1657,19 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
|
|||
#if 0
|
||||
/* XXX - don't show the highest expert level unless the TCP checksum offloading is "solved" */
|
||||
if (cf->f_datalen/1024/1024 > 10) {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld MB [Expert: %s]",
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld MB [Expert: %s]",
|
||||
get_interface_descriptive_name(capture_opts->iface),
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen/1024/1024,
|
||||
val_to_str(expert_get_highest_severity(), expert_severity_vals, "Unknown (%u)"));
|
||||
} else if (cf->f_datalen/1024 > 10) {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld KB [Expert: %s]",
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld KB [Expert: %s]",
|
||||
get_interface_descriptive_name(capture_opts->iface),
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen/1024,
|
||||
val_to_str(expert_get_highest_severity(), expert_severity_vals, "Unknown (%u)"));
|
||||
} else {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld Bytes [Expert: %s]",
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld Bytes [Expert: %s]",
|
||||
get_interface_descriptive_name(capture_opts->iface),
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen,
|
||||
|
@ -1677,17 +1677,17 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
|
|||
}
|
||||
#endif
|
||||
if (cf->f_datalen/1024/1024 > 10) {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld MB",
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld MB",
|
||||
get_interface_descriptive_name(capture_opts->iface),
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen/1024/1024);
|
||||
} else if (cf->f_datalen/1024 > 10) {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld KB",
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld KB",
|
||||
get_interface_descriptive_name(capture_opts->iface),
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen/1024);
|
||||
} else {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld Bytes",
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld Bytes",
|
||||
get_interface_descriptive_name(capture_opts->iface),
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen);
|
||||
|
|
|
@ -276,7 +276,7 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* length */
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "Length: %lu", summary.file_length);
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "Length: %lld", summary.file_length);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* format */
|
||||
|
|
|
@ -144,7 +144,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
add_string_to_table(table, &row, "Name:", string_buff);
|
||||
|
||||
/* length */
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "%lu bytes", summary.file_length);
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "%lld bytes", summary.file_length);
|
||||
add_string_to_table(table, &row, "Length:", string_buff);
|
||||
|
||||
/* format */
|
||||
|
|
|
@ -770,7 +770,7 @@ preview_set_filename(HWND of_hwnd, gchar *preview_file) {
|
|||
int err = 0;
|
||||
gchar *err_info;
|
||||
TCHAR string_buff[PREVIEW_STR_MAX];
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
guint packet = 0;
|
||||
guint64 filesize;
|
||||
time_t ti_time;
|
||||
|
|
2
merge.h
2
merge.h
|
@ -42,7 +42,7 @@ typedef enum {
|
|||
typedef struct merge_in_file_s {
|
||||
const char *filename;
|
||||
wtap *wth;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
in_file_state_e state;
|
||||
gint64 size; /* file size */
|
||||
} merge_in_file_t;
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct _summary_tally {
|
|||
double filtered_start; /* time in seconds, with msec resolution */
|
||||
double filtered_stop; /* time in seconds, with msec resolution */
|
||||
const char *filename;
|
||||
long file_length; /* file length in bytes */
|
||||
gint64 file_length; /* file length in bytes */
|
||||
int encap_type; /* wiretap encapsulation type */
|
||||
gboolean has_snap; /* TRUE if maximum capture packet length is known */
|
||||
int snap; /* Maximum captured packet length */
|
||||
|
|
8
tshark.c
8
tshark.c
|
@ -178,7 +178,7 @@ static void report_counts_siginfo(int);
|
|||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
static int load_cap_file(capture_file *, char *, int);
|
||||
static gboolean process_packet(capture_file *cf, long offset,
|
||||
static gboolean process_packet(capture_file *cf, gint64 offset,
|
||||
const struct wtap_pkthdr *whdr, union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd);
|
||||
static void show_capture_file_io_error(const char *, int, gboolean);
|
||||
|
@ -2048,7 +2048,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type)
|
|||
wtap_dumper *pdh;
|
||||
int err;
|
||||
gchar *err_info;
|
||||
long data_offset;
|
||||
gint64 data_offset;
|
||||
char *save_file_string = NULL;
|
||||
|
||||
linktype = wtap_file_encap(cf->wth);
|
||||
|
@ -2185,7 +2185,7 @@ out:
|
|||
|
||||
static void
|
||||
fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||
const struct wtap_pkthdr *phdr, long offset)
|
||||
const struct wtap_pkthdr *phdr, gint64 offset)
|
||||
{
|
||||
fdata->next = NULL;
|
||||
fdata->prev = NULL;
|
||||
|
@ -2246,7 +2246,7 @@ clear_fdata(frame_data *fdata)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
process_packet(capture_file *cf, long offset, const struct wtap_pkthdr *whdr,
|
||||
process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
|
||||
union wtap_pseudo_header *pseudo_header, const guchar *pd)
|
||||
{
|
||||
frame_data fdata;
|
||||
|
|
|
@ -104,12 +104,12 @@ typedef struct
|
|||
#define CST_5VW_SYSTEM_RECORD 0x00000000
|
||||
|
||||
static gboolean _5views_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
gint64 *data_offset);
|
||||
static gboolean _5views_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
int *err);
|
||||
static int _5views_read_header(wtap *wth, FILE_T fh,
|
||||
t_5VW_TimeStamped_Header *hdr, int *err);
|
||||
static gboolean _5views_seek_read(wtap *wth, long seek_off,
|
||||
static gboolean _5views_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
|
@ -204,7 +204,7 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
|
|||
|
||||
/* Read the next packet */
|
||||
static gboolean
|
||||
_5views_read(wtap *wth, int *err, gchar **err_info _U_, long *data_offset)
|
||||
_5views_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset)
|
||||
{
|
||||
t_5VW_TimeStamped_Header TimeStamped_Header;
|
||||
int bytes_read;
|
||||
|
@ -314,7 +314,7 @@ _5views_read_header(wtap *wth _U_, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_5views_seek_read(wtap *wth, long seek_off,
|
||||
_5views_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info _U_)
|
||||
{
|
||||
|
|
|
@ -78,8 +78,8 @@ typedef struct airopeek_utime {
|
|||
} airopeek_utime;
|
||||
|
||||
static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean airopeekv9_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean airopeekv9_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void airopeekv9_close(wtap *wth);
|
||||
|
@ -475,7 +475,7 @@ airopeekv9_process_header(FILE_T fh, hdr_info_t *hdr_info, int *err,
|
|||
#define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
|
||||
|
||||
static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
hdr_info_t hdr_info;
|
||||
int hdrlen;
|
||||
|
@ -551,7 +551,7 @@ static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
|
||||
static gboolean
|
||||
airopeekv9_seek_read(wtap *wth, long seek_off,
|
||||
airopeekv9_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
|
|
|
@ -154,7 +154,7 @@ static guint32 start_time, secs, usecs, caplen, wirelen;
|
|||
static ascend_pkthdr *header;
|
||||
struct ascend_phdr *pseudo_header;
|
||||
static guint8 *pkt_data;
|
||||
static long first_hexbyte;
|
||||
static gint64 first_hexbyte;
|
||||
static FILE_T *fh_ptr;
|
||||
|
||||
%}
|
||||
|
@ -446,7 +446,7 @@ init_parse_ascend()
|
|||
if there is none. */
|
||||
int
|
||||
parse_ascend(FILE_T fh, guint8 *pd, struct ascend_phdr *phdr,
|
||||
ascend_pkthdr *hdr, long *start_of_data)
|
||||
ascend_pkthdr *hdr, gint64 *start_of_data)
|
||||
{
|
||||
/* yydebug = 1; */
|
||||
int retval;
|
||||
|
|
|
@ -49,6 +49,6 @@ int ascendlex(void);
|
|||
void init_parse_ascend(void);
|
||||
void ascend_init_lexer(FILE_T fh);
|
||||
int parse_ascend(FILE_T fh, guint8 *pd, struct ascend_phdr *phdr,
|
||||
ascend_pkthdr *hdr, long *start_of_data);
|
||||
ascend_pkthdr *hdr, gint64 *start_of_data);
|
||||
|
||||
#endif /* ! __ASCEND_INT_H__ */
|
||||
|
|
|
@ -79,8 +79,8 @@ static const ascend_magic_string ascend_magic[] = {
|
|||
};
|
||||
|
||||
static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean ascend_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_head, guint8 *pd, int len,
|
||||
int *err, gchar **err_info);
|
||||
static void ascend_close(wtap *wth);
|
||||
|
@ -88,10 +88,10 @@ static void ascend_close(wtap *wth);
|
|||
/* Seeks to the beginning of the next packet, and returns the
|
||||
byte offset at which the header for that packet begins.
|
||||
Returns -1 on failure. */
|
||||
static long ascend_seek(wtap *wth, int *err)
|
||||
static gint64 ascend_seek(wtap *wth, int *err)
|
||||
{
|
||||
int byte;
|
||||
long date_off = -1, cur_off, packet_off;
|
||||
gint64 date_off = -1, cur_off, packet_off;
|
||||
guint string_level[ASCEND_MAGIC_STRINGS];
|
||||
guint string_i = 0, type = 0;
|
||||
|
||||
|
@ -163,7 +163,7 @@ found:
|
|||
|
||||
int ascend_open(wtap *wth, int *err, gchar **err_info _U_)
|
||||
{
|
||||
long offset;
|
||||
gint64 offset;
|
||||
struct stat statbuf;
|
||||
|
||||
/* We haven't yet allocated a data structure for our private stuff;
|
||||
|
@ -247,9 +247,9 @@ static void config_pseudo_header(union wtap_pseudo_header *pseudo_head)
|
|||
|
||||
/* Read the next packet; called from wtap_read(). */
|
||||
static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
long offset;
|
||||
gint64 offset;
|
||||
guint8 *buf = buffer_start_ptr(wth->frame_buffer);
|
||||
ascend_pkthdr header;
|
||||
|
||||
|
@ -303,7 +303,7 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean ascend_seek_read(wtap *wth, long seek_off,
|
||||
static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_head, guint8 *pd, int len,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define BER_UNI_TAG_SEQ 16 /* SEQUENCE, SEQUENCE OF */
|
||||
#define BER_UNI_TAG_SET 17 /* SET, SET OF */
|
||||
|
||||
static gboolean ber_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
|
||||
static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
||||
{
|
||||
guint8 *buf;
|
||||
gint64 file_size;
|
||||
|
@ -93,7 +93,7 @@ static gboolean ber_read(wtap *wth, int *err, gchar **err_info, long *data_offse
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean ber_seek_read(wtap *wth, long seek_off, union wtap_pseudo_header *pseudo_header _U_,
|
||||
static gboolean ber_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_,
|
||||
guint8 *pd, int length, int *err, gchar **err_info _U_)
|
||||
{
|
||||
int packet_size = length;
|
||||
|
|
|
@ -112,8 +112,8 @@ static gchar outhdr_name[MAX_OUTHDR_NAME+1];
|
|||
/************************************************************/
|
||||
/* Functions called from wiretap */
|
||||
static gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean catapult_dct2000_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header,
|
||||
guchar *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
|
@ -127,7 +127,7 @@ static gboolean catapult_dct2000_dump_close(wtap_dumper *wdh, int *err);
|
|||
|
||||
/************************************************************/
|
||||
/* Private helper functions */
|
||||
static gboolean read_new_line(FILE_T fh, long *offset, gint *length);
|
||||
static gboolean read_new_line(FILE_T fh, gint64 *offset, gint *length);
|
||||
static gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
|
||||
long *before_time_offset, long *after_time_offset,
|
||||
long *data_offset,
|
||||
|
@ -141,7 +141,7 @@ static gchar char_from_hex(guchar hex);
|
|||
|
||||
static void set_pseudo_header_info(wtap *wth,
|
||||
int pkt_encap,
|
||||
long file_offset,
|
||||
gint64 file_offset,
|
||||
union wtap_pseudo_header *pseudo_header,
|
||||
packet_direction_t direction);
|
||||
static void set_aal_info(union wtap_pseudo_header *pseudo_header,
|
||||
|
@ -164,7 +164,7 @@ static gboolean free_line_prefix_info(gpointer key, gpointer value, gpointer use
|
|||
/********************************************/
|
||||
int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_)
|
||||
{
|
||||
long offset = 0;
|
||||
gint64 offset = 0;
|
||||
time_t timestamp;
|
||||
guint32 usecs;
|
||||
gint firstline_length;
|
||||
|
@ -269,9 +269,9 @@ int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
/* - return TRUE and details if found */
|
||||
/**************************************************/
|
||||
gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
long offset = wth->data_offset;
|
||||
gint64 offset = wth->data_offset;
|
||||
long dollar_offset, before_time_offset, after_time_offset;
|
||||
packet_direction_t direction;
|
||||
int encap;
|
||||
|
@ -290,7 +290,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
|
|||
while (1)
|
||||
{
|
||||
int line_length, seconds, useconds, data_chars;
|
||||
long this_offset = offset;
|
||||
gint64 this_offset = offset;
|
||||
|
||||
/* Are looking for first packet after 2nd line */
|
||||
if (wth->data_offset == 0)
|
||||
|
@ -412,11 +412,11 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
|
|||
/* Read & seek function. */
|
||||
/**************************************************/
|
||||
static gboolean
|
||||
catapult_dct2000_seek_read(wtap *wth, long seek_off,
|
||||
catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
int length, int *err, gchar **err_info)
|
||||
{
|
||||
long offset = wth->data_offset;
|
||||
gint64 offset = wth->data_offset;
|
||||
long dollar_offset, before_time_offset, after_time_offset;
|
||||
packet_direction_t direction;
|
||||
int encap;
|
||||
|
@ -476,7 +476,7 @@ catapult_dct2000_seek_read(wtap *wth, long seek_off,
|
|||
/* If get here, must have failed */
|
||||
*err = errno;
|
||||
*err_info = g_strdup_printf("catapult dct2000: seek_read failed to read/parse "
|
||||
"line at position %ld", seek_off);
|
||||
"line at position %lld", seek_off);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ static gboolean catapult_dct2000_dump_close(wtap_dumper *wdh _U_, int *err _U_)
|
|||
/* - on return 'offset' will point to the next position to read from */
|
||||
/* - return TRUE if this read is successful */
|
||||
/**********************************************************************/
|
||||
gboolean read_new_line(FILE_T fh, long *offset, gint *length)
|
||||
gboolean read_new_line(FILE_T fh, gint64 *offset, gint *length)
|
||||
{
|
||||
char *result;
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ int write_stub_header(guchar *frame_buffer, char *timestamp_string,
|
|||
/**************************************************************/
|
||||
void set_pseudo_header_info(wtap *wth,
|
||||
int pkt_encap,
|
||||
long file_offset,
|
||||
gint64 file_offset,
|
||||
union wtap_pseudo_header *pseudo_header,
|
||||
packet_direction_t direction)
|
||||
{
|
||||
|
|
|
@ -167,11 +167,11 @@
|
|||
#define COSINE_MAX_PACKET_LEN 65536
|
||||
|
||||
static gboolean empty_line(const gchar *line);
|
||||
static long cosine_seek_next_packet(wtap *wth, int *err, char *hdr);
|
||||
static gint64 cosine_seek_next_packet(wtap *wth, int *err, char *hdr);
|
||||
static gboolean cosine_check_file_type(wtap *wth, int *err);
|
||||
static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean cosine_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean cosine_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int len, int *err, gchar **err_info);
|
||||
static int parse_cosine_rec_hdr(wtap *wth, const char *line,
|
||||
|
@ -202,9 +202,9 @@ static gboolean empty_line(const gchar *line)
|
|||
/* Seeks to the beginning of the next packet, and returns the
|
||||
byte offset. Copy the header line to hdr. Returns -1 on failure,
|
||||
and sets "*err" to the error and set hdr as NULL. */
|
||||
static long cosine_seek_next_packet(wtap *wth, int *err, char *hdr)
|
||||
static gint64 cosine_seek_next_packet(wtap *wth, int *err, char *hdr)
|
||||
{
|
||||
long cur_off;
|
||||
gint64 cur_off;
|
||||
char buf[COSINE_LINE_LENGTH];
|
||||
|
||||
while (1) {
|
||||
|
@ -306,9 +306,9 @@ int cosine_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
|
||||
/* Find the next packet and parse it; called from wtap_read(). */
|
||||
static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
long offset;
|
||||
gint64 offset;
|
||||
guint8 *buf;
|
||||
int pkt_len, caplen;
|
||||
char line[COSINE_LINE_LENGTH];
|
||||
|
@ -341,7 +341,7 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
/* Used to read packets in random-access fashion */
|
||||
static gboolean
|
||||
cosine_seek_read (wtap *wth, long seek_off,
|
||||
cosine_seek_read (wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
*/
|
||||
|
||||
static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean csids_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean csids_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
|
||||
int *err, gchar **err_info);
|
||||
static void csids_close(wtap *wth);
|
||||
|
@ -145,7 +145,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
|
||||
/* Find the next packet and parse it; called from wtap_read(). */
|
||||
static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
guint8 *buf;
|
||||
int bytesRead = 0;
|
||||
|
@ -200,7 +200,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
|
|||
/* Used to read packets in random-access fashion */
|
||||
static gboolean
|
||||
csids_seek_read (wtap *wth,
|
||||
long seek_off,
|
||||
gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header _U_,
|
||||
guint8 *pd,
|
||||
int len,
|
||||
|
|
|
@ -85,8 +85,8 @@ static const char dbs_etherwatch_rec_magic[] =
|
|||
#define DBS_ETHERWATCH_MAX_PACKET_LEN 16384
|
||||
|
||||
static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean dbs_etherwatch_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
|
||||
int *err, gchar **err_info);
|
||||
static int parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf,
|
||||
|
@ -97,11 +97,11 @@ static guint parse_hex_dump(char* dump, guint8 *buf, char seperator, char end);
|
|||
|
||||
/* Seeks to the beginning of the next packet, and returns the
|
||||
byte offset. Returns -1 on failure, and sets "*err" to the error. */
|
||||
static long dbs_etherwatch_seek_next_packet(wtap *wth, int *err)
|
||||
static gint64 dbs_etherwatch_seek_next_packet(wtap *wth, int *err)
|
||||
{
|
||||
int byte;
|
||||
unsigned int level = 0;
|
||||
long cur_off;
|
||||
gint64 cur_off;
|
||||
|
||||
while ((byte = file_getc(wth->fh)) != EOF) {
|
||||
if (byte == dbs_etherwatch_rec_magic[level]) {
|
||||
|
@ -206,9 +206,9 @@ int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
|
||||
/* Find the next packet and parse it; called from wtap_read(). */
|
||||
static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
long offset;
|
||||
gint64 offset;
|
||||
guint8 *buf;
|
||||
int pkt_len;
|
||||
|
||||
|
@ -238,7 +238,7 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
/* Used to read packets in random-access fashion */
|
||||
static gboolean
|
||||
dbs_etherwatch_seek_read (wtap *wth, long seek_off,
|
||||
dbs_etherwatch_seek_read (wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header _U_,
|
||||
guint8 *pd, int len, int *err, gchar **err_info)
|
||||
{
|
||||
|
|
|
@ -69,8 +69,8 @@ static int erf_read_header(
|
|||
guint32 *bytes_read,
|
||||
guint32 *packet_size);
|
||||
static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean erf_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
int length, int *err, gchar **err_info);
|
||||
static void erf_close(wtap *wth);
|
||||
|
@ -209,7 +209,7 @@ int erf_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
|
||||
/* Read the next packet */
|
||||
static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
erf_header_t erf_header;
|
||||
guint32 packet_size, bytes_read;
|
||||
|
@ -249,7 +249,7 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean erf_seek_read(wtap *wth, long seek_off,
|
||||
static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
int length, int *err, gchar **err_info)
|
||||
{
|
||||
|
|
|
@ -143,15 +143,15 @@ static const etherpeek_encap_lookup_t etherpeek_encap[] = {
|
|||
(sizeof (etherpeek_encap) / sizeof (etherpeek_encap[0]))
|
||||
|
||||
static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean etherpeek_seek_read_v7(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void etherpeek_fill_pseudo_header_v7(
|
||||
union wtap_pseudo_header *pseudo_header, airopeek_radio_hdr_t *radio_hdr);
|
||||
static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean etherpeek_seek_read_v56(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean etherpeek_seek_read_v56(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void etherpeek_close(wtap *wth);
|
||||
|
@ -363,7 +363,7 @@ static void etherpeek_close(wtap *wth)
|
|||
}
|
||||
|
||||
static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
guchar ep_pkt[ETHERPEEK_V7_PKT_SIZE];
|
||||
guint16 protoNum;
|
||||
|
@ -468,7 +468,7 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
etherpeek_seek_read_v7(wtap *wth, long seek_off,
|
||||
etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
|
@ -533,7 +533,7 @@ etherpeek_fill_pseudo_header_v7(union wtap_pseudo_header *pseudo_header,
|
|||
}
|
||||
|
||||
static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info _U_,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
guchar ep_pkt[ETHERPEEK_V56_PKT_SIZE];
|
||||
guint16 length;
|
||||
|
@ -616,7 +616,7 @@ static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info _U_,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
etherpeek_seek_read_v56(wtap *wth, long seek_off,
|
||||
etherpeek_seek_read_v56(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info _U_)
|
||||
{
|
||||
|
|
|
@ -95,8 +95,8 @@ static const unsigned char eyesdn_hdr_magic[] =
|
|||
#define EYESDN_MAX_PACKET_LEN 16384
|
||||
|
||||
static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean eyesdn_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean eyesdn_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean parse_eyesdn_packet_data(FILE_T fh, int pkt_len, guint8* buf,
|
||||
|
@ -106,10 +106,10 @@ static int parse_eyesdn_rec_hdr(wtap *wth, FILE_T fh,
|
|||
|
||||
/* Seeks to the beginning of the next packet, and returns the
|
||||
byte offset. Returns -1 on failure, and sets "*err" to the error. */
|
||||
static long eyesdn_seek_next_packet(wtap *wth, int *err)
|
||||
static gint64 eyesdn_seek_next_packet(wtap *wth, int *err)
|
||||
{
|
||||
int byte;
|
||||
long cur_off;
|
||||
gint64 cur_off;
|
||||
|
||||
while ((byte = file_getc(wth->fh)) != EOF) {
|
||||
if (byte == 0xff) {
|
||||
|
@ -163,9 +163,9 @@ int eyesdn_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
|
||||
/* Find the next packet and parse it; called from wtap_read(). */
|
||||
static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
long offset;
|
||||
gint64 offset;
|
||||
guint8 *buf;
|
||||
int pkt_len;
|
||||
|
||||
|
@ -195,7 +195,7 @@ static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
/* Used to read packets in random-access fashion */
|
||||
static gboolean
|
||||
eyesdn_seek_read (wtap *wth, long seek_off,
|
||||
eyesdn_seek_read (wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
|
|
|
@ -859,12 +859,12 @@ gboolean wtap_dump_close(wtap_dumper *wdh, int *err)
|
|||
return ret;
|
||||
}
|
||||
|
||||
long wtap_get_bytes_dumped(wtap_dumper *wdh)
|
||||
gint64 wtap_get_bytes_dumped(wtap_dumper *wdh)
|
||||
{
|
||||
return wdh->bytes_dumped;
|
||||
}
|
||||
|
||||
void wtap_set_bytes_dumped(wtap_dumper *wdh, long bytes_dumped)
|
||||
void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
|
||||
{
|
||||
wdh->bytes_dumped = bytes_dumped;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,9 @@
|
|||
#include "file_wrappers.h"
|
||||
#include "file_util.h"
|
||||
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
|
||||
FILE_T
|
||||
file_open(const char *path, const char *mode)
|
||||
{
|
||||
|
@ -160,12 +162,13 @@ file_open(const char *path, const char *mode)
|
|||
return ft;
|
||||
}
|
||||
|
||||
long
|
||||
file_seek(void *stream, long offset, int whence, int *err)
|
||||
int
|
||||
file_seek(void *stream, gint64 offset, int whence, int *err)
|
||||
{
|
||||
long ret;
|
||||
gint64 ret;
|
||||
|
||||
ret = gzseek(stream, (z_off_t)offset, whence);
|
||||
/* XXX - z_off_t is usually long, won't work >= 2GB! */
|
||||
ret = (gint64) gzseek(stream, (z_off_t)offset, whence);
|
||||
if (ret == -1) {
|
||||
/*
|
||||
* XXX - "gzseek()", as of zlib 1.1.4, doesn't set
|
||||
|
@ -183,30 +186,18 @@ file_seek(void *stream, long offset, int whence, int *err)
|
|||
return ret;
|
||||
}
|
||||
|
||||
long
|
||||
gint64
|
||||
file_tell(void *stream)
|
||||
{
|
||||
return (long)gztell(stream);
|
||||
/* XXX - z_off_t is usually long, won't work >= 2GB! */
|
||||
return (gint64)gztell(stream);
|
||||
}
|
||||
#else /* HAVE_LIBZ */
|
||||
long
|
||||
file_seek(void *stream, long offset, int whence, int *err)
|
||||
{
|
||||
long ret;
|
||||
|
||||
ret = fseek(stream, offset, whence);
|
||||
if (ret == -1)
|
||||
*err = file_error(stream);
|
||||
return ret;
|
||||
}
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* Routine to return a Wiretap error code (0 for no error, an errno
|
||||
* for a file error, or a WTAP_ERR_ code for other errors) for an
|
||||
* I/O stream.
|
||||
*/
|
||||
#ifdef HAVE_LIBZ
|
||||
int
|
||||
file_error(void *fh)
|
||||
{
|
||||
|
@ -228,13 +219,80 @@ file_error(void *fh)
|
|||
return WTAP_ERR_ZLIB + errnum;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* HAVE_LIBZ */
|
||||
int
|
||||
file_error(FILE *fh)
|
||||
|
||||
gint64
|
||||
file_seek(void *stream, gint64 offset, int whence, int *err)
|
||||
{
|
||||
if (ferror(fh))
|
||||
gint64 ret;
|
||||
#ifdef _WIN32
|
||||
gint64 pos;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Win32 version using fsetpos/fgetpos */
|
||||
/* XXX - using fsetpos/fgetpos this way is UNDOCUMENTED, but I don't see a any better way :-( */
|
||||
/* _lseeki64(_fileno(stream)) doesn't work as this will mangle the internal FILE handling data */
|
||||
switch(whence) {
|
||||
case(SEEK_SET):
|
||||
/* do nothing */
|
||||
break;
|
||||
case(SEEK_CUR):
|
||||
/* adjust offset */
|
||||
/* XXX - CURRENTLY UNTESTED!!! */
|
||||
ret = fgetpos(stream, &pos);
|
||||
if(ret != 0) {
|
||||
*err = errno;
|
||||
return ret;
|
||||
}
|
||||
offset += pos;
|
||||
break;
|
||||
case(SEEK_END):
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
ret = fsetpos(stream, &offset);
|
||||
if(ret != 0) {
|
||||
*err = errno;
|
||||
}
|
||||
/* XXX - won't work >= 2GB! */
|
||||
/*ret = (gint64) fseek(stream, (long) offset, whence);
|
||||
if(ret == -1) {
|
||||
*err = errno;
|
||||
}*/
|
||||
#else
|
||||
/* "basic" version using fseek */
|
||||
/* XXX - won't work >= 2GB! */
|
||||
ret = (gint64) fseek(stream, (long) offset, whence);
|
||||
if (ret == -1)
|
||||
*err = file_error(stream);
|
||||
#endif
|
||||
/*g_warning("Seek %lld whence %u ret %lld size %u", offset, whence, ret, sizeof(fpos_t));*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
gint64
|
||||
file_tell(void *stream)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* Win32 version using _telli64 */
|
||||
/* XXX - CURRENTLY UNTESTED!!! */
|
||||
return _telli64(_fileno((FILE *)stream));
|
||||
#else
|
||||
/* "basic" version using ftell */
|
||||
/* XXX - ftell returns a long - won't work >= 2GB! */
|
||||
return (gint64) ftell(stream);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
file_error(void *fh)
|
||||
{
|
||||
if (ferror((FILE *) fh))
|
||||
return errno;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
|
|
@ -24,29 +24,28 @@
|
|||
#ifndef __FILE_H__
|
||||
#define __FILE_H__
|
||||
|
||||
extern gint64 file_seek(void *stream, gint64 offset, int whence, int *err);
|
||||
extern gint64 file_tell(void *stream);
|
||||
extern int file_error(void *fh);
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
|
||||
extern FILE_T file_open(const char *path, const char *mode);
|
||||
#define filed_open gzdopen
|
||||
extern long file_seek(void *stream, long offset, int whence, int *err);
|
||||
#define file_read(buf, bsize, count, file) gzread((file),(buf),((count)*(bsize)))
|
||||
#define file_write(buf, bsize, count, file) gzwrite((file),(buf),((count)*(bsize)))
|
||||
#define file_close gzclose
|
||||
extern long file_tell(void *stream);
|
||||
#define file_getc gzgetc
|
||||
#define file_gets(buf, len, file) gzgets((file), (buf), (len))
|
||||
extern int file_error(void *fh);
|
||||
#define file_eof gzeof
|
||||
|
||||
#else /* No zLib */
|
||||
/* XXX - mixing eth_xxx and fxxx calls might not be a good idea with MSVC 2005! */
|
||||
#define file_open(path, mode) eth_fopen(path, mode)
|
||||
#define filed_open fdopen
|
||||
extern long file_seek(void *stream, long offset, int whence, int *err);
|
||||
#define file_read fread
|
||||
#define file_write fwrite
|
||||
#define file_close fclose
|
||||
extern int file_error(FILE *fh);
|
||||
#define file_tell ftell
|
||||
#define file_getc fgetc
|
||||
#define file_gets fgets
|
||||
#define file_eof feof
|
||||
|
|
|
@ -39,7 +39,7 @@ struct dump_hdr {
|
|||
#define DUMP_HDR_SIZE (sizeof(struct dump_hdr))
|
||||
|
||||
static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
struct dump_hdr dh;
|
||||
guint8 *buf;
|
||||
|
@ -90,7 +90,7 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean hcidump_seek_read(wtap *wth, long seek_off,
|
||||
static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info _U_)
|
||||
{
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
#include "i4btrace.h"
|
||||
|
||||
static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean i4btrace_seek_read(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean i4btrace_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int i4b_read_rec_header(FILE_T fh, i4b_trace_hdr_t *hdr, int *err);
|
||||
|
@ -116,7 +116,7 @@ int i4btrace_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
|
||||
/* Read the next packet */
|
||||
static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset)
|
||||
gint64 *data_offset)
|
||||
{
|
||||
int ret;
|
||||
i4b_trace_hdr_t hdr;
|
||||
|
@ -182,7 +182,7 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
i4btrace_seek_read(wtap *wth, long seek_off,
|
||||
i4btrace_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
int *err, gchar **err_info _U_)
|
||||
{
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
#include "iptrace.h"
|
||||
|
||||
static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off,
|
||||
gint64 *data_offset);
|
||||
static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
|
||||
long *data_offset);
|
||||
static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off,
|
||||