Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

/home/wireshark/builders/wireshark-master/ubuntu-16.04-x64/build/file.h
1 /* file.h
2 * Definitions for file structures and routines
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 __FILE_H__
12 #define __FILE_H__
13
14 #include <errno.h>
15
16 #include <wiretap/wtap.h>
17 #include <epan/epan.h>
18 #include <epan/print.h>
19 #include <ui/packet_range.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24
26 typedef enum {
27 CF_OK,
28 CF_ERROR
29 } cf_status_t;
30
32 typedef enum {
33 CF_READ_OK,
34 CF_READ_ERROR,
35 CF_READ_ABORTED
36 } cf_read_status_t;
37
39 typedef enum {
40 CF_WRITE_OK,
41 CF_WRITE_ERROR,
42 CF_WRITE_ABORTED
43 } cf_write_status_t;
44
46 typedef enum {
47 CF_PRINT_OK,
48 CF_PRINT_OPEN_ERROR,
49 CF_PRINT_WRITE_ERROR
50 } cf_print_status_t;
51
52 typedef 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
73 typedef void (*cf_callback_t) (gint event, gpointer data, gpointer user_data);
74
75 typedef struct {
76 const char *string;
77 size_t string_len;
78 capture_file *cf;
79 gboolean frame_matched;
80 field_info *finfo;
81 } match_data;
82
94 extern void
95 cf_callback_add(cf_callback_t func, gpointer user_data);
96
104 extern void
105 cf_callback_remove(cf_callback_t func, gpointer user_data);
106
117 cf_status_t cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_tempfile, int *err);
118
124 void cf_close(capture_file *cf);
125
131 void cf_reload(capture_file *cf);
132
140 cf_read_status_t cf_read(capture_file *cf, gboolean from_save);
141
153 gboolean cf_read_record_r(capture_file *cf, const frame_data *fdata,
154 wtap_rec *rec, Buffer *buf);
155
165 gboolean cf_read_record(capture_file *cf, frame_data *fdata);
166
175 cf_read_status_t cf_continue_tail(capture_file *cf, volatile int to_read, int *err);
176
182 void cf_fake_continue_tail(capture_file *cf);
183
191 cf_read_status_t cf_finish_tail(capture_file *cf, int *err);
192
200 gboolean cf_can_write_with_wiretap(capture_file *cf);
201
209 gboolean cf_can_save(capture_file *cf);
210
217 gboolean cf_can_save_as(capture_file *cf);
218
225 gboolean cf_has_unsaved_data(capture_file *cf);
226
245 cf_write_status_t cf_save_records(capture_file * cf, const char *fname,
246 guint save_format, gboolean compressed,
247 gboolean discard_comments,
248 gboolean dont_reopen);
249
264 cf_write_status_t cf_export_specified_packets(capture_file *cf,
265 const char *fname,
266 packet_range_t *range,
267 guint save_format,
268 gboolean compressed);
269
276 gchar *cf_get_display_name(capture_file *cf);
277
285 void cf_set_tempfile_source(capture_file *cf, gchar *source);
286
293 const gchar *cf_get_tempfile_source(capture_file *cf);
294
301 int cf_get_packet_count(capture_file *cf);
302
309 gboolean cf_is_tempfile(capture_file *cf);
310
314 void cf_set_tempfile(capture_file *cf, gboolean is_tempfile);
315
322 void cf_set_drops_known(capture_file *cf, gboolean drops_known);
323
330 void cf_set_drops(capture_file *cf, guint32 drops);
331
338 gboolean cf_get_drops_known(capture_file *cf);
339
346 guint32 cf_get_drops(capture_file *cf);
347
355 void cf_set_rfcode(capture_file *cf, dfilter_t *rfcode);
356
365 cf_status_t cf_filter_packets(capture_file *cf, gchar *dfilter, gboolean force);
366
372 void cf_reftime_packets(capture_file *cf);
373
377 gulong cf_get_computed_elapsed(capture_file *cf);
378
384 void cf_redissect_packets(capture_file *cf);
385
392 cf_read_status_t cf_retap_packets(capture_file *cf);
393
399 void cf_timestamp_auto_precision(capture_file *cf);
400
401 /* print_range, enum which frames should be printed */
402 typedef enum {
403 print_range_selected_only, /* selected frame(s) only (currently only one) */
404 print_range_marked_only, /* marked frames only */
405 print_range_all_displayed, /* all frames currently displayed */
406 print_range_all_captured /* all frames in capture */
407 } print_range_e;
408
409 typedef struct {
410 print_stream_t *stream; /* the stream to which we're printing */
411 print_format_e format; /* plain text or PostScript */
412 gboolean to_file; /* TRUE if we're printing to a file */
413 char *file; /* file output pathname */
414 char *cmd; /* print command string (not win32) */
415 packet_range_t range;
416
417 gboolean print_summary; /* TRUE if we should print summary line. */
418 gboolean print_col_headings; /* TRUE if we should print column headings */
419 print_dissections_e print_dissections;
420 gboolean print_hex; /* TRUE if we should print hex data;
421 * FALSE if we should print only if not dissected. */
422 gboolean print_formfeed; /* TRUE if a formfeed should be printed before
423 * each new packet */
424 } print_args_t;
425
434 cf_print_status_t cf_print_packets(capture_file *cf, print_args_t *print_args,
435 gboolean show_progress_bar);
436
444 cf_print_status_t cf_write_pdml_packets(capture_file *cf, print_args_t *print_args);
445
453 cf_print_status_t cf_write_psml_packets(capture_file *cf, print_args_t *print_args);
454
462 cf_print_status_t cf_write_csv_packets(capture_file *cf, print_args_t *print_args);
463
471 cf_print_status_t cf_write_carrays_packets(capture_file *cf, print_args_t *print_args);
472
480 cf_print_status_t cf_write_json_packets(capture_file *cf, print_args_t *print_args);
481
490 gboolean cf_find_packet_protocol_tree(capture_file *cf, const char *string,
491 search_direction dir);
492
501 extern gboolean cf_find_string_protocol_tree(capture_file *cf, proto_tree *tree,
502 match_data *mdata);
503
512 gboolean cf_find_packet_summary_line(capture_file *cf, const char *string,
513 search_direction dir);
514
524 gboolean cf_find_packet_data(capture_file *cf, const guint8 *string,
525 size_t string_size, search_direction dir);
526
535 gboolean cf_find_packet_dfilter(capture_file *cf, dfilter_t *sfcode,
536 search_direction dir);
537
546 gboolean
547 cf_find_packet_dfilter_string(capture_file *cf, const char *filter,
548 search_direction dir);
549
557 gboolean cf_find_packet_marked(capture_file *cf, search_direction dir);
558
566 gboolean cf_find_packet_time_reference(capture_file *cf, search_direction dir);
567
575 gboolean cf_goto_frame(capture_file *cf, guint row);
576
585 gboolean cf_goto_framenum(capture_file *cf);
586
593 void cf_select_packet(capture_file *cf, int row);
594
600 void cf_unselect_packet(capture_file *cf);
601
608 void cf_mark_frame(capture_file *cf, frame_data *frame);
609
616 void cf_unmark_frame(capture_file *cf, frame_data *frame);
617
624 void cf_ignore_frame(capture_file *cf, frame_data *frame);
625
632 void cf_unignore_frame(capture_file *cf, frame_data *frame);
633
647 cf_status_t
648 cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep,
649 int in_file_count, char *const *in_filenames,
650 int file_type, gboolean do_append);
651
652
659 const gchar* cf_read_section_comment(capture_file *cf);
660
668 void cf_update_section_comment(capture_file *cf, gchar *comment);
669
670 /*
671 * Get the comment on a packet (record).
672 * If the comment has been edited, it returns the result of the edit,
673 * otherwise it returns the comment from the file.
674 *
675 * @param cf the capture file
676 * @param fd the frame_data structure for the frame
677 */
678 char *cf_get_packet_comment(capture_file *cf, const frame_data *fd);
679
687 gboolean cf_set_user_packet_comment(capture_file *cf, frame_data *fd, const gchar *new_comment);
688
695 guint32 cf_comment_types(capture_file *cf);
696
705 gboolean cf_add_ip_name_from_string(capture_file *cf, const char *addr, const char *name);
706
707 #ifdef __cplusplus
708 }
709 #endif /* __cplusplus */
710
711 #endif /* file.h */
712
713 /*
714 * Editor modelines - http://www.wireshark.org/tools/modelines.html
715 *
716 * Local variables:
717 * c-basic-offset: 4
718 * tab-width: 8
719 * indent-tabs-mode: nil
720 * End:
721 *
722 * vi: set shiftwidth=4 tabstop=8 expandtab:
723 * :indentSize=4:tabSize=8:noTabs=true:
724 */
match_data
Definition: file.h:75
print_stream
Definition: print_stream.h:42
Buffer
Definition: buffer.h:21
field_info
Definition: proto.h:673
epan_dfilter
Definition: dfilter-int.h:19
_frame_data
Definition: frame_data.h:53
stream
Definition: stream.c:40
packet_range_tag
Definition: packet_range.h:38
_proto_node
Definition: proto.h:759
_capture_file
Definition: cfile.h:58
wtap_rec
Definition: wtap.h:1274
print_args_t
Definition: file.h:409