aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
diff options
context:
space:
mode:
authorAshok Narayanan <ashokn@cisco.com>1999-09-22 01:26:50 +0000
committerAshok Narayanan <ashokn@cisco.com>1999-09-22 01:26:50 +0000
commit3dfa56c4984047d92a8df46f50b92111a8bdf574 (patch)
treee41c0cbc0a89e356df2ca7ef5af0596b8fe40fba /file.h
parent453a4e95fb0b91201f2950bac43316f330353034 (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 svn path=/trunk/; revision=695
Diffstat (limited to 'file.h')
-rw-r--r--file.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/file.h b/file.h
index a81527e0e9..c059ea3f8a 100644
--- a/file.h
+++ b/file.h
@@ -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 */