Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
merge.h
1 /* merge.h
2  * Definitions for routines for merging files.
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 __MERGE_H__
12 #define __MERGE_H__
13 
14 #include "wiretap/wtap.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 typedef enum {
21  RECORD_PRESENT,
22  RECORD_NOT_PRESENT,
23  AT_EOF,
24  GOT_ERROR
25 } in_file_state_e;
26 
30 typedef struct merge_in_file_s {
31  const char *filename;
32  wtap *wth;
33  in_file_state_e state;
34  guint32 packet_num; /* current packet number */
35  gint64 size; /* file size */
36  GArray *idb_index_map; /* used for mapping the old phdr interface_id values to new during merge */
38 
40 typedef enum {
41  MERGE_OK,
42  MERGE_USER_ABORTED,
43  /* below here are true errors */
44  MERGE_ERR_CANT_OPEN_INFILE,
45  MERGE_ERR_CANT_OPEN_OUTFILE,
46  MERGE_ERR_CANT_READ_INFILE,
47  MERGE_ERR_BAD_PHDR_INTERFACE_ID,
48  MERGE_ERR_CANT_WRITE_OUTFILE,
49  MERGE_ERR_CANT_CLOSE_OUTFILE,
50  MERGE_ERR_INVALID_OPTION
51 } merge_result;
52 
53 
55 typedef enum {
56  MERGE_EVENT_INPUT_FILES_OPENED,
57  MERGE_EVENT_FRAME_TYPE_SELECTED,
58  MERGE_EVENT_READY_TO_MERGE,
59  MERGE_EVENT_RECORD_WAS_READ,
60  MERGE_EVENT_DONE
61 } merge_event;
62 
63 
65 typedef enum {
66  IDB_MERGE_MODE_NONE = 0,
67  IDB_MERGE_MODE_ALL_SAME,
68  IDB_MERGE_MODE_ANY_SAME,
69  IDB_MERGE_MODE_MAX
70 } idb_merge_mode;
71 
72 
78 WS_DLL_PUBLIC idb_merge_mode
79 merge_string_to_idb_merge_mode(const char *name);
80 
81 
87 WS_DLL_PUBLIC const char*
88 merge_idb_merge_mode_to_string(const int mode);
89 
90 
105 typedef struct {
106  gboolean (*callback_func)(merge_event event, int num,
107  const merge_in_file_t in_files[], const guint in_file_count,
108  void *data);
109  void *data;
111 
112 
134 WS_DLL_PUBLIC merge_result
135 merge_files(const gchar* out_filename, const int file_type,
136  const char *const *in_filenames, const guint in_file_count,
137  const gboolean do_append, const idb_merge_mode mode,
138  guint snaplen, const gchar *app_name, merge_progress_callback_t* cb,
139  int *err, gchar **err_info, guint *err_fileno,
140  guint32 *err_framenum);
141 
165 WS_DLL_PUBLIC merge_result
166 merge_files_to_tempfile(gchar **out_filenamep, const char *pfx,
167  const int file_type, const char *const *in_filenames,
168  const guint in_file_count, const gboolean do_append,
169  const idb_merge_mode mode, guint snaplen,
170  const gchar *app_name, merge_progress_callback_t* cb,
171  int *err, gchar **err_info, guint *err_fileno,
172  guint32 *err_framenum);
173 
194 WS_DLL_PUBLIC merge_result
195 merge_files_to_stdout(const int file_type, const char *const *in_filenames,
196  const guint in_file_count, const gboolean do_append,
197  const idb_merge_mode mode, guint snaplen,
198  const gchar *app_name, merge_progress_callback_t* cb,
199  int *err, gchar **err_info, guint *err_fileno,
200  guint32 *err_framenum);
201 
202 #ifdef __cplusplus
203 }
204 #endif /* __cplusplus */
205 
206 #endif /* __MERGE_H__ */
207 
Definition: wtap-int.h:34
void * data
Definition: merge.h:109
Definition: merge.h:30
Callback information for merging.
Definition: merge.h:105