Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
/builds/wireshark/wireshark/file.h
Go to the documentation of this file.
1
12#ifndef __FILE_H__
13#define __FILE_H__
14
15#include <wiretap/wtap.h>
16#include <epan/epan.h>
17#include <epan/print.h>
18#include <epan/fifo_string_cache.h>
19#include <ui/packet_range.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
26typedef enum {
30
37
44
51
52typedef enum {
53 cf_cb_file_opened,
54 cf_cb_file_closing,
55 cf_cb_file_closed,
56 cf_cb_file_read_started,
57 cf_cb_file_read_finished,
58 cf_cb_file_reload_started,
59 cf_cb_file_reload_finished,
60 cf_cb_file_rescan_started,
61 cf_cb_file_rescan_finished,
62 cf_cb_file_retap_started,
63 cf_cb_file_retap_finished,
64 cf_cb_file_merge_started, /* Qt only */
65 cf_cb_file_merge_finished, /* Qt only */
66 cf_cb_file_fast_save_finished,
67 cf_cb_file_save_started,
68 cf_cb_file_save_finished,
69 cf_cb_file_save_failed,
70 cf_cb_file_save_stopped
71} cf_cbs;
72
73typedef void (*cf_callback_t) (int event, void *data, void *user_data);
74
75typedef struct {
76 const char *string;
77 size_t string_len;
78 capture_file *cf;
79 field_info *finfo;
80 field_info *prev_finfo;
81 bool frame_matched;
82 bool halt;
84
90extern void
91cf_set_max_records(unsigned max_records);
92
104extern void
105cf_callback_add(cf_callback_t func, void *user_data);
106
114extern void
115cf_callback_remove(cf_callback_t func, void *user_data);
116
127cf_status_t cf_open(capture_file *cf, const char *fname, unsigned int type, bool is_tempfile, int *err);
128
134void cf_close(capture_file *cf);
135
143
151cf_read_status_t cf_read(capture_file *cf, bool reloading);
152
164bool cf_read_record(capture_file *cf, const frame_data *fdata,
165 wtap_rec *rec, Buffer *buf);
166
168bool cf_read_record_no_alert(capture_file *cf, const frame_data *fdata,
169 wtap_rec *rec, Buffer *buf);
170
171
181
193 wtap_rec *rec, Buffer *buf, int *err,
194 fifo_string_cache_t *frame_dup_cache, GChecksum *frame_cksum);
195
202
213 Buffer *buf, int *err,
214 fifo_string_cache_t *frame_dup_cache, GChecksum *frame_cksum);
215
224
232bool cf_can_save(capture_file *cf);
233
241
249
268cf_write_status_t cf_save_records(capture_file * cf, const char *fname,
269 unsigned save_format,
270 wtap_compression_type compression_type,
271 bool discard_comments,
272 bool dont_reopen);
273
289 const char *fname,
290 packet_range_t *range,
291 unsigned save_format,
292 wtap_compression_type compression_type);
293
301
312
320void cf_set_tempfile_source(capture_file *cf, char *source);
321
328const char *cf_get_tempfile_source(capture_file *cf);
329
337
345
349void cf_set_tempfile(capture_file *cf, bool is_tempfile);
350
357void cf_set_drops_known(capture_file *cf, bool drops_known);
358
365void cf_set_drops(capture_file *cf, uint32_t drops);
366
374
381uint32_t cf_get_drops(capture_file *cf);
382
390void cf_set_rfcode(capture_file *cf, dfilter_t *rfcode);
391
400cf_status_t cf_filter_packets(capture_file *cf, char *dfilter, bool force);
401
409
413unsigned long cf_get_computed_elapsed(capture_file *cf);
414
421
429
430/* print_range, enum which frames should be printed */
431typedef enum {
432 print_range_selected_only, /* selected frame(s) only (currently only one) */
433 print_range_marked_only, /* marked frames only */
434 print_range_all_displayed, /* all frames currently displayed */
435 print_range_all_captured /* all frames in capture */
436} print_range_e;
437
438typedef struct {
439 print_stream_t *stream; /* the stream to which we're printing */
440 print_format_e format; /* plain text or PostScript */
441 bool to_file; /* true if we're printing to a file */
442 char *file; /* file output pathname */
443 char *cmd; /* print command string (not win32) */
444 packet_range_t range;
445
446 bool print_summary; /* true if we should print summary line. */
447 bool print_col_headings; /* true if we should print column headings */
448 print_dissections_e print_dissections;
449 bool print_hex; /* true if we should print hex data;
450 * false if we should print only if not dissected. */
451 unsigned hexdump_options; /* Hexdump options if print_hex is true. */
452 bool print_formfeed; /* true if a formfeed should be printed before
453 * each new packet */
455
465 bool show_progress_bar);
466
475
484
493
502
511
522bool cf_find_packet_protocol_tree(capture_file *cf, const char *string,
523 search_direction dir, bool multiple);
524
534
543bool cf_find_packet_summary_line(capture_file *cf, const char *string,
544 search_direction dir);
545
557bool cf_find_packet_data(capture_file *cf, const uint8_t *string,
558 size_t string_size, search_direction dir,
559 bool multiple);
560
571 search_direction dir, bool start_current);
572
581bool
582cf_find_packet_dfilter_string(capture_file *cf, const char *filter,
583 search_direction dir);
584
592bool cf_find_packet_marked(capture_file *cf, search_direction dir);
593
601bool cf_find_packet_time_reference(capture_file *cf, search_direction dir);
602
612bool cf_goto_frame(capture_file *cf, unsigned row, bool exact);
613
623
630void cf_select_packet(capture_file *cf, frame_data *frame);
631
638
645void cf_mark_frame(capture_file *cf, frame_data *frame);
646
653void cf_unmark_frame(capture_file *cf, frame_data *frame);
654
661void cf_ignore_frame(capture_file *cf, frame_data *frame);
662
669void cf_unignore_frame(capture_file *cf, frame_data *frame);
670
685cf_merge_files_to_tempfile(void *pd_window, const char *temp_dir, char **out_filenamep,
686 int in_file_count, const char *const *in_filenames,
687 int file_type, bool do_append);
688
696void cf_update_section_comment(capture_file *cf, char *comment);
697
706void cf_update_section_comments(capture_file *cf, unsigned shb_idx, char **comments);
707
708/*
709 * Get the packet block for a packet (record).
710 * If the block has been edited, it returns the result of the edit,
711 * otherwise it returns the block from the file.
712 *
713 * @param cf the capture file
714 * @param fd the frame_data structure for the frame
715 * @returns A block (use wtap_block_unref to free) or NULL if there is none.
716 */
717wtap_block_t cf_get_packet_block(capture_file *cf, const frame_data *fd);
718
730bool cf_set_modified_block(capture_file *cf, frame_data *fd, const wtap_block_t new_block);
731
738uint32_t cf_comment_types(capture_file *cf);
739
748bool cf_add_ip_name_from_string(capture_file *cf, const char *addr, const char *name);
749
750#ifdef __cplusplus
751}
752#endif /* __cplusplus */
753
754#endif /* file.h */
char * cf_get_basename(capture_file *cf)
Definition file.c:1091
void cf_unmark_frame(capture_file *cf, frame_data *frame)
Definition file.c:4986
cf_print_status_t cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
Definition file.c:3024
bool cf_goto_frame(capture_file *cf, unsigned row, bool exact)
Definition file.c:4775
cf_read_status_t
Definition file.h:32
@ CF_READ_ERROR
Definition file.h:34
@ CF_READ_OK
Definition file.h:33
@ CF_READ_ABORTED
Definition file.h:35
bool cf_find_packet_marked(capture_file *cf, search_direction dir)
Definition file.c:4561
void cf_update_section_comments(capture_file *cf, unsigned shb_idx, char **comments)
Definition file.c:5057
uint32_t cf_comment_types(capture_file *cf)
Definition file.c:5176
cf_status_t cf_reload(capture_file *cf)
Definition file.c:6062
bool cf_has_unsaved_data(capture_file *cf)
Definition file.c:5387
cf_print_status_t cf_print_packets(capture_file *cf, print_args_t *print_args, bool show_progress_bar)
Definition file.c:2656
cf_read_status_t cf_continue_tail(capture_file *cf, volatile int to_read, wtap_rec *rec, Buffer *buf, int *err, fifo_string_cache_t *frame_dup_cache, GChecksum *frame_cksum)
bool cf_find_packet_data(capture_file *cf, const uint8_t *string, size_t string_size, search_direction dir, bool multiple)
Definition file.c:3587
void cf_close(capture_file *cf)
Definition file.c:345
void cf_set_drops_known(capture_file *cf, bool drops_known)
Definition file.c:1184
cf_read_status_t cf_retap_packets(capture_file *cf)
Definition file.c:2354
cf_print_status_t cf_write_psml_packets(capture_file *cf, print_args_t *print_args)
Definition file.c:2940
void cf_set_tempfile_source(capture_file *cf, char *source)
Definition file.c:1138
void cf_reftime_packets(capture_file *cf)
Definition file.c:2100
bool cf_get_drops_known(capture_file *cf)
Definition file.c:1198
uint32_t cf_get_drops(capture_file *cf)
Definition file.c:1205
bool cf_goto_framenum(capture_file *cf)
Definition file.c:4875
bool cf_set_modified_block(capture_file *cf, frame_data *fd, const wtap_block_t new_block)
Definition file.c:5136
bool cf_can_save(capture_file *cf)
Definition file.c:5325
int cf_get_packet_count(capture_file *cf)
Definition file.c:1163
void cf_callback_add(cf_callback_t func, void *user_data)
Definition file.c:183
void cf_ignore_frame(capture_file *cf, frame_data *frame)
Definition file.c:4999
bool cf_find_packet_time_reference(capture_file *cf, search_direction dir)
Definition file.c:4574
cf_read_status_t cf_finish_tail(capture_file *cf, wtap_rec *rec, Buffer *buf, int *err, fifo_string_cache_t *frame_dup_cache, GChecksum *frame_cksum)
cf_status_t cf_merge_files_to_tempfile(void *pd_window, const char *temp_dir, char **out_filenamep, int in_file_count, const char *const *in_filenames, int file_type, bool do_append)
Definition file.c:1481
cf_print_status_t cf_write_pdml_packets(capture_file *cf, print_args_t *print_args)
Definition file.c:2862
cf_print_status_t cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
Definition file.c:3094
bool cf_add_ip_name_from_string(capture_file *cf, const char *addr, const char *name)
Definition file.c:5210
void cf_set_max_records(unsigned max_records)
Definition file.c:149
field_info * cf_find_string_protocol_tree(capture_file *cf, proto_tree *tree)
Definition file.c:3246
bool cf_read_record(capture_file *cf, const frame_data *fdata, wtap_rec *rec, Buffer *buf)
Definition file.c:1620
void cf_mark_frame(capture_file *cf, frame_data *frame)
Definition file.c:4973
void cf_unselect_packet(capture_file *cf)
Definition file.c:4951
unsigned long cf_get_computed_elapsed(capture_file *cf)
Definition file.c:214
bool cf_can_save_as(capture_file *cf)
Definition file.c:5364
bool cf_read_current_record(capture_file *cf)
Definition file.c:1648
const char * cf_get_tempfile_source(capture_file *cf)
Definition file.c:1152
void cf_set_rfcode(capture_file *cf, dfilter_t *rfcode)
Definition file.c:1211
void cf_set_drops(capture_file *cf, uint32_t drops)
Definition file.c:1191
bool cf_find_packet_summary_line(capture_file *cf, const char *string, search_direction dir)
Definition file.c:3479
void cf_fake_continue_tail(capture_file *cf)
cf_print_status_t cf_write_json_packets(capture_file *cf, print_args_t *print_args)
Definition file.c:3163
void cf_set_tempfile(capture_file *cf, bool is_tempfile)
Definition file.c:1176
cf_read_status_t cf_read(capture_file *cf, bool reloading)
Definition file.c:482
char * cf_get_display_name(capture_file *cf)
Definition file.c:1065
bool cf_is_tempfile(capture_file *cf)
Definition file.c:1170
cf_write_status_t cf_export_specified_packets(capture_file *cf, const char *fname, packet_range_t *range, unsigned save_format, wtap_compression_type compression_type)
Definition file.c:5927
cf_status_t
Definition file.h:26
@ CF_ERROR
Definition file.h:28
@ CF_OK
Definition file.h:27
cf_status_t cf_open(capture_file *cf, const char *fname, unsigned int type, bool is_tempfile, int *err)
Definition file.c:241
cf_status_t cf_filter_packets(capture_file *cf, char *dfilter, bool force)
Definition file.c:1517
void cf_callback_remove(cf_callback_t func, void *user_data)
Definition file.c:195
void cf_unignore_frame(capture_file *cf, frame_data *frame)
Definition file.c:5012
bool cf_find_packet_protocol_tree(capture_file *cf, const char *string, search_direction dir, bool multiple)
Definition file.c:3220
bool cf_can_write_with_wiretap(capture_file *cf)
Definition file.c:5296
void cf_update_section_comment(capture_file *cf, char *comment)
Definition file.c:5025
cf_write_status_t cf_save_records(capture_file *cf, const char *fname, unsigned save_format, wtap_compression_type compression_type, bool discard_comments, bool dont_reopen)
Definition file.c:5573
bool cf_find_packet_dfilter(capture_file *cf, dfilter_t *sfcode, search_direction dir, bool start_current)
Definition file.c:4504
void cf_redissect_packets(capture_file *cf)
Definition file.c:1594
cf_print_status_t
Definition file.h:46
@ CF_PRINT_OPEN_ERROR
Definition file.h:48
@ CF_PRINT_WRITE_ERROR
Definition file.h:49
@ CF_PRINT_OK
Definition file.h:47
void cf_select_packet(capture_file *cf, frame_data *frame)
Definition file.c:4899
cf_write_status_t
Definition file.h:39
@ CF_WRITE_OK
Definition file.h:40
@ CF_WRITE_ERROR
Definition file.h:41
@ CF_WRITE_ABORTED
Definition file.h:42
bool cf_read_record_no_alert(capture_file *cf, const frame_data *fdata, wtap_rec *rec, Buffer *buf)
Definition file.c:1634
bool cf_find_packet_dfilter_string(capture_file *cf, const char *filter, search_direction dir)
Definition file.c:4511
Definition cfile.h:67
Definition proto.h:903
Definition buffer.h:22
Definition dfilter-int.h:35
Definition proto.h:813
Definition fifo_string_cache.h:24
Definition file.h:75
Definition packet_range.h:39
Definition file.h:438
Definition print_stream.h:43
Definition stream.c:41
Definition wtap_opttypes.c:85
Definition wtap.h:1432