Wireshark  4.3.0
The Wireshark network protocol analyzer
merge.h
Go to the documentation of this file.
1 
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  wtap_rec rec;
34  Buffer frame_buffer;
35  in_file_state_e state;
36  uint32_t packet_num; /* current packet number */
37  int64_t size; /* file size */
38  GArray *idb_index_map; /* used for mapping the old phdr interface_id values to new during merge */
39  unsigned nrbs_seen; /* number of elements processed so far from wth->nrbs */
40  unsigned dsbs_seen; /* number of elements processed so far from wth->dsbs */
42 
44 typedef enum {
45  MERGE_OK,
46  MERGE_USER_ABORTED,
47  /* below here are true errors */
48  MERGE_ERR_CANT_OPEN_INFILE,
49  MERGE_ERR_CANT_OPEN_OUTFILE,
50  MERGE_ERR_CANT_READ_INFILE,
51  MERGE_ERR_BAD_PHDR_INTERFACE_ID,
52  MERGE_ERR_CANT_WRITE_OUTFILE,
53  MERGE_ERR_CANT_CLOSE_OUTFILE,
54  MERGE_ERR_INVALID_OPTION
55 } merge_result;
56 
57 
59 typedef enum {
60  MERGE_EVENT_INPUT_FILES_OPENED,
61  MERGE_EVENT_FRAME_TYPE_SELECTED,
62  MERGE_EVENT_READY_TO_MERGE,
63  MERGE_EVENT_RECORD_WAS_READ,
64  MERGE_EVENT_DONE
65 } merge_event;
66 
67 
69 typedef enum {
73  IDB_MERGE_MODE_MAX
75 
76 
82 WS_DLL_PUBLIC idb_merge_mode
83 merge_string_to_idb_merge_mode(const char *name);
84 
85 
91 WS_DLL_PUBLIC const char*
92 merge_idb_merge_mode_to_string(const int mode);
93 
94 
109 typedef struct {
110  bool (*callback_func)(merge_event event, int num,
111  const merge_in_file_t in_files[], const unsigned in_file_count,
112  void *data);
113  void *data;
115 
116 
138 WS_DLL_PUBLIC merge_result
139 merge_files(const char* out_filename, const int file_type,
140  const char *const *in_filenames, const unsigned in_file_count,
141  const bool do_append, const idb_merge_mode mode,
142  unsigned snaplen, const char *app_name, merge_progress_callback_t* cb,
143  int *err, char **err_info, unsigned *err_fileno,
144  uint32_t *err_framenum);
145 
170 WS_DLL_PUBLIC merge_result
171 merge_files_to_tempfile(const char *tmpdir, char **out_filenamep, const char *pfx,
172  const int file_type, const char *const *in_filenames,
173  const unsigned in_file_count, const bool do_append,
174  const idb_merge_mode mode, unsigned snaplen,
175  const char *app_name, merge_progress_callback_t* cb,
176  int *err, char **err_info, unsigned *err_fileno,
177  uint32_t *err_framenum);
178 
199 WS_DLL_PUBLIC merge_result
200 merge_files_to_stdout(const int file_type, const char *const *in_filenames,
201  const unsigned in_file_count, const bool do_append,
202  const idb_merge_mode mode, unsigned snaplen,
203  const char *app_name, merge_progress_callback_t* cb,
204  int *err, char **err_info, unsigned *err_fileno,
205  uint32_t *err_framenum);
206 
207 #ifdef __cplusplus
208 }
209 #endif /* __cplusplus */
210 
211 #endif /* __MERGE_H__ */
212 
WS_DLL_PUBLIC merge_result merge_files_to_tempfile(const char *tmpdir, char **out_filenamep, const char *pfx, const int file_type, const char *const *in_filenames, const unsigned in_file_count, const bool do_append, const idb_merge_mode mode, unsigned snaplen, const char *app_name, merge_progress_callback_t *cb, int *err, char **err_info, unsigned *err_fileno, uint32_t *err_framenum)
Definition: merge.c:1460
WS_DLL_PUBLIC const char * merge_idb_merge_mode_to_string(const int mode)
Definition: merge.c:70
WS_DLL_PUBLIC merge_result merge_files(const char *out_filename, const int file_type, const char *const *in_filenames, const unsigned in_file_count, const bool do_append, const idb_merge_mode mode, unsigned snaplen, const char *app_name, merge_progress_callback_t *cb, int *err, char **err_info, unsigned *err_fileno, uint32_t *err_framenum)
Definition: merge.c:1423
merge_event
Definition: merge.h:59
WS_DLL_PUBLIC idb_merge_mode merge_string_to_idb_merge_mode(const char *name)
Definition: merge.c:58
idb_merge_mode
Definition: merge.h:69
@ IDB_MERGE_MODE_NONE
Definition: merge.h:70
@ IDB_MERGE_MODE_ALL_SAME
Definition: merge.h:71
@ IDB_MERGE_MODE_ANY_SAME
Definition: merge.h:72
merge_result
Definition: merge.h:44
WS_DLL_PUBLIC merge_result merge_files_to_stdout(const int file_type, const char *const *in_filenames, const unsigned in_file_count, const bool do_append, const idb_merge_mode mode, unsigned snaplen, const char *app_name, merge_progress_callback_t *cb, int *err, char **err_info, unsigned *err_fileno, uint32_t *err_framenum)
Definition: merge.c:1485
struct merge_in_file_s merge_in_file_t
Definition: buffer.h:22
Definition: merge.h:30
Callback information for merging.
Definition: merge.h:109
void * data
Definition: merge.h:113
Definition: wtap.h:1395
Definition: wtap-int.h:37