int err;
gchar *err_info;
gint64 size;
- long data_offset;
+ gint64 data_offset;
guint32 packet = 0;
gint64 bytes = 0;
{
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;
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 */
# The version of the wiretap library (recommended: leave unchanged)
WTAP_VERSION_MAJOR=0
WTAP_VERSION_MINOR=3
+WTAP_VERSION_MICRO=1
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) \
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;
}
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);
}
"", 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,
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 */
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);
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;
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;
cf_finish_tail(capture_file *cf, int *err)
{
gchar *err_info;
- long data_offset;
+ gint64 data_offset;
if(cf->wth == NULL) {
cf_close(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);
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;
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 */
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 */
/* 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 */
#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,
}
#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);
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 */
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 */
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;
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;
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 */
#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);
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);
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;
}
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;
#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);
/* 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;
}
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_)
{
} 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);
#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;
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)
{
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;
%}
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;
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__ */
};
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);
/* 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;
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;
/* 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;
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)
{
#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;
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;
/************************************************************/
/* 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);
/************************************************************/
/* 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,
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,
/********************************************/
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;
/* - 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;
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)
/* 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;
/* 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;
}
/* - 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;
/**************************************************************/
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)
{
#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,
/* 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) {
/* 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];
/* 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)
{
*/
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);
/* 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;
/* 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,
#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,
/* 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]) {
/* 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;
/* 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)
{
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);
/* 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;
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)
{
(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);
}
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;
}
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)
{
}
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;
}
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_)
{
#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,
/* 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) {
/* 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;
/* 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)
{
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;
}
#include "file_wrappers.h"
#include "file_util.h"
+
#ifdef HAVE_LIBZ
+
FILE_T
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
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)
{
return WTAP_ERR_ZLIB + errnum;
}
}
+
#else /* HAVE_LIBZ */
+
+gint64
+file_seek(void *stream, gint64 offset, int whence, int *err)
+{
+ 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(FILE *fh)
+file_error(void *fh)
{
- if (ferror(fh))
+ if (ferror((FILE *) fh))
return errno;
else
return 0;
}
+
#endif /* HAVE_LIBZ */
#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
#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;
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_)
{
#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);
/* 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;
}
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_)
{
#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,
+ gint64 *data_offset);
+static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
int *err, gchar **err_info);
/* Read the next packet */
static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info _U_,
- long *data_offset)
+ gint64 *data_offset)
{
int ret;
guint32 packet_size;
return TRUE;
}
-static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off,
+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 _U_)
{
/* Read the next packet */
static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info _U_,
- long *data_offset)
+ gint64 *data_offset)
{
int ret;
guint32 packet_size;
return TRUE;
}
-static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off,
+static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
int *err, gchar **err_info _U_)
{
#define ISERIES_FORMAT_UNICODE 2
static gboolean iseries_read (wtap * wth, int *err, gchar ** err_info,
- long *data_offset);
-static gboolean iseries_seek_read (wtap * wth, long seek_off,
+ gint64 *data_offset);
+static gboolean iseries_seek_read (wtap * wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header,
guint8 * pd, int len, int *err,
gchar ** err_info);
static gboolean iseries_check_file_type (wtap * wth, int *err, int format);
-static long iseries_seek_next_packet (wtap * wth, int *err);
+static gint64 iseries_seek_next_packet (wtap * wth, int *err);
static int iseries_parse_packet (wtap * wth, FILE_T fh,
union wtap_pseudo_header *pseudo_header,
guint8 * pd, int *err, gchar ** err_info);
* Find the next packet and parse it; called from wtap_read().
*/
static gboolean
-iseries_read (wtap * wth, int *err, gchar ** err_info, long *data_offset)
+iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
{
- long offset;
+ gint64 offset;
int pkt_len;
/*
* 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
+static gint64
iseries_seek_next_packet (wtap * wth, int *err)
{
char buf[ISERIES_LINE_LENGTH];
int line;
- long cur_off, buflen;
+ gint64 cur_off;
+ long buflen;
/*
* Seeks to the beginning of the next packet, and returns the
* Read packets in random-access fashion
*/
static gboolean
-iseries_seek_read (wtap * wth, long seek_off,
+iseries_seek_read (wtap * wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 * pd,
int len, int *err, gchar ** err_info)
{
union wtap_pseudo_header *pseudo_header, guint8 * pd,
int *err, gchar ** err_info)
{
- long cur_off;
+ gint64 cur_off;
gboolean isValid, isCurrentPacket, IPread, TCPread, isDATA;
int num_items_scanned, line, pktline, buflen;
int pkt_len, cap_len, pktnum, month, day, year, hr, min, sec, csec;
*
* XXX: works at most with 0x1FFF bytes per record
*/
-static gint get_record(guint8* buffer, FILE* fh, guint file_offset) {
+static gint get_record(guint8* buffer, FILE* fh, gint64 file_offset) {
long read;
long len;
- int i;
- long junky_offset = 0x2000 - ( (file_offset - 0x200) % 0x2000 );
+ gint64 i;
+ gint64 junky_offset = 0x2000 - ( (file_offset - 0x200) % 0x2000 );
#ifdef DEBUG_K12
- k12_dbg(5,"k12:get_record: ENTER offset=%u",file_offset);
+ k12_dbg(5,"k12:get_record: ENTER offset=%lld",file_offset);
#endif
if ( junky_offset != 0x2000 ) {
}
}
-static gboolean k12_read(wtap *wth, int *err, gchar **err_info _U_, long *data_offset) {
+static gboolean k12_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) {
k12_src_desc_t* src_desc;
guint8 buffer[0x2000];
- long offset;
+ gint64 offset;
long len;
guint32 type;
guint64 ts;
}
-static gboolean k12_seek_read(wtap *wth, long seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err _U_, gchar **err_info _U_) {
+static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err _U_, gchar **err_info _U_) {
k12_src_desc_t* src_desc;
guint8 buffer[0x2000];
guint32 input;
};
static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean lanalyzer_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static void lanalyzer_close(wtap *wth);
/* Read the next packet */
static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
int packet_size = 0;
int bytes_read;
return TRUE;
}
-static gboolean lanalyzer_seek_read(wtap *wth, long seek_off,
+static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info _U_)
{
static libpcap_try_t libpcap_try(wtap *wth, int *err);
static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean libpcap_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static int libpcap_read_header(wtap *wth, int *err, gchar **err_info,
/* Read the next packet */
static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
struct pcaprec_ss990915_hdr hdr;
guint packet_size;
}
static gboolean
-libpcap_seek_read(wtap *wth, long seek_off,
+libpcap_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info)
{
};
static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean netmon_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean netmon_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static gboolean netmon_read_atm_pseudoheader(FILE_T fh,
/* Read the next packet */
static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
netmon_t *netmon = wth->capture.netmon;
guint32 packet_size = 0;
}
static gboolean
-netmon_seek_read(wtap *wth, long seek_off,
+netmon_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info _U_)
{
/* header is followed by data and once again the total length (2 bytes) ! */
static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean nettl_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean nettl_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd,
int length, int *err, gchar **err_info);
static int nettl_read_rec_header(wtap *wth, FILE_T fh,
/* Read the next packet */
static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
int ret;
gboolean fddihack=FALSE;
}
static gboolean
-nettl_seek_read(wtap *wth, long seek_off,
+nettl_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd,
int length, int *err, gchar **err_info)
{
}
static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean observer_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static int read_packet_header(FILE_T fh, packet_entry_header *packet_header,
/* reads the next packet */
static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
int offset;
packet_entry_header packet_header;
GUINT64_FROM_LE(packet_header.nano_seconds_since_2000);
wth->phdr.ts.secs =
(time_t) (packet_header.nano_seconds_since_2000/1000000000 + seconds1970to2000);
- wth->phdr.ts.nsecs = packet_header.nano_seconds_since_2000%1000000000;
+ wth->phdr.ts.nsecs = (int) (packet_header.nano_seconds_since_2000%1000000000);
/* set-up the packet buffer */
buffer_assure_space(wth->frame_buffer, packet_header.captured_size);
}
/* reads a packet at an offset */
-static gboolean observer_seek_read(wtap *wth, long seek_off,
+static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info)
{
};
static gboolean netxray_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean netxray_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean netxray_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static int netxray_read_rec_header(wtap *wth, FILE_T fh,
/* Read the next packet */
static gboolean netxray_read(wtap *wth, int *err, gchar **err_info _U_,
- long *data_offset)
+ gint64 *data_offset)
{
guint32 packet_size;
union netxrayrec_hdr hdr;
}
static gboolean
-netxray_seek_read(wtap *wth, long seek_off,
+netxray_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info _U_)
{
static int process_rec_header2_v145(wtap *wth, unsigned char *buffer,
guint16 length, gint16 maj_vers, int *err, gchar **err_info);
static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean ngsniffer_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
int *err, gchar **err_info);
static int ngsniffer_read_rec_header(wtap *wth, gboolean is_random,
wtap *wth, gboolean is_random, int *err);
static int read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream,
int *err);
-static long ng_file_seek_seq(wtap *wth, long offset, int whence, int *err);
-static long ng_file_seek_rand(wtap *wth, long offset, int whence, int *err);
+static gint64 ng_file_seek_seq(wtap *wth, gint64 offset, int whence, int *err);
+static gint64 ng_file_seek_rand(wtap *wth, gint64 offset, int whence, int *err);
int ngsniffer_open(wtap *wth, int *err, gchar **err_info)
{
/* Read the next packet */
static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
int ret;
guint16 type, length;
return TRUE;
}
-static gboolean ngsniffer_seek_read(wtap *wth, long seek_off,
+static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
int *err, gchar **err_info _U_)
{
underlying compressed file, and the offset in the uncompressed data
stream, of the blob. */
typedef struct {
- long blob_comp_offset;
- long blob_uncomp_offset;
+ gint64 blob_comp_offset;
+ gint64 blob_uncomp_offset;
} blob_info_t;
static int
/* Seek in the sequential data stream; we can only seek forward, and we
do it on compressed files by skipping forward. */
-static long
-ng_file_seek_seq(wtap *wth, long offset, int whence, int *err)
+static gint64
+ng_file_seek_seq(wtap *wth, gint64 offset, int whence, int *err)
{
- long delta;
+ gint64 delta;
char buf[65536];
long amount_to_read;
/* Ok, now read and discard "delta" bytes. */
while (delta != 0) {
- amount_to_read = delta;
+ amount_to_read = (long) delta;
if ((unsigned long)amount_to_read > sizeof buf)
amount_to_read = sizeof buf;
if (ng_file_read(buf, 1, amount_to_read, wth, FALSE, err) < 0)
we're seeking, and read that blob in. We can then move to the appropriate
position within the blob we have in memory (whether it's the blob we
already had in memory or, if necessary, the one we read in). */
-static long
-ng_file_seek_rand(wtap *wth, long offset, int whence, int *err)
+static gint64
+ng_file_seek_rand(wtap *wth, gint64 offset, int whence, int *err)
{
ngsniffer_t *ngsniffer;
- long delta;
+ gint64 delta;
GList *new, *next;
blob_info_t *next_blob, *new_blob;
"ngsniffer->rand.nextout" to point to the place to which
we're seeking, and adjust "ngsniffer->rand.uncomp_offset" to be
the destination offset. */
- ngsniffer->rand.nextout += delta;
+ ngsniffer->rand.nextout += (int) delta;
ngsniffer->rand.uncomp_offset += delta;
return offset;
} direction_enum;
static gboolean pppdump_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean pppdump_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info);
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean
-pppdump_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
+pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
int num_bytes;
direction_enum direction;
/* Used to read packets in random-access fashion */
static gboolean
pppdump_seek_read(wtap *wth,
- long seek_off,
+ gint64 seek_off,
union wtap_pseudo_header *pseudo_header,
guint8 *pd,
int len,
};
static gboolean radcom_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean radcom_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean radcom_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr,
/* Read the next packet */
static gboolean radcom_read(wtap *wth, int *err, gchar **err_info _U_,
- long *data_offset)
+ gint64 *data_offset)
{
int ret;
struct radcomrec_hdr hdr;
}
static gboolean
-radcom_seek_read(wtap *wth, long seek_off,
+radcom_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info _U_)
{
#define RX_STATUS_TRIGGERED 0x0001 /* frame did trigger */
static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean snoop_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean snoop_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info);
static gboolean snoop_read_atm_pseudoheader(FILE_T fh,
/* Read the next packet */
static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
guint32 rec_size;
guint32 packet_size;
}
static gboolean
-snoop_seek_read(wtap *wth, long seek_off,
+snoop_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
int *err, gchar **err_info _U_)
{
#define TOSHIBA_MAX_PACKET_LEN 16384
static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean toshiba_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean toshiba_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_single_hex_dump_line(char* rec, guint8 *buf,
/* 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 toshiba_seek_next_packet(wtap *wth, int *err)
+static gint64 toshiba_seek_next_packet(wtap *wth, int *err)
{
int byte;
guint level = 0;
- long cur_off;
+ gint64 cur_off;
while ((byte = file_getc(wth->fh)) != EOF) {
if (byte == toshiba_rec_magic[level]) {
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
- long offset;
+ gint64 offset;
guint8 *buf;
int pkt_len;
/* Used to read packets in random-access fashion */
static gboolean
-toshiba_seek_read (wtap *wth, long seek_off,
+toshiba_seek_read (wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info)
{
/* Local functions to handle file reads and writes */
static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
+ gint64 *data_offset);
static void visual_close(wtap *wth);
-static gboolean visual_seek_read(wtap *wth, long seek_off,
+static gboolean visual_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
int *err, gchar **err_info);
static void visual_set_pseudo_header(int encap, struct visual_pkt_hdr *vpkt_hdr,
the file has been read once, any Future access to the packets is
done through seek_read. */
static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
struct visual_read_info *visual = wth->capture.generic;
guint32 packet_size = 0;
/* Read packet data for random access.
This gets the packet data and rebuilds the pseudo header so that
the direction flag works. */
-static gboolean visual_seek_read (wtap *wth, long seek_off,
+static gboolean visual_seek_read (wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info _U_)
{
#define VMS_LINE_LENGTH 240
static gboolean vms_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean vms_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean vms_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_single_hex_dump_line(char* rec, guint8 *buf,
{
char buf[VMS_LINE_LENGTH];
guint reclen, line;
- long mpos;
+ gint64 mpos;
buf[VMS_LINE_LENGTH-1] = '\0';
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean vms_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
- long offset = 0;
+ gint64 offset = 0;
guint8 *buf;
int pkt_len;
/* Used to read packets in random-access fashion */
static gboolean
-vms_seek_read (wtap *wth, long seek_off,
+vms_seek_read (wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header _U_,
guint8 *pd, int len, int *err, gchar **err_info)
{
unsigned char *buf; /* buffer into which we uncompress data */
size_t nbytes; /* number of bytes of data in that buffer */
int nextout; /* offset in that buffer of stream's current position */
- long comp_offset; /* current offset in compressed data stream */
- long uncomp_offset; /* current offset in uncompressed data stream */
+ gint64 comp_offset; /* current offset in compressed data stream */
+ gint64 uncomp_offset; /* current offset in uncompressed data stream */
} ngsniffer_comp_stream_t;
typedef struct {
double start_timestamp;
gboolean wrapped;
guint32 nframes;
- long start_offset;
- long end_offset;
+ gint64 start_offset;
+ gint64 end_offset;
int version_major;
gboolean fcs_valid; /* if packets have valid FCS at the end */
guint isdn_type; /* 1 = E1 PRI, 2 = T1 PRI, 3 = BRI */
typedef struct {
time_t inittime;
int adjusted;
- long next_packet_seek_start;
+ gint64 next_packet_seek_start;
} ascend_t;
typedef struct {
guint32 start_usecs;
} catapult_dct2000_t;
-typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, long*);
-typedef gboolean (*subtype_seek_read_func)(struct wtap*, long, union wtap_pseudo_header*,
+typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, gint64*);
+typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, union wtap_pseudo_header*,
guint8*, int, int *, char **);
struct wtap {
FILE_T fh;
struct wtap_pkthdr phdr;
union wtap_pseudo_header pseudo_header;
- long data_offset;
+ gint64 data_offset;
union {
libpcap_t *pcap;
int snaplen;
int encap;
gboolean compressed;
- long bytes_dumped;
+ gint64 bytes_dumped;
union {
void *opaque;
}
gboolean
-wtap_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
+wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
/*
* Set the packet encapsulation to the file's encapsulation
}
gboolean
-wtap_seek_read(wtap *wth, long seek_off,
+wtap_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info)
{
struct atm_phdr atm;
struct p2p_phdr p2p;
} inner_pseudo_header;
- long seek_off;
+ gint64 seek_off;
struct wtap *wth;
};
* set the the offset in the file where the data for the read packet is
* located. */
gboolean wtap_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
+ gint64 *data_offset);
/*
* Return an approximation of the amount of data we've read sequentially
- * from the file so far. (gint64, in case that's 64 bits.)
+ * from the file so far.
*/
gint64 wtap_read_so_far(wtap *wth, int *err);
const char *wtap_strerror(int err);
void wtap_sequential_close(wtap *wth);
void wtap_close(wtap *wth);
-gboolean wtap_seek_read (wtap *wth, long seek_off,
+gboolean wtap_seek_read (wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info);
const union wtap_pseudo_header *pseudo_header, const guchar *, int *err);
void wtap_dump_flush(wtap_dumper *);
gboolean wtap_dump_close(wtap_dumper *, int *);
-long wtap_get_bytes_dumped(wtap_dumper *);
-void wtap_set_bytes_dumped(wtap_dumper *wdh, long bytes_dumped);
+gint64 wtap_get_bytes_dumped(wtap_dumper *);
+void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped);
/*
* Wiretap error codes.