From Erwin Rol: update.
[obnox/wireshark/wip.git] / file.h
1 /* file.h
2  * Definitions for file structures and routines
3  *
4  * $Id: file.h,v 1.108 2003/09/24 00:47:36 guy Exp $
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 "wiretap/wtap.h"
29 #include <epan/dfilter/dfilter.h>
30 #include "print.h"
31 #include <errno.h>
32 #include <epan/epan.h>
33
34 #include "cfile.h"
35
36 /* Return values from "cf_read()", "cf_continue_tail()", and
37    "cf_finish_tail()". */
38 typedef enum {
39         READ_SUCCESS,   /* read succeeded */
40         READ_ERROR,     /* read got an error */
41         READ_ABORTED    /* read aborted by user */
42 } read_status_t;
43
44 int  cf_open(char *, gboolean, capture_file *);
45 void cf_close(capture_file *);
46 read_status_t cf_read(capture_file *, int *);
47 int  cf_start_tail(char *, gboolean, capture_file *);
48 read_status_t cf_continue_tail(capture_file *, int, int *);
49 read_status_t cf_finish_tail(capture_file *, int *);
50 /* size_t read_frame_header(capture_file *); */
51 gboolean cf_save(char *, capture_file *, gboolean, gboolean, guint);
52 gchar *cf_get_display_name(capture_file *);
53
54 int filter_packets(capture_file *cf, gchar *dfilter);
55 void reftime_packets(capture_file *);
56 void colorize_packets(capture_file *);
57 void redissect_packets(capture_file *cf);
58 int print_packets(capture_file *cf, print_args_t *print_args);
59 void change_time_formats(capture_file *);
60
61 gboolean find_packet_protocol_tree(capture_file *cf, const char *string);
62 gboolean find_packet_summary_line(capture_file *cf, const char *string);
63 gboolean find_packet_data(capture_file *cf, const guint8 *string,
64                           size_t string_size);
65 gboolean find_packet_dfilter(capture_file *cf, dfilter_t *sfcode);
66
67 guint8 get_int_value(char char_val);
68 gboolean find_ascii(capture_file *cf, char *ascii_text, gboolean ascii_search, char *ftype, gboolean case_type);
69 gboolean find_in_gtk_data(capture_file *cf, gpointer *data, char *ascii_text, gboolean case_type, gboolean search_type);
70 gboolean goto_frame(capture_file *cf, guint fnumber);
71
72 void select_packet(capture_file *, int);
73 void unselect_packet(capture_file *);
74
75 void unselect_field(capture_file *);
76
77 /*
78  * Mark a particular frame in a particular capture.
79  */
80 void mark_frame(capture_file *, frame_data *);
81
82 /*
83  * Unmark a particular frame in a particular capture.
84  */
85 void unmark_frame(capture_file *, frame_data *);
86
87 /* Moves or copies a file. Returns 0 on failure, 1 on success */
88 int file_mv(char *from, char *to);
89
90 /* Copies a file. Returns 0 on failure, 1 on success */
91 int file_cp(char *from, char *to);
92
93 char *file_open_error_message(int, gboolean, int);
94 char *file_read_error_message(int);
95 char *file_write_error_message(int);
96
97 #endif /* file.h */