Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
/home/wireshark/builders/wireshark-master/ubuntu-16.04-x64/build/cfile.h
1 /* cfile.h
2  * capture_file definition & GUI-independent manipulation
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef __CFILE_H__
12 #define __CFILE_H__
13 
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>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 /* Current state of file. */
26 typedef enum {
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 */
31 } file_state;
32 
33 /* Character set for text search. */
34 typedef enum {
35  SCS_NARROW_AND_WIDE,
36  SCS_NARROW,
37  SCS_WIDE
38  /* add EBCDIC when it's implemented */
39 } search_charset_t;
40 
41 typedef enum {
42  SD_FORWARD,
43  SD_BACKWARD
44 } search_direction;
45 
46 /*
47  * Packet provider for programs using a capture file.
48  */
50  wtap *wth; /* Wiretap session */
51  const frame_data *ref;
52  frame_data *prev_dis;
53  frame_data *prev_cap;
54  frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
55  GTree *frames_user_comments; /* BST with user comments for frames (key = frame_data) */
56 };
57 
58 typedef struct _capture_file {
59  epan_t *epan;
60  file_state state; /* Current state of capture file */
61  gchar *filename; /* Name of capture file */
62  gchar *source; /* Temp file source, e.g. "Pipe from elsewhere" */
63  gboolean is_tempfile; /* Is capture file a temporary file? */
64  gboolean unsaved_changes; /* Does the capture file have changes that have not been saved? */
65  gboolean stop_flag; /* Stop current processing (loading, searching, etc.) */
66 
67  gint64 f_datalen; /* Size of capture file data (uncompressed) */
68  guint16 cd_t; /* File type of capture file */
69  unsigned int open_type; /* open_routine index+1 used, if selected, or WTAP_TYPE_AUTO */
70  gboolean iscompressed; /* TRUE if the file is compressed */
71  int lnk_t; /* File link-layer type; could be WTAP_ENCAP_PER_PACKET */
72  GArray *linktypes; /* Array of packet link-layer types */
73  guint32 count; /* Total number of frames */
74  guint64 packet_comment_count; /* Number of comments in frames (could be >1 per frame... */
75  guint32 displayed_count; /* Number of displayed frames */
76  guint32 marked_count; /* Number of marked frames */
77  guint32 ignored_count; /* Number of ignored frames */
78  guint32 ref_time_count; /* Number of time referenced frames */
79  gboolean drops_known; /* TRUE if we know how many packets were dropped */
80  guint32 drops; /* Dropped packets */
81  nstime_t elapsed_time; /* Elapsed time */
82  int snap; /* Maximum captured packet length; 0 if unknown */
83  dfilter_t *rfcode; /* Compiled read filter program */
84  dfilter_t *dfcode; /* Compiled display filter program */
85  gchar *dfilter; /* Display filter string */
86  gboolean redissecting; /* TRUE if currently redissecting (cf_redissect_packets) */
87  /* search */
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  guint32 search_len; /* Length of bytes matching the search */
96  gboolean case_type; /* TRUE if case-insensitive text search */
97  GRegex *regex; /* Set if regular expression search */
98  search_charset_t scs_type; /* Character set for text search */
99  search_direction dir; /* Direction in which to do searches */
100  gboolean search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit <control>N/B */
101  /* packet data */
102  wtap_rec rec; /* Record header */
103  Buffer buf; /* Record data */
104  /* packet provider */
105  struct packet_provider_data provider;
106  /* frames */
107  guint32 first_displayed; /* Frame number of first frame displayed */
108  guint32 last_displayed; /* Frame number of last frame displayed */
109  column_info cinfo; /* Column formatting information */
110  frame_data *current_frame; /* Frame data for current frame */
111  gint current_row; /* Row number for current frame */
112  epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
113  field_info *finfo_selected; /* Field info for currently selected field */
114  gpointer window; /* Top-level window associated with file */
115  gulong computed_elapsed; /* Elapsed time to load the file (in msec). */
116 
117  guint32 cum_bytes;
118 } capture_file;
119 
120 extern void cap_file_init(capture_file *cf);
121 
122 const char *cap_file_provider_get_interface_name(struct packet_provider_data *prov, guint32 interface_id);
123 const char *cap_file_provider_get_interface_description(struct packet_provider_data *prov, guint32 interface_id);
124 const char *cap_file_provider_get_user_comment(struct packet_provider_data *prov, const frame_data *fd);
125 void cap_file_provider_set_user_comment(struct packet_provider_data *prov, frame_data *fd, const char *new_comment);
126 
127 #ifdef __cplusplus
128 }
129 #endif /* __cplusplus */
130 
131 #endif /* cfile.h */
132 
133 /*
134  * Editor modelines - http://www.wireshark.org/tools/modelines.html
135  *
136  * Local Variables:
137  * c-basic-offset: 2
138  * tab-width: 8
139  * indent-tabs-mode: nil
140  * End:
141  *
142  * vi: set shiftwidth=2 tabstop=8 expandtab:
143  * :indentSize=2:tabSize=8:noTabs=true:
144  */
Definition: wtap-int.h:34
Definition: buffer.h:21
Definition: column-info.h:51
Definition: cfile.h:49
Definition: nstime.h:27
Definition: frame_data_sequence.c:32
Definition: proto.h:673
Definition: dfilter-int.h:19
Definition: frame_data.h:53
Definition: epan_dissect.h:28
Definition: cfile.h:58
Definition: wtap.h:1274
Definition: epan.c:348