remove #include "globals.h" and access to global cfile, use access functions and...
[obnox/wireshark/wip.git] / file.h
1 /* file.h
2  * Definitions for file structures and routines
3  *
4  * $Id$
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __FILE_H__
26 #define __FILE_H__
27
28 #include "packet-range.h"
29 #include "wiretap/wtap.h"
30 #include <epan/dfilter/dfilter.h>
31 #include "print.h"
32 #include <errno.h>
33 #include <epan/epan.h>
34
35 #include "cfile.h"
36
37 /* Return values from "cf_read()", "cf_continue_tail()", and
38    "cf_finish_tail()". */
39 typedef enum {
40         READ_SUCCESS,   /* read succeeded */
41         READ_ERROR,     /* read got an error */
42         READ_ABORTED    /* read aborted by user */
43 } read_status_t;
44
45 int  cf_open(char *, gboolean, capture_file *);
46 void cf_close(capture_file *);
47 void cf_reload(void);
48 read_status_t cf_read(capture_file *);
49 int  cf_start_tail(char *, gboolean, capture_file *);
50 read_status_t cf_continue_tail(capture_file *, int, int *);
51 read_status_t cf_finish_tail(capture_file *, int *);
52 /* size_t read_frame_header(capture_file *); */
53 gboolean cf_save(char *fname, capture_file * cf, packet_range_t *range, guint save_format);
54 const gchar *cf_get_display_name(capture_file *);
55 int cf_packet_count(capture_file *cf);
56 gboolean cf_is_tempfile(capture_file *cf);
57 void cf_set_drops_known(capture_file *cf, gboolean drops_known);
58 void cf_set_drops(capture_file *cf, guint32 drops);
59 gchar *cf_get_iface(capture_file *cf);
60 void cf_set_rfcode(capture_file *cf, dfilter_t *rfcode);
61 gchar *cf_get_cfilter(capture_file *cf);
62
63 gboolean
64 cf_merge_files(const char *out_filename, int out_fd, int in_file_count,
65                char *const *in_filenames, int file_type, gboolean do_append);
66
67 gboolean filter_packets(capture_file *cf, gchar *dfilter, gboolean force);
68 void reftime_packets(capture_file *);
69 void colorize_packets(capture_file *);
70 void redissect_packets(capture_file *cf);
71 int retap_packets(capture_file *cf);
72 typedef enum {
73         PP_OK,
74         PP_OPEN_ERROR,
75         PP_WRITE_ERROR
76 } pp_return_t;
77 pp_return_t print_packets(capture_file *cf, print_args_t *print_args);
78 pp_return_t write_pdml_packets(capture_file *cf, print_args_t *print_args);
79 pp_return_t write_psml_packets(capture_file *cf, print_args_t *print_args);
80
81 void change_time_formats(capture_file *);
82
83 gboolean find_packet_protocol_tree(capture_file *cf, const char *string);
84 gboolean find_packet_summary_line(capture_file *cf, const char *string);
85 gboolean find_packet_data(capture_file *cf, const guint8 *string,
86                           size_t string_size);
87 gboolean find_packet_dfilter(capture_file *cf, dfilter_t *sfcode);
88
89 guint8 get_int_value(char char_val);
90 gboolean find_ascii(capture_file *cf, char *ascii_text, gboolean ascii_search, char *ftype, gboolean case_type);
91 gboolean find_in_gtk_data(capture_file *cf, gpointer *data, char *ascii_text, gboolean case_type, gboolean search_type);
92 gboolean goto_frame(capture_file *cf, guint fnumber);
93 gboolean goto_bottom_frame(capture_file *cf);
94 gboolean goto_top_frame(capture_file *cf);
95 void goto_framenum(capture_file *cf);
96
97
98 void select_packet(capture_file *, int);
99 void unselect_packet(capture_file *);
100
101 void unselect_field(capture_file *);
102
103 /*
104  * Mark a particular frame in a particular capture.
105  */
106 void mark_frame(capture_file *, frame_data *);
107
108 /*
109  * Unmark a particular frame in a particular capture.
110  */
111 void unmark_frame(capture_file *, frame_data *);
112
113 /* Moves or copies a file. Returns 0 on failure, 1 on success */
114 int file_mv(char *from, char *to);
115
116 /* Copies a file. Returns 0 on failure, 1 on success */
117 int file_cp(char *from, char *to);
118
119 char *cf_read_error_message(int, gchar *);
120
121 #endif /* file.h */