diff --git a/Makefile.am b/Makefile.am index 10d6881cf85..57564870387 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.469 2002/09/05 09:27:50 sahlberg Exp $ +# $Id: Makefile.am,v 1.470 2002/09/06 22:45:40 sahlberg Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -557,12 +557,15 @@ ETHEREAL_COMMON_SRC = \ bridged_pids.h \ capture_stop_conditions.c \ capture_stop_conditions.h \ + cfile.c \ + cfile.h \ color.h \ column.c \ column.h \ conditions.c \ conditions.h \ etypes.h \ + file.h \ follow.c \ follow.h \ format-oid.h \ @@ -620,11 +623,12 @@ ethereal_SOURCES = \ capture.c \ capture.h \ file.c \ - file.h \ filters.c \ filters.h \ globals.h \ menu.h \ + \ + \ progress_dlg.h \ proto_hier_stats.h \ proto_hier_stats.c \ @@ -641,11 +645,12 @@ ethereal_static_SOURCES = \ capture.c \ capture.h \ file.c \ - file.h \ filters.c \ filters.h \ globals.h \ menu.h \ + \ + \ progress_dlg.h \ proto_hier_stats.h \ proto_hier_stats.c \ diff --git a/Makefile.nmake b/Makefile.nmake index 78f41e289ef..ca4bf77bd0f 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,7 +1,7 @@ ## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # -# $Id: Makefile.nmake,v 1.207 2002/09/05 09:27:50 sahlberg Exp $ +# $Id: Makefile.nmake,v 1.208 2002/09/06 22:45:40 sahlberg Exp $ include config.nmake include @@ -291,6 +291,7 @@ ETHEREAL_COMMON_OBJECTS = \ asn1.obj \ capture_stop_conditions.obj \ capture-wpcap.obj \ + cfile.obj \ column.obj \ conditions.obj \ follow.obj \ diff --git a/file.h b/file.h index 647c76b7f46..c90b36bbaa1 100644 --- a/file.h +++ b/file.h @@ -1,7 +1,7 @@ /* file.h * Definitions for file structures and routines * - * $Id: file.h,v 1.97 2002/08/28 21:00:06 jmayer Exp $ + * $Id: file.h,v 1.98 2002/09/06 22:45:40 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -31,58 +31,7 @@ #include #include -/* Current state of file. */ -typedef enum { - FILE_CLOSED, /* No file open */ - FILE_READ_IN_PROGRESS, /* Reading a file we've opened */ - FILE_READ_ABORTED, /* Read aborted by user */ - FILE_READ_DONE /* Read completed */ -} file_state; - -typedef struct _capture_file { - file_state state; /* Current state of capture file */ - int filed; /* File descriptor of 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_len; /* Length of capture file */ - 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 */ - int count; /* Total number of frames */ - int marked_count; /* Number of marked frames */ - gboolean drops_known; /* TRUE if we know how many packets were dropped */ - guint32 drops; /* Dropped packets */ - guint32 esec; /* Elapsed seconds */ - guint32 eusec; /* Elapsed microseconds */ - gboolean has_snap; /* TRUE if maximum capture packet length is known */ - int snap; /* Maximum captured packet length */ - 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 */ - wtap *wth; /* Wiretap session */ - dfilter_t *rfcode; /* Compiled read filter program */ - gchar *dfilter; /* Display filter string */ - dfilter_t *dfcode; /* Compiled display filter program */ -#ifdef HAVE_LIBPCAP - gchar *cfilter; /* Capture filter string */ -#endif - gchar *sfilter; /* Search filter string */ - gboolean sbackward; /* TRUE if search is backward, FALSE if forward */ - union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */ - guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ - GMemChunk *plist_chunk; /* Memory chunk for frame_data structures */ - 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 */ - frame_data *current_frame; /* Frame data for current frame */ - epan_dissect_t *edt; /* Protocol dissection fo rcurrently selected packet */ - FILE *print_fh; /* File we're printing to */ -} capture_file; +#include "cfile.h" /* Return values from "read_cap_file()", "continue_tail_cap_file()", and "finish_tail_cap_file()". */ diff --git a/gtk/main.c b/gtk/main.c index 16ba041c25e..13bbad1e0a9 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.260 2002/09/05 18:47:46 jmayer Exp $ + * $Id: main.c,v 1.261 2002/09/06 22:45:42 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1358,25 +1358,7 @@ main(int argc, char *argv[]) /* Read the display filter file. */ read_filter_list(DFILTER_LIST, &df_path, &df_open_errno); - /* Initialize the capture file struct */ - cfile.plist = NULL; - cfile.plist_end = NULL; - cfile.wth = NULL; - cfile.filename = NULL; - cfile.user_saved = FALSE; - cfile.is_tempfile = FALSE; - cfile.rfcode = NULL; - cfile.dfilter = NULL; - cfile.dfcode = NULL; -#ifdef HAVE_LIBPCAP - cfile.cfilter = g_strdup(EMPTY_FILTER); -#endif - cfile.iface = NULL; - cfile.save_file = NULL; - cfile.save_file_fd = -1; - cfile.has_snap = FALSE; - cfile.snap = WTAP_MAX_PACKET_SIZE; - cfile.count = 0; + init_cap_file(&cfile); /* Assemble the compile-time options */ comp_info_str = g_string_new(""); diff --git a/gtk2/main.c b/gtk2/main.c index d912eb4ee74..53c763485ab 100644 --- a/gtk2/main.c +++ b/gtk2/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.7 2002/09/06 13:24:45 sahlberg Exp $ + * $Id: main.c,v 1.8 2002/09/06 22:45:44 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1440,25 +1440,7 @@ main(int argc, char *argv[]) /* Read the display filter file. */ read_filter_list(DFILTER_LIST, &df_path, &df_open_errno); - /* Initialize the capture file struct */ - cfile.plist = NULL; - cfile.plist_end = NULL; - cfile.wth = NULL; - cfile.filename = NULL; - cfile.user_saved = FALSE; - cfile.is_tempfile = FALSE; - cfile.rfcode = NULL; - cfile.dfilter = NULL; - cfile.dfcode = NULL; -#ifdef HAVE_LIBPCAP - cfile.cfilter = g_strdup(EMPTY_FILTER); -#endif - cfile.iface = NULL; - cfile.save_file = NULL; - cfile.save_file_fd = -1; - cfile.has_snap = FALSE; - cfile.snap = WTAP_MAX_PACKET_SIZE; - cfile.count = 0; + init_cap_file(&cfile); /* Assemble the compile-time options */ comp_info_str = g_string_new(""); diff --git a/tethereal.c b/tethereal.c index 1ea111101f0..bfcb03e14c0 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.156 2002/09/05 09:27:50 sahlberg Exp $ + * $Id: tethereal.c,v 1.157 2002/09/06 22:45:40 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -390,25 +390,7 @@ main(int argc, char *argv[]) load_wpcap(); #endif - /* Initialize the capture file struct */ - cfile.plist = NULL; - cfile.plist_end = NULL; - cfile.wth = NULL; - cfile.filename = NULL; - cfile.user_saved = FALSE; - cfile.is_tempfile = FALSE; - cfile.rfcode = NULL; - cfile.dfilter = NULL; - cfile.dfcode = NULL; -#ifdef HAVE_LIBPCAP - cfile.cfilter = g_strdup(""); -#endif - cfile.iface = NULL; - cfile.save_file = NULL; - cfile.save_file_fd = -1; - cfile.has_snap = FALSE; - cfile.snap = WTAP_MAX_PACKET_SIZE; - cfile.count = 0; + init_cap_file(&cfile); /* Assemble the compile-time options */ comp_info_str = g_string_new("");