dcerpc-netlogon: improve NetrLogonGetCapabilities dissection
[wireshark-sm.git] / cfile.h
blob7137cab9bded5f9e93084ebd76f33136ac520892
1 /** @file
3 * capture_file definition & GUI-independent manipulation
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __CFILE_H__
13 #define __CFILE_H__
15 #include <epan/epan.h>
16 #include <epan/column-info.h>
17 #include <epan/dfilter/dfilter.h>
18 #include <epan/frame_data.h>
19 #include <epan/frame_data_sequence.h>
20 #include <wiretap/wtap.h>
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
26 /* Current state of file. */
27 typedef enum {
28 FILE_CLOSED, /* No file open */
29 FILE_READ_PENDING, /* A file to read, but haven't opened it yet */
30 FILE_READ_IN_PROGRESS, /* Reading a file we've opened */
31 FILE_READ_ABORTED, /* Read aborted by user */
32 FILE_READ_DONE /* Read completed */
33 } file_state;
35 /* Requested packets rescan action. */
36 typedef enum {
37 RESCAN_NONE = 0, /* No rescan requested */
38 RESCAN_SCAN, /* Request rescan without full redissection. */
39 RESCAN_REDISSECT /* Request full redissection. */
40 } rescan_type;
42 /* Character set for text search. */
43 typedef enum {
44 SCS_NARROW_AND_WIDE,
45 SCS_NARROW,
46 SCS_WIDE
47 /* add EBCDIC when it's implemented */
48 } search_charset_t;
50 typedef enum {
51 SD_FORWARD,
52 SD_BACKWARD
53 } search_direction;
56 * Packet provider for programs using a capture file.
58 struct packet_provider_data {
59 wtap *wth; /* Wiretap session */
60 const frame_data *ref;
61 frame_data *prev_dis;
62 frame_data *prev_cap;
63 frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
64 GTree *frames_modified_blocks; /* BST with modified blocks for frames (key = frame_data) */
67 typedef struct _capture_file {
68 epan_t *epan;
69 file_state state; /* Current state of capture file */
70 char *filename; /* Name of capture file */
71 char *source; /* Temp file source, e.g. "Pipe from elsewhere" */
72 bool is_tempfile; /* Is capture file a temporary file? */
73 bool unsaved_changes; /* Does the capture file have changes that have not been saved? */
74 bool stop_flag; /* Stop current processing (loading, searching, etc.) */
76 int64_t f_datalen; /* Size of capture file data (uncompressed) */
77 uint16_t cd_t; /* File type of capture file */
78 unsigned int open_type; /* open_routine index+1 used, if selected, or WTAP_TYPE_AUTO */
79 wtap_compression_type compression_type; /* Compression type of the file, or uncompressed */
80 int lnk_t; /* File link-layer type; could be WTAP_ENCAP_PER_PACKET */
81 GArray *linktypes; /* Array of packet link-layer types */
82 uint32_t count; /* Total number of frames */
83 uint64_t packet_comment_count; /* Number of comments in frames (could be >1 per frame... */
84 uint32_t displayed_count; /* Number of displayed frames */
85 uint32_t marked_count; /* Number of marked frames */
86 uint32_t ignored_count; /* Number of ignored frames */
87 uint32_t ref_time_count; /* Number of time referenced frames */
88 bool drops_known; /* true if we know how many packets were dropped */
89 uint32_t drops; /* Dropped packets */
90 nstime_t elapsed_time; /* Elapsed time */
91 int snap; /* Maximum captured packet length; 0 if unknown */
92 dfilter_t *rfcode; /* Compiled read filter program */
93 dfilter_t *dfcode; /* Compiled display filter program */
94 char *dfilter; /* Display filter string */
95 bool redissecting; /* true if currently redissecting (cf_redissect_packets) */
96 bool read_lock; /* true if currently processing a file (cf_read) */
97 rescan_type redissection_queued; /* Queued redissection type. */
98 /* search */
99 char *sfilter; /* Filter, hex value, or string being searched */
100 /* XXX: Some of these booleans should be enums; they're exclusive cases */
101 bool hex; /* true if "Hex value" search was last selected */
102 bool string; /* true if "String" (or "Regex"?) search was last selected */
103 bool summary_data; /* true if "String" search in "Packet list" (Info column) was last selected */
104 bool decode_data; /* true if "String" search in "Packet details" was last selected */
105 bool packet_data; /* true if "String" search in "Packet data" was last selected */
106 uint32_t search_pos; /* Byte position of first byte found in a hex search */
107 uint32_t search_len; /* Length of bytes matching the search */
108 bool case_type; /* true if case-insensitive text search */
109 ws_regex_t *regex; /* Set if regular expression search */
110 search_charset_t scs_type; /* Character set for text search */
111 search_direction dir; /* Direction in which to do searches */
112 bool search_in_progress; /* true if user just clicked OK in the Find dialog or hit <control>N/B */
113 /* packet provider */
114 struct packet_provider_data provider;
115 /* frames */
116 uint32_t first_displayed; /* Frame number of first frame displayed */
117 uint32_t last_displayed; /* Frame number of last frame displayed */
118 /* Data for currently selected frame */
119 column_info cinfo; /* Column formatting information */
120 frame_data *current_frame; /* Frame data */
121 epan_dissect_t *edt; /* Protocol dissection */
122 field_info *finfo_selected; /* Field info */
123 wtap_rec rec; /* Record header */
124 Buffer buf; /* Record data */
126 void * window; /* Top-level window associated with file */
127 unsigned long computed_elapsed; /* Elapsed time to load the file (in msec). */
129 uint32_t cum_bytes;
130 } capture_file;
132 extern void cap_file_init(capture_file *cf);
134 const nstime_t *cap_file_provider_get_frame_ts(struct packet_provider_data *prov, uint32_t frame_num);
135 const char *cap_file_provider_get_interface_name(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
136 const char *cap_file_provider_get_interface_description(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
137 wtap_block_t cap_file_provider_get_modified_block(struct packet_provider_data *prov, const frame_data *fd);
138 void cap_file_provider_set_modified_block(struct packet_provider_data *prov, frame_data *fd, const wtap_block_t new_block);
140 #ifdef __cplusplus
142 #endif /* __cplusplus */
144 #endif /* cfile.h */