Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
cfile.h
Go to the documentation of this file.
1
12#ifndef __CFILE_H__
13#define __CFILE_H__
14
15#include <epan/epan.h>
16#include <epan/column-info.h>
18#include <epan/frame_data.h>
20
21#include <wiretap/wtap.h>
22
23#include <wsutil/file_compressed.h>
24#include <wsutil/buffer.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30/* Current state of file. */
31typedef enum {
32 FILE_CLOSED, /* No file open */
33 FILE_READ_PENDING, /* A file to read, but haven't opened it yet */
34 FILE_READ_IN_PROGRESS, /* Reading a file we've opened */
35 FILE_READ_ABORTED, /* Read aborted by user */
36 FILE_READ_DONE /* Read completed */
37} file_state;
38
39/* Requested packets rescan action. */
40typedef enum {
41 RESCAN_NONE = 0, /* No rescan requested */
42 RESCAN_SCAN, /* Request rescan without full redissection. */
43 RESCAN_REDISSECT /* Request full redissection. */
44} rescan_type;
45
46/* Character set for text search. */
47typedef enum {
48 SCS_NARROW_AND_WIDE,
49 SCS_NARROW,
50 SCS_WIDE
51 /* add EBCDIC when it's implemented */
52} search_charset_t;
53
54typedef enum {
55 SD_FORWARD,
56 SD_BACKWARD
57} search_direction;
58
59/*
60 * Packet provider for programs using a capture file.
61 */
63 wtap *wth; /* Wiretap session */
64 const frame_data *ref;
65 frame_data *prev_dis;
66 frame_data *prev_cap;
67 frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
68 GTree *frames_modified_blocks; /* BST with modified blocks for frames (key = frame_data) */
69};
70
71typedef struct _capture_file {
72 epan_t *epan;
73 file_state state; /* Current state of capture file */
74 char *filename; /* Name of capture file */
75 char *source; /* Temp file source, e.g. "Pipe from elsewhere" */
76 bool is_tempfile; /* Is capture file a temporary file? */
77 bool unsaved_changes; /* Does the capture file have changes that have not been saved? */
78 bool stop_flag; /* Stop current processing (loading, searching, etc.) */
79
80 int64_t f_datalen; /* Size of capture file data (uncompressed) */
81 uint16_t cd_t; /* File type of capture file */
82 unsigned int open_type; /* open_routine index+1 used, if selected, or WTAP_TYPE_AUTO */
83 ws_compression_type compression_type; /* Compression type of the file, or uncompressed */
84 int lnk_t; /* File link-layer type; could be WTAP_ENCAP_PER_PACKET */
85 GArray *linktypes; /* Array of packet link-layer types */
86 uint32_t count; /* Total number of frames */
87 uint64_t packet_comment_count; /* Number of comments in frames (could be >1 per frame... */
88 uint32_t displayed_count; /* Number of displayed frames */
89 uint32_t marked_count; /* Number of marked frames */
90 uint32_t ignored_count; /* Number of ignored frames */
91 uint32_t ref_time_count; /* Number of time referenced frames */
92 bool drops_known; /* true if we know how many packets were dropped */
93 uint32_t drops; /* Dropped packets */
94 nstime_t elapsed_time; /* Elapsed time */
95 int snap; /* Maximum captured packet length; 0 if unknown */
96 dfilter_t *rfcode; /* Compiled read filter program */
97 dfilter_t *dfcode; /* Compiled display filter program */
98 char *dfilter; /* Display filter string */
99 bool redissecting; /* true if currently redissecting (cf_redissect_packets) */
100 bool read_lock; /* true if currently processing a file (cf_read) */
101 rescan_type redissection_queued; /* Queued redissection type. */
102 /* search */
103 char *sfilter; /* Filter, hex value, or string being searched */
104 /* XXX: Some of these booleans should be enums; they're exclusive cases */
105 bool hex; /* true if "Hex value" search was last selected */
106 bool string; /* true if "String" (or "Regex"?) search was last selected */
107 bool summary_data; /* true if "String" search in "Packet list" (Info column) was last selected */
108 bool decode_data; /* true if "String" search in "Packet details" was last selected */
109 bool packet_data; /* true if "String" search in "Packet data" was last selected */
110 uint32_t search_pos; /* Byte position of first byte found in a hex search */
111 uint32_t search_len; /* Length of bytes matching the search */
112 bool case_type; /* true if case-insensitive text search */
113 ws_regex_t *regex; /* Set if regular expression search */
114 search_charset_t scs_type; /* Character set for text search */
115 search_direction dir; /* Direction in which to do searches */
116 bool search_in_progress; /* true if user just clicked OK in the Find dialog or hit <control>N/B */
117 /* packet provider */
118 struct packet_provider_data provider;
119 /* frames */
120 uint32_t first_displayed; /* Frame number of first frame displayed */
121 uint32_t last_displayed; /* Frame number of last frame displayed */
122 /* Data for currently selected frame */
123 column_info cinfo; /* Column formatting information */
124 frame_data *current_frame; /* Frame data */
125 epan_dissect_t *edt; /* Protocol dissection */
126 field_info *finfo_selected; /* Field info */
127 wtap_rec rec; /* Record header */
128 Buffer buf; /* Record data */
129
130 void * window; /* Top-level window associated with file */
131 unsigned long computed_elapsed; /* Elapsed time to load the file (in msec). */
132
133 uint32_t cum_bytes;
135
141WS_DLL_PUBLIC void cap_file_init(capture_file *cf);
142
143WS_DLL_PUBLIC const nstime_t *cap_file_provider_get_frame_ts(struct packet_provider_data *prov, uint32_t frame_num);
144
145WS_DLL_PUBLIC const nstime_t *cap_file_provider_get_start_ts(struct packet_provider_data *prov);
146
153WS_DLL_PUBLIC const nstime_t *cap_file_provider_get_end_ts(struct packet_provider_data *prov);
154
163WS_DLL_PUBLIC const char *cap_file_provider_get_interface_name(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
164
173WS_DLL_PUBLIC const char *cap_file_provider_get_interface_description(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
174
183WS_DLL_PUBLIC int32_t cap_file_provider_get_process_id(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
184
185WS_DLL_PUBLIC const char *cap_file_provider_get_process_name(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
186
196WS_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);
197
198WS_DLL_PUBLIC wtap_block_t cap_file_provider_get_modified_block(struct packet_provider_data *prov, const frame_data *fd);
199
209WS_DLL_PUBLIC void cap_file_provider_set_modified_block(struct packet_provider_data *prov, frame_data *fd, const wtap_block_t new_block);
210
211#ifdef __cplusplus
212}
213#endif /* __cplusplus */
214
215#endif /* cfile.h */
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 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
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
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
Definition cfile.h:71
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:62
Definition dfilter-int.h:35
Definition epan_dissect.h:28
Definition epan.c:502
Definition proto.h:814
Definition nstime.h:26
Definition cfile.h:62
Definition wtap_opttypes.h:272
Definition wtap.h:1512
Definition wtap_module.h:58