HACK: 1. try to match RowsetProperties
[wireshark-wip.git] / wiretap / merge.h
blob12be91bc1299b6bce95181f6b672bcf4d38fb6a2
1 /* merge.h
2 * Definitions for routines for merging files.
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __MERGE_H__
26 #define __MERGE_H__
28 #include "wiretap/wtap.h"
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
34 typedef enum {
35 PACKET_PRESENT,
36 PACKET_NOT_PRESENT,
37 AT_EOF,
38 GOT_ERROR
39 } in_file_state_e;
41 /**
42 * Structures to manage our input files.
44 typedef struct merge_in_file_s {
45 const char *filename;
46 wtap *wth;
47 gint64 data_offset;
48 in_file_state_e state;
49 guint32 packet_num; /* current packet number */
50 gint64 size; /* file size */
51 guint32 interface_id; /* identifier of the interface.
52 * Used for fake interfaces when writing WTAP_ENCAP_PER_PACKET */
53 } merge_in_file_t;
55 /** Open a number of input files to merge.
57 * @param in_file_count number of entries in in_file_names and in_files
58 * @param in_file_names filenames of the input files
59 * @param in_files input file array to be filled (>= sizeof(merge_in_file_t) * in_file_count)
60 * @param err wiretap error, if failed
61 * @param err_info wiretap error string, if failed
62 * @param err_fileno file on which open failed, if failed
63 * @return TRUE if all files could be opened, FALSE otherwise
65 WS_DLL_PUBLIC gboolean
66 merge_open_in_files(int in_file_count, char *const *in_file_names,
67 merge_in_file_t **in_files, int *err, gchar **err_info,
68 int *err_fileno);
70 /** Close the input files again.
72 * @param in_file_count number of entries in in_files
73 * @param in_files input file array to be closed
75 WS_DLL_PUBLIC void
76 merge_close_in_files(int in_file_count, merge_in_file_t in_files[]);
78 /** Try to get the frame type from the input files.
80 * @param in_file_count number of entries in in_files
81 * @param in_files input file array
82 * @return the frame type
84 WS_DLL_PUBLIC int
85 merge_select_frame_type(int in_file_count, merge_in_file_t in_files[]);
87 /** Try to get the snapshot length from the input files.
89 * @param in_file_count number of entries in in_files
90 * @param in_files input file array
91 * @return the snapshot length
93 WS_DLL_PUBLIC int
94 merge_max_snapshot_length(int in_file_count, merge_in_file_t in_files[]);
96 /** Read the next packet, in chronological order, from the set of files to
97 * be merged.
99 * @param in_file_count number of entries in in_files
100 * @param in_files input file array
101 * @param err wiretap error, if failed
102 * @param err_info wiretap error string, if failed
103 * @return pointer to merge_in_file_t for file from which that packet
104 * came, or NULL on error or EOF
106 WS_DLL_PUBLIC merge_in_file_t *
107 merge_read_packet(int in_file_count, merge_in_file_t in_files[], int *err,
108 gchar **err_info);
111 /** Read the next packet, in file sequence order, from the set of files
112 * to be merged.
114 * @param in_file_count number of entries in in_files
115 * @param in_files input file array
116 * @param err wiretap error, if failed
117 * @param err_info wiretap error string, if failed
118 * @return pointer to merge_in_file_t for file from which that packet
119 * came, or NULL on error or EOF
121 WS_DLL_PUBLIC merge_in_file_t *
122 merge_append_read_packet(int in_file_count, merge_in_file_t in_files[],
123 int *err, gchar **err_info);
125 #ifdef __cplusplus
127 #endif /* __cplusplus */
129 #endif /* __MERGE_H__ */