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