get rid of some compiler warnings for X509AF
[obnox/wireshark/wip.git] / merge.h
1 /* merge.h
2  * Definitions for menu routines with toolkit-independent APIs but
3  * toolkit-dependent implementations.
4  *
5  * $Id$
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __MERGE_H__
27 #define __MERGE_H__
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 /**
34  * Structures to manage our input files.
35  */
36 typedef struct merge_in_file_s {
37   const char *filename;
38   wtap       *wth;
39   int         err;
40   gchar      *err_info;
41   long        data_offset;
42   gboolean    ok;
43 } merge_in_file_t;
44
45 /**
46  * Structures to manage our output file.
47  */
48 typedef struct merge_out_file_s {
49   int          fd;
50   wtap_dumper *pdh;
51   int          file_type;
52   int          frame_type;
53   unsigned int snaplen;
54   int          count;
55 } merge_out_file_t;
56
57 /** Verbosity levels. */
58 typedef enum {
59     VERBOSE_NONE,
60     VERBOSE_ERRORS,
61     VERBOSE_ALL
62 } verbose_e;
63
64 /** Current verbosity level, default is VERBOSE_NONE. */
65 extern int merge_verbose;
66
67 /** Open a number of input files to merge.
68  * 
69  * @param in_file_count number of entries in in_file_names and in_files
70  * @param in_file_names filenames of the input files
71  * @param in_files input file array to be filled (>= sizeof(merge_in_file_t) * in_file_count)
72  * @param err wiretap error, if failed
73  * @return number of opened input files
74  */
75 extern int
76 merge_open_in_files(int in_file_count, char *in_file_names[], merge_in_file_t *in_files[], int *err);
77
78 /** Close the input files again.
79  * 
80  * @param in_file_count number of entries in in_files
81  * @param in_files input file array to be closed
82  */
83 extern void
84 merge_close_in_files(int in_file_count, merge_in_file_t in_files[]);
85
86 /** Open the output file.
87  * 
88  * @param out_file the prefilled output file array
89  * @param snapshot_len the snapshot length of the output file
90  * @param err wiretap error, if failed
91  * @return TRUE, if the output file could be opened
92  */
93 extern gboolean
94 merge_open_outfile(merge_out_file_t *out_file, int snapshot_len, int *err);
95
96 /** Close the output file again.
97  * 
98  * @param out_file the output file array
99  */
100 extern void
101 merge_close_outfile(merge_out_file_t *out_file);
102
103 /** Try to get the frame type from the input files.
104  * 
105  * @param in_file_count number of entries in in_files
106  * @param in_files input file array
107  * @return the frame type
108  */
109 extern int
110 merge_select_frame_type(int in_file_count, merge_in_file_t in_files[]);
111
112 /** Try to get the snapshot length from the input files.
113  * 
114  * @param in_file_count number of entries in in_files
115  * @param in_files input file array
116  * @return the snapshot length
117  */
118 extern int
119 merge_max_snapshot_length(int in_file_count, merge_in_file_t in_files[]);
120
121 /** Merge the packets from the input files into the output file sorted chronologically.
122  * 
123  * @param in_file_count number of entries in in_files
124  * @param in_files input file array
125  * @param out_file the output file array
126  * @param err wiretap error, if failed
127  * @return TRUE if function succeeded
128  */
129 extern gboolean
130 merge_files(int in_file_count, merge_in_file_t in_files[], merge_out_file_t *out_file, int *err);
131
132 /** Append the packets from the input files into the output file.
133  * 
134  * @param in_file_count number of entries in in_files
135  * @param in_files input file array
136  * @param out_file the output file array
137  * @param err wiretap error, if failed
138  * @return TRUE if function succeeded
139  */
140 extern gboolean
141 merge_append_files(int in_file_count, merge_in_file_t in_files[], merge_out_file_t *out_file, int *err);
142
143
144 /*
145  * Convenience function: merge any number of input files into one.
146  *
147  * @param out_filename the output filename
148  * @param in_file_count number of input files
149  * @param in_filenames array of input filenames
150  * @param do_append TRUE to append, FALSE to merge chronologically
151  * @param err wiretap error, if failed
152  * @return TRUE if function succeeded
153  */
154 extern gboolean
155 merge_n_files(int out_fd, int in_file_count, char **in_filenames, gboolean do_append, int *err);
156
157
158 #ifdef __cplusplus
159 }
160 #endif /* __cplusplus */
161
162 #endif /* __MERGE_H__ */
163