diff options
author | ashokn <ashokn@f5534014-38df-0310-8fa8-9805f1628bb7> | 1999-09-22 01:26:50 +0000 |
---|---|---|
committer | ashokn <ashokn@f5534014-38df-0310-8fa8-9805f1628bb7> | 1999-09-22 01:26:50 +0000 |
commit | cb683f69d3e6b300edec7c4d0f72bda14d2d87f8 (patch) | |
tree | e41c0cbc0a89e356df2ca7ef5af0596b8fe40fba /file.h | |
parent | d5147f66880ae13a2616a9bb1e278092ac9d62e4 (diff) |
This commit contains support for reading capture files compressed using
gzip. The zLib library is used for this purpose. If zLib is not available
(or it's use is disabled by the --disable-zlib option to configure), you
can still compile Ethereal but it will be unable to read compressed capture
files.
IMPORTANT:
Now all file accesses to capture files should be done through special macros.
Specifically, for any use of the following functions on capture files, replace them.
The arguments for the right-side functions are exactly the same as for the
original stdio functions.
fopen file_open
fdopen filed_open
fread file_read
fwrite file_write
fseek file_seek
fclose file_close
ferror file_error
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@695 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'file.h')
-rw-r--r-- | file.h | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -1,7 +1,7 @@ /* file.h * Definitions for file structures and routines * - * $Id: file.h,v 1.44 1999/09/12 20:23:32 guy Exp $ + * $Id: file.h,v 1.45 1999/09/22 01:26:24 ashokn Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -48,10 +48,40 @@ #include "colors.h" #endif +#include <errno.h> + +#ifdef HAVE_LIBZ +#include "zlib.h" + +#define FILE_T gzFile +#define file_open gzopen +#define filed_open gzdopen +#define file_seek gzseek +#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 +static inline int file_error(void *fh) { + int errnum; + gzerror(fh, &errnum); + if (errnum<0) return errnum; + return 0; +} + +#else /* No zLib */ +#define FILE_T FILE * +#define file_open fopen +#define filed_open fdopen +#define file_seek fseek +#define file_read fread +#define file_write fwrite +#define file_close fclose +#define file_error ferror +#endif /* HAVE_LIBZ */ + typedef struct bpf_program bpf_prog; typedef struct _capture_file { - FILE *fh; /* Capture file */ + FILE_T fh; /* Capture file */ gchar *filename; /* filename */ long f_len; /* File length */ guint16 cd_t; /* Capture data type */ @@ -66,6 +96,9 @@ typedef struct _capture_file { gboolean update_progbar; /* TRUE if we should update the progress bar */ long progbar_quantum; /* Number of bytes read per progress bar update */ long progbar_nextstep; /* Next point at which to update progress bar */ + float bouncebar_pos; /* Position of bounce bar */ + float bouncebar_step; /* Step */ + int bouncebar_reversed; /* Are we going right-to-left? */ gchar *iface; /* Interface */ gchar *save_file; /* File that user saved capture to */ int save_file_fd; /* File descriptor for saved file */ |