/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.22 1999/07/24 02:42:50 guy Exp $
+ * $Id: file.h,v 1.53 1999/11/18 21:04:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
#ifndef __WTAP_H__
-#include <wtap.h>
+#include "wiretap/wtap.h"
#endif
#ifdef HAVE_LIBPCAP
#endif
#endif
+#ifndef __DFILTER_H__
+#include "dfilter.h"
+#endif
+
+#ifndef __COLORS_H__
+#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
+
+#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
+#endif /* HAVE_LIBZ */
+
typedef struct bpf_program bpf_prog;
typedef struct _capture_file {
- FILE *fh; /* Capture file */
- gchar *filename; /* filename */
- long f_len; /* File length */
- guint16 cd_t; /* Capture data type */
- guint32 vers; /* Version. For tcpdump minor is appended to major */
- guint32 count; /* Packet count */
- guint32 drops; /* Dropped packets */
- guint32 esec; /* Elapsed seconds */
- guint32 eusec; /* Elapsed microseconds */
- guint32 snap; /* Captured packet length */
- gchar *iface; /* Interface */
- gchar *save_file; /* File that user saved capture to */
- gint user_saved;/* Was capture file saved by user yet? */
- wtap *wth; /* Wiretap session */
- gchar *dfilter; /* Display filter string */
- GNode *dfcode; /* Compiled display filter program */
+ FILE_T fh; /* Capture file */
+ int filed; /* Filedes of capture file */
+ gchar *filename; /* filename */
+ long f_len; /* File length */
+ guint16 cd_t; /* Capture data type */
+ const gchar *cd_t_desc; /* Description of that data type */
+ guint32 vers; /* Version. For tcpdump minor is appended to major */
+ guint32 count; /* Packet count */
+ gfloat unfiltered_count; /* used for dfilter progress bar */
+ guint32 drops; /* Dropped packets */
+ guint32 esec; /* Elapsed seconds */
+ guint32 eusec; /* Elapsed microseconds */
+ guint32 snap; /* Captured packet length */
+ 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 */
+ gchar *iface; /* Interface */
+ gchar *save_file; /* File that user saved capture to */
+ int save_file_fd; /* File descriptor for saved file */
+ gint user_saved;/* Was capture file saved by user yet? */
+ wtap *wth; /* Wiretap session */
+ dfilter *rfcode; /* Compiled read filter program */
+ gchar *dfilter; /* Display filter string */
+ colfilter *colors; /* Colors for colorizing packet window */
+ dfilter *dfcode; /* Compiled display filter program */
#ifdef HAVE_LIBPCAP
- gchar *cfilter; /* Capture filter string */
- bpf_prog fcode; /* Compiled capture filter program */
+ gchar *cfilter; /* Capture filter string */
+ bpf_prog fcode; /* Compiled capture filter program */
#endif
- /* XXX - I'm cheating for now. I'll hardcode 65536 here until I re-arrange
- * more header files so that ethereal.h is split up into two files, a
- * generic header and a gtk+-speficic header (or the gtk+ definitions are
- * moved to different header files) --gilbert
- */
- /*guint8 pd[MAX_PACKET_SIZE];*/ /* Packet data */
- guint8 pd[65536]; /* Packet data */
- GList *plist; /* Packet list */
+ gchar *sfilter; /* Search filter string */
+ gboolean sbackward; /* TRUE if search is backward, FALSE if forward */
+ guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */
+ frame_data *plist; /* Packet list */
+ frame_data *plist_end; /* Last packet in list */
+ frame_data *first_displayed; /* First frame displayed */
+ frame_data *last_displayed; /* Last frame displayed */
column_info cinfo; /* Column formatting information */
- int selected_packet; /* Index in packet list of currently selected packet, if any */
- int selected_row; /* Row in packet display of currently selected packet, if any */
- FILE *print_fh; /* File we're printing to */
+ frame_data *current_frame; /* Frame data for current frame */
+ int current_row; /* Row in packet display of current frame */
+ gboolean current_frame_is_selected; /* TRUE if that frame is selected */
+ proto_tree *protocol_tree; /* Protocol tree for currently selected packet */
+ FILE *print_fh; /* File we're printing to */
} capture_file;
-
-/*
- * "open_cap_file()" can return:
- *
- * 0 on success;
- *
- * a positive "errno" value on an open failure;
- *
- * a negative number, indicating the type of error, on other failures.
- */
-#define OPEN_CAP_FILE_NOT_REGULAR -1 /* not a plain file */
-#define OPEN_CAP_FILE_UNKNOWN_FORMAT -2 /* not a capture file in a known format */
-
int open_cap_file(char *, capture_file *);
void close_cap_file(capture_file *, void *, guint);
-int load_cap_file(char *, capture_file *);
+int read_cap_file(capture_file *);
int tail_cap_file(char *, capture_file *);
/* size_t read_frame_header(capture_file *); */
-int print_packets(capture_file *cf, int to_file, const char *dest);
-void filter_packets(capture_file *);
+void filter_packets(capture_file *cf, gchar *dfilter);
+void colorize_packets(capture_file *);
+int print_packets(capture_file *cf, print_args_t *print_args);
void change_time_formats(capture_file *);
+gboolean find_packet(capture_file *cf, dfilter *sfcode);
+gboolean goto_frame(capture_file *cf, guint fnumber);
+void select_packet(capture_file *, int);
void unselect_packet(capture_file *);
/* Moves or copies a file. Returns 0 on failure, 1 on success */
char *file_write_error_message(int);
#endif /* file.h */
-
-
-