Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
cfile.h
Go to the documentation of this file.
1
11#pragma once
12#include <epan/epan.h>
13#include <epan/column-info.h>
15#include <epan/frame_data.h>
17
18#include <wiretap/wtap.h>
19
20#include <wsutil/file_compressed.h>
21#include <wsutil/buffer.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
37
38
47
48
52typedef enum {
56 /* add EBCDIC when it's implemented */
58
59
67
68
80
84typedef struct _capture_file {
85 epan_t *epan;
86 file_state state; /* Current state of capture file */
87 char *filename; /* Name of capture file */
88 char *source; /* Temp file source, e.g. "Pipe from elsewhere" */
89 bool is_tempfile; /* Is capture file a temporary file? */
90 bool unsaved_changes; /* Does the capture file have changes that have not been saved? */
91 bool stop_flag; /* Stop current processing (loading, searching, etc.) */
92
93 int64_t f_datalen; /* Size of capture file data (uncompressed) */
94 uint16_t cd_t; /* File type of capture file */
95 unsigned int open_type; /* open_routine index+1 used, if selected, or WTAP_TYPE_AUTO */
96 ws_compression_type compression_type; /* Compression type of the file, or uncompressed */
97 int lnk_t; /* File link-layer type; could be WTAP_ENCAP_PER_PACKET */
98 GArray *linktypes; /* Array of packet link-layer types */
99 uint32_t count; /* Total number of frames */
100 uint64_t packet_comment_count; /* Number of comments in frames (could be >1 per frame... */
101 uint32_t displayed_count; /* Number of displayed frames */
102 uint32_t aggregation_count; /* Number of frames shown in Aggregation View */
103 uint32_t marked_count; /* Number of marked frames */
104 uint32_t ignored_count; /* Number of ignored frames */
105 uint32_t ref_time_count; /* Number of time referenced frames */
106 bool drops_known; /* true if we know how many packets were dropped */
107 uint32_t drops; /* Dropped packets */
108 nstime_t elapsed_time; /* Elapsed time */
109 int snap; /* Maximum captured packet length; 0 if unknown */
110 dfilter_t *rfcode; /* Compiled read filter program */
111 dfilter_t *dfcode; /* Compiled display filter program */
112 char *dfilter; /* Display filter string */
113 bool redissecting; /* true if currently redissecting (cf_redissect_packets) */
114 bool read_lock; /* true if currently processing a file (cf_read) */
115 rescan_type redissection_queued; /* Queued redissection type. */
116 /* search */
117 char *sfilter; /* Filter, hex value, or string being searched */
118 /* XXX: Some of these booleans should be enums; they're exclusive cases */
119 bool hex; /* true if "Hex value" search was last selected */
120 bool string; /* true if "String" (or "Regex"?) search was last selected */
121 bool summary_data; /* true if "String" search in "Packet list" (Info column) was last selected */
122 bool decode_data; /* true if "String" search in "Packet details" was last selected */
123 bool packet_data; /* true if "String" search in "Packet data" was last selected */
124 uint32_t search_pos; /* Byte position of first byte found in a hex search */
125 uint32_t search_len; /* Length of bytes matching the search */
126 bool case_type; /* true if case-insensitive text search */
127 ws_regex_t *regex; /* Set if regular expression search */
128 search_charset_t scs_type; /* Character set for text search */
129 search_direction dir; /* Direction in which to do searches */
130 bool search_in_progress; /* true if user just clicked OK in the Find dialog or hit <control>N/B */
131 /* packet provider */
132 struct packet_provider_data provider;
133 /* frames */
134 uint32_t first_displayed; /* Frame number of first frame displayed */
135 uint32_t last_displayed; /* Frame number of last frame displayed */
136 /* Data for currently selected frame */
137 column_info cinfo; /* Column formatting information */
138 frame_data *current_frame; /* Frame data */
139 epan_dissect_t *edt; /* Protocol dissection */
140 field_info *finfo_selected; /* Field info */
141 wtap_rec rec; /* Record header */
142 Buffer buf; /* Record data */
143
144 void * window; /* Top-level window associated with file */
145 unsigned long computed_elapsed; /* Elapsed time to load the file (in msec). */
146
147 uint32_t cum_bytes;
149
155WS_DLL_PUBLIC void cap_file_init(capture_file *cf);
156
164WS_DLL_PUBLIC const nstime_t *cap_file_provider_get_frame_ts(struct packet_provider_data *prov, uint32_t frame_num);
165
172WS_DLL_PUBLIC const nstime_t *cap_file_provider_get_start_ts(struct packet_provider_data *prov);
173
180WS_DLL_PUBLIC const nstime_t *cap_file_provider_get_end_ts(struct packet_provider_data *prov);
181
190WS_DLL_PUBLIC const char *cap_file_provider_get_interface_name(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
191
200WS_DLL_PUBLIC const char *cap_file_provider_get_interface_description(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
201
210WS_DLL_PUBLIC int32_t cap_file_provider_get_process_id(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
211
220WS_DLL_PUBLIC const char *cap_file_provider_get_process_name(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
221
231WS_DLL_PUBLIC const uint8_t *cap_file_provider_get_process_uuid(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number, size_t *uuid_size);
232
241
251WS_DLL_PUBLIC void cap_file_provider_set_modified_block(struct packet_provider_data *prov, frame_data *fd, const wtap_block_t new_block);
252
253#ifdef __cplusplus
254}
255#endif /* __cplusplus */
struct _capture_file capture_file
Represents a capture file and its associated metadata.
WS_DLL_PUBLIC const nstime_t * cap_file_provider_get_end_ts(struct packet_provider_data *prov)
Get the end timestamp of a capture file.
Definition file_packet_provider.c:43
WS_DLL_PUBLIC int32_t cap_file_provider_get_process_id(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number)
Retrieves the process ID associated with a given process information ID and section number.
Definition file_packet_provider.c:222
WS_DLL_PUBLIC const nstime_t * cap_file_provider_get_frame_ts(struct packet_provider_data *prov, uint32_t frame_num)
Get the timestamp of a frame.
Definition file_packet_provider.c:19
WS_DLL_PUBLIC const char * cap_file_provider_get_interface_description(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number)
Retrieves a description for a network interface from a capture file.
Definition file_packet_provider.c:87
WS_DLL_PUBLIC const char * cap_file_provider_get_interface_name(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number)
Retrieves the name of a network interface from a capture file.
Definition file_packet_provider.c:60
rescan_type
Requested packet rescan action to be performed on the current capture.
Definition cfile.h:42
@ RESCAN_REDISSECT
Definition cfile.h:45
@ RESCAN_SCAN
Definition cfile.h:44
@ RESCAN_NONE
Definition cfile.h:43
WS_DLL_PUBLIC wtap_block_t cap_file_provider_get_modified_block(struct packet_provider_data *prov, const frame_data *fd)
Get a modified block for a frame from the packet provider.
Definition file_packet_provider.c:255
search_direction
Direction of a packet search through the capture.
Definition cfile.h:63
@ SD_FORWARD
Definition cfile.h:64
@ SD_BACKWARD
Definition cfile.h:65
WS_DLL_PUBLIC const char * cap_file_provider_get_process_name(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number)
Retrieves the name of a process from a capture file.
Definition file_packet_provider.c:233
WS_DLL_PUBLIC const nstime_t * cap_file_provider_get_start_ts(struct packet_provider_data *prov)
Get the start timestamp of a capture file.
Definition file_packet_provider.c:37
search_charset_t
Character width filter for text search operations.
Definition cfile.h:52
@ SCS_NARROW
Definition cfile.h:54
@ SCS_WIDE
Definition cfile.h:55
@ SCS_NARROW_AND_WIDE
Definition cfile.h:53
WS_DLL_PUBLIC const uint8_t * cap_file_provider_get_process_uuid(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number, size_t *uuid_size)
Retrieves the UUID of a process from a capture file.
Definition file_packet_provider.c:244
file_state
Lifecycle state of a capture file.
Definition cfile.h:30
@ FILE_READ_PENDING
Definition cfile.h:32
@ FILE_CLOSED
Definition cfile.h:31
@ FILE_READ_IN_PROGRESS
Definition cfile.h:33
@ FILE_READ_ABORTED
Definition cfile.h:34
@ FILE_READ_DONE
Definition cfile.h:35
WS_DLL_PUBLIC void cap_file_provider_set_modified_block(struct packet_provider_data *prov, frame_data *fd, const wtap_block_t new_block)
Set a modified block for a frame in the packet provider.
Definition file_packet_provider.c:265
WS_DLL_PUBLIC void cap_file_init(capture_file *cf)
Initialize a capture file structure.
Definition cfile.c:20
DIAG_OFF_PEDANTIC struct _frame_data frame_data
Frame data structure.
Represents a capture file and its associated metadata.
Definition cfile.h:84
Definition frame_data_sequence.c:32
Definition regex.c:17
A dynamic byte buffer with adjustable start and end positions.
Definition buffer.h:30
Definition column-info.h:59
The compiled display filter object passed back to the user.
Definition dfilter-int.h:46
Holds all state for the dissection of a single byte array, including session, buffer,...
Definition epan_dissect.h:28
Definition epan.c:532
Definition proto.h:817
Definition nstime.h:26
Packet provider context for programs operating on a capture file.
Definition cfile.h:72
frame_data * prev_dis
Definition cfile.h:75
wtap * wth
Definition cfile.h:73
frame_data_sequence * frames
Definition cfile.h:77
GTree * frames_modified_blocks
Definition cfile.h:78
frame_data * prev_cap
Definition cfile.h:76
const frame_data * ref
Definition cfile.h:74
Definition wtap_opttypes.h:272
Definition wtap.h:1540
Definition wtap_module.h:58