2 * capture_file definition & GUI-independent manipulation
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 /* Current state of file. */
30 FILE_CLOSED, /* No file open */
31 FILE_READ_IN_PROGRESS, /* Reading a file we've opened */
32 FILE_READ_ABORTED, /* Read aborted by user */
33 FILE_READ_DONE /* Read completed */
36 /* Character set for text search. */
38 SCS_ASCII_AND_UNICODE,
41 /* add EBCDIC when it's implemented */
49 typedef struct _capture_file {
50 file_state state; /* Current state of capture file */
51 gchar *filename; /* Name of capture file */
52 gchar *source; /* Temp file source, e.g. "Pipe from elsewhere" */
53 gboolean is_tempfile; /* Is capture file a temporary file? */
54 gboolean user_saved; /* If capture file is temporary, has it been saved by user yet? */
55 gint64 f_datalen; /* Size of capture file data (uncompressed) */
56 guint16 cd_t; /* File type of capture file */
57 int lnk_t; /* Link-layer type with which to save capture */
58 int count; /* Total number of frames */
59 int displayed_count; /* Number of displayed frames */
60 int marked_count; /* Number of marked frames */
61 int ignored_count; /* Number of ignored frames */
62 int ref_time_count; /* Number of time referenced frames */
63 gboolean drops_known; /* TRUE if we know how many packets were dropped */
64 guint32 drops; /* Dropped packets */
65 nstime_t elapsed_time; /* Elapsed time */
66 gboolean has_snap; /* TRUE if maximum capture packet length is known */
67 int snap; /* Maximum captured packet length */
68 wtap *wth; /* Wiretap session */
69 dfilter_t *rfcode; /* Compiled read (display) filter program */
70 gchar *dfilter; /* Display filter string */
71 gboolean redissecting; /* TRUE if currently redissecting (cf_redissect_packets) */
73 gchar *sfilter; /* Search filter string */
74 search_direction dir; /* Direction in which to do searches */
75 gboolean hex; /* TRUE is raw data search is being performed */
76 gboolean string; /* TRUE is text search is being performed */
77 guint32 search_pos; /* Position of last character found in search */
78 search_charset_t scs_type; /* Character set for text search */
79 gboolean case_type; /* TRUE if case-insensitive text search */
80 gboolean decode_data; /* TRUE if searching protocol tree text */
81 gboolean summary_data; /* TRUE if searching Info column text */
82 gboolean search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit <control>N/B */
84 union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */
85 guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */
86 /* memory chunks have been deprecated in favor of the slice allocator,
87 * which has been added in 2.10
89 #if GLIB_CHECK_VERSION(2,10,0)
92 GMemChunk *plist_chunk; /* Memory chunk for frame_data structures */
94 frame_data *plist_start; /* Packet list */
95 frame_data *plist_end; /* Last packet in list */
96 frame_data *first_displayed; /* First frame displayed */
97 frame_data *last_displayed; /* Last frame displayed */
98 column_info cinfo; /* Column formatting information */
99 frame_data *current_frame; /* Frame data for current frame */
100 gint current_row; /* Row number for current frame */
101 epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
102 field_info *finfo_selected; /* Field info for currently selected field */
105 void cap_file_init(capture_file *cf);
107 void cap_file_add_fdata(capture_file *cf, frame_data *fdata);