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 #include "frame_data_sequence.h"
30 /* Current state of file. */
32 FILE_CLOSED, /* No file open */
33 FILE_READ_IN_PROGRESS, /* Reading a file we've opened */
34 FILE_READ_ABORTED, /* Read aborted by user */
35 FILE_READ_DONE /* Read completed */
38 /* Character set for text search. */
40 SCS_ASCII_AND_UNICODE,
43 /* add EBCDIC when it's implemented */
52 * We store the frame_data structures in a radix tree, with 1024
53 * elements per level. The leaf nodes are arrays of 1024 frame_data
54 * structures; the nodes above them are arrays of 1024 pointers to
55 * the nodes below them. The capture_file structure has a pointer
58 * As frame numbers are 32 bits, and as 1024 is 2^10, that gives us
59 * up to 4 levels of tree.
61 #define LOG2_NODES_PER_LEVEL 10
62 #define NODES_PER_LEVEL (1<<LOG2_NODES_PER_LEVEL)
64 typedef struct _capture_file {
65 file_state state; /* Current state of capture file */
66 gchar *filename; /* Name of capture file */
67 gchar *source; /* Temp file source, e.g. "Pipe from elsewhere" */
68 gboolean is_tempfile; /* Is capture file a temporary file? */
69 gboolean user_saved; /* If capture file is temporary, has it been saved by user yet? */
70 gint64 f_datalen; /* Size of capture file data (uncompressed) */
71 guint16 cd_t; /* File type of capture file */
72 int lnk_t; /* Link-layer type with which to save capture */
73 guint32 count; /* Total number of frames */
74 guint32 displayed_count; /* Number of displayed frames */
75 guint32 marked_count; /* Number of marked frames */
76 guint32 ignored_count; /* Number of ignored frames */
77 guint32 ref_time_count; /* Number of time referenced frames */
78 gboolean drops_known; /* TRUE if we know how many packets were dropped */
79 guint32 drops; /* Dropped packets */
80 nstime_t elapsed_time; /* Elapsed time */
81 gboolean has_snap; /* TRUE if maximum capture packet length is known */
82 int snap; /* Maximum captured packet length */
83 wtap *wth; /* Wiretap session */
84 dfilter_t *rfcode; /* Compiled read (display) filter program */
85 gchar *dfilter; /* Display filter string */
86 gboolean redissecting; /* TRUE if currently redissecting (cf_redissect_packets) */
88 gchar *sfilter; /* Filter, hex value, or string being searched */
89 gboolean hex; /* TRUE if "Hex value" search was last selected */
90 gboolean string; /* TRUE if "String" search was last selected */
91 gboolean summary_data; /* TRUE if "String" search in "Packet list" (Info column) was last selected */
92 gboolean decode_data; /* TRUE if "String" search in "Packet details" was last selected */
93 gboolean packet_data; /* TRUE if "String" search in "Packet data" was last selected */
94 guint32 search_pos; /* Byte position of last byte found in a hex search */
95 gboolean case_type; /* TRUE if case-insensitive text search */
96 search_charset_t scs_type; /* Character set for text search */
97 search_direction dir; /* Direction in which to do searches */
98 gboolean search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit <control>N/B */
100 union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */
101 guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */
103 frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
104 guint32 first_displayed; /* Frame number of first frame displayed */
105 guint32 last_displayed; /* Frame number of last frame displayed */
106 column_info cinfo; /* Column formatting information */
107 frame_data *current_frame; /* Frame data for current frame */
108 gint current_row; /* Row number for current frame */
109 epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
110 field_info *finfo_selected; /* Field info for currently selected field */
111 #ifdef WANT_PACKET_EDITOR
112 GTree *edited_frames; /* BST with modified frames */
116 extern void cap_file_init(capture_file *cf);