2 * capture_file definition & GUI-independent manipulation
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0+
14 #include <epan/epan.h>
15 #include <epan/column-info.h>
16 #include <epan/dfilter/dfilter.h>
17 #include <epan/frame_data.h>
18 #include <epan/frame_data_sequence.h>
19 #include <wiretap/wtap.h>
23 #endif /* __cplusplus */
25 /* Current state of file. */
27 FILE_CLOSED, /* No file open */
28 FILE_READ_IN_PROGRESS, /* Reading a file we've opened */
29 FILE_READ_ABORTED, /* Read aborted by user */
30 FILE_READ_DONE /* Read completed */
33 /* Character set for text search. */
38 /* add EBCDIC when it's implemented */
46 typedef struct _capture_file {
48 file_state state; /* Current state of capture file */
49 gchar *filename; /* Name of capture file */
50 gchar *source; /* Temp file source, e.g. "Pipe from elsewhere" */
51 gboolean is_tempfile; /* Is capture file a temporary file? */
52 gboolean unsaved_changes; /* Does the capture file have changes that have not been saved? */
53 gboolean stop_flag; /* Stop current processing (loading, searching, etc.) */
55 gint64 f_datalen; /* Size of capture file data (uncompressed) */
56 guint16 cd_t; /* File type of capture file */
57 unsigned int open_type; /* open_routine index+1 used, if selected, or WTAP_TYPE_AUTO */
58 gboolean iscompressed; /* TRUE if the file is compressed */
59 int lnk_t; /* File link-layer type; could be WTAP_ENCAP_PER_PACKET */
60 GArray *linktypes; /* Array of packet link-layer types */
61 guint32 count; /* Total number of frames */
62 guint64 packet_comment_count; /* Number of comments in frames (could be >1 per frame... */
63 guint32 displayed_count; /* Number of displayed frames */
64 guint32 marked_count; /* Number of marked frames */
65 guint32 ignored_count; /* Number of ignored frames */
66 guint32 ref_time_count; /* Number of time referenced frames */
67 gboolean drops_known; /* TRUE if we know how many packets were dropped */
68 guint32 drops; /* Dropped packets */
69 nstime_t elapsed_time; /* Elapsed time */
70 int snap; /* Maximum captured packet length; 0 if unknown */
71 wtap *wth; /* Wiretap session */
72 dfilter_t *rfcode; /* Compiled read filter program */
73 dfilter_t *dfcode; /* Compiled display filter program */
74 gchar *dfilter; /* Display filter string */
75 gboolean redissecting; /* TRUE if currently redissecting (cf_redissect_packets) */
77 gchar *sfilter; /* Filter, hex value, or string being searched */
78 gboolean hex; /* TRUE if "Hex value" search was last selected */
79 gboolean string; /* TRUE if "String" search was last selected */
80 gboolean summary_data; /* TRUE if "String" search in "Packet list" (Info column) was last selected */
81 gboolean decode_data; /* TRUE if "String" search in "Packet details" was last selected */
82 gboolean packet_data; /* TRUE if "String" search in "Packet data" was last selected */
83 guint32 search_pos; /* Byte position of last byte found in a hex search */
84 guint32 search_len; /* Length of bytes matching the search */
85 gboolean case_type; /* TRUE if case-insensitive text search */
86 GRegex *regex; /* Set if regular expression search */
87 search_charset_t scs_type; /* Character set for text search */
88 search_direction dir; /* Direction in which to do searches */
89 gboolean search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit <control>N/B */
91 struct wtap_pkthdr phdr; /* Packet header */
92 Buffer buf; /* Packet data */
94 frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
95 guint32 first_displayed; /* Frame number of first frame displayed */
96 guint32 last_displayed; /* Frame number of last frame displayed */
97 column_info cinfo; /* Column formatting information */
98 gboolean columns_changed; /**< Have the columns been changed in the prefs? (GTK+ only) */
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 */
103 gpointer window; /* Top-level window associated with file */
104 GTree *frames_user_comments; /* BST with user comments for frames (key = frame_data) */
105 gulong computed_elapsed; /* Elapsed time to load the file (in msec). */
108 const frame_data *ref;
109 frame_data *prev_dis;
110 frame_data *prev_cap;
113 extern void cap_file_init(capture_file *cf);
115 extern const char *cap_file_get_interface_name(struct _capture_file *cf, guint32 interface_id);
116 extern const char *cap_file_get_interface_description(struct _capture_file *cf, guint32 interface_id);
120 #endif /* __cplusplus */
125 * Editor modelines - http://www.wireshark.org/tools/modelines.html
130 * indent-tabs-mode: nil
133 * vi: set shiftwidth=2 tabstop=8 expandtab:
134 * :indentSize=2:tabSize=8:noTabs=true: