Wireshark  4.3.0
The Wireshark network protocol analyzer
Classes | Typedefs | Enumerations | Functions
merge.h File Reference
#include "wiretap/wtap.h"

Go to the source code of this file.

Classes

struct  merge_in_file_s
 
struct  merge_progress_callback_t
 Callback information for merging. More...
 

Typedefs

typedef struct merge_in_file_s merge_in_file_t
 

Enumerations

enum  in_file_state_e { RECORD_PRESENT , RECORD_NOT_PRESENT , AT_EOF , GOT_ERROR }
 
enum  merge_result {
  MERGE_OK , MERGE_USER_ABORTED , MERGE_ERR_CANT_OPEN_INFILE , MERGE_ERR_CANT_OPEN_OUTFILE ,
  MERGE_ERR_CANT_READ_INFILE , MERGE_ERR_BAD_PHDR_INTERFACE_ID , MERGE_ERR_CANT_WRITE_OUTFILE , MERGE_ERR_CANT_CLOSE_OUTFILE ,
  MERGE_ERR_INVALID_OPTION
}
 
enum  merge_event {
  MERGE_EVENT_INPUT_FILES_OPENED , MERGE_EVENT_FRAME_TYPE_SELECTED , MERGE_EVENT_READY_TO_MERGE , MERGE_EVENT_RECORD_WAS_READ ,
  MERGE_EVENT_DONE
}
 
enum  idb_merge_mode { IDB_MERGE_MODE_NONE = 0 , IDB_MERGE_MODE_ALL_SAME , IDB_MERGE_MODE_ANY_SAME , IDB_MERGE_MODE_MAX }
 

Functions

WS_DLL_PUBLIC idb_merge_mode merge_string_to_idb_merge_mode (const char *name)
 
WS_DLL_PUBLIC const char * merge_idb_merge_mode_to_string (const int mode)
 
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)
 
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)
 
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)
 

Detailed Description

Definitions for routines for merging files.

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Typedef Documentation

◆ merge_in_file_t

Structures to manage our input files.

Enumeration Type Documentation

◆ idb_merge_mode

Merge mode for IDB info.

Enumerator
IDB_MERGE_MODE_NONE 

no merging of IDBs is done, all IDBs are copied into merged file

IDB_MERGE_MODE_ALL_SAME 

duplicate IDBs merged only if all the files have the same set of IDBs

IDB_MERGE_MODE_ANY_SAME 

any and all duplicate IDBs are merged into one IDB, even within a file

◆ merge_event

Merge events, used as an arg in the callback function - indicates when the callback was invoked.

◆ merge_result

Return values from merge_files().

Function Documentation

◆ merge_files()

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 
)

Merge the given input files to a file with the given filename

Parameters
out_filenameThe output filename
file_typeThe WTAP_FILE_TYPE_SUBTYPE_XXX output file type
in_filenamesAn array of input filenames to merge from
in_file_countThe number of entries in in_filenames
do_appendWhether to append by file order instead of chronological order
modeThe IDB_MERGE_MODE_XXX merge mode for interface data
snaplenThe snaplen to limit it to, or 0 to leave as it is in the files
app_nameThe application name performing the merge, used in SHB info
cbThe callback information to use during execution
[out]errSet to the internal WTAP_ERR_XXX error code if it failed with MERGE_ERR_CANT_OPEN_INFILE, MERGE_ERR_CANT_OPEN_OUTFILE, MERGE_ERR_CANT_READ_INFILE, MERGE_ERR_CANT_WRITE_OUTFILE, or MERGE_ERR_CANT_CLOSE_OUTFILE
[out]err_infoAdditional information for some WTAP_ERR_XXX codes
[out]err_filenoSet to the input file number which failed, if it failed
[out]err_framenumSet to the input frame number if it failed
Returns
the frame type

◆ merge_files_to_stdout()

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 
)

Merge the given input files to the standard output

Parameters
file_typeThe WTAP_FILE_TYPE_SUBTYPE_XXX output file type
in_filenamesAn array of input filenames to merge from
in_file_countThe number of entries in in_filenames
do_appendWhether to append by file order instead of chronological order
modeThe IDB_MERGE_MODE_XXX merge mode for interface data
snaplenThe snaplen to limit it to, or 0 to leave as it is in the files
app_nameThe application name performing the merge, used in SHB info
cbThe callback information to use during execution
[out]errSet to the internal WTAP_ERR_XXX error code if it failed with MERGE_ERR_CANT_OPEN_INFILE, MERGE_ERR_CANT_OPEN_OUTFILE, MERGE_ERR_CANT_READ_INFILE, MERGE_ERR_CANT_WRITE_OUTFILE, or MERGE_ERR_CANT_CLOSE_OUTFILE
[out]err_infoAdditional information for some WTAP_ERR_XXX codes
[out]err_filenoSet to the input file number which failed, if it failed
[out]err_framenumSet to the input frame number if it failed
Returns
the frame type

◆ merge_files_to_tempfile()

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 
)

Merge the given input files to a temporary file

Parameters
tmpdirPoints to the directory in which to write the temporary file
out_filenamepPoints to a pointer that's set to point to the pathname of the temporary file; it's allocated with g_malloc()
pfxA string to be used as the prefix for the temporary file name
file_typeThe WTAP_FILE_TYPE_SUBTYPE_XXX output file type
in_filenamesAn array of input filenames to merge from
in_file_countThe number of entries in in_filenames
do_appendWhether to append by file order instead of chronological order
modeThe IDB_MERGE_MODE_XXX merge mode for interface data
snaplenThe snaplen to limit it to, or 0 to leave as it is in the files
app_nameThe application name performing the merge, used in SHB info
cbThe callback information to use during execution
[out]errSet to the internal WTAP_ERR_XXX error code if it failed with MERGE_ERR_CANT_OPEN_INFILE, MERGE_ERR_CANT_OPEN_OUTFILE, MERGE_ERR_CANT_READ_INFILE, MERGE_ERR_CANT_WRITE_OUTFILE, or MERGE_ERR_CANT_CLOSE_OUTFILE
[out]err_infoAdditional information for some WTAP_ERR_XXX codes
[out]err_filenoSet to the input file number which failed, if it failed
[out]err_framenumSet to the input frame number if it failed
Returns
the frame type

◆ merge_idb_merge_mode_to_string()

WS_DLL_PUBLIC const char* merge_idb_merge_mode_to_string ( const int  mode)

Returns the string name for the given number.

Parameters
modeThe number of the mode, representing the idb_merge_mode enum value.
Returns
The string name, or "UNKNOWN" on failure.

◆ merge_string_to_idb_merge_mode()

WS_DLL_PUBLIC idb_merge_mode merge_string_to_idb_merge_mode ( const char *  name)

Returns the idb_merge_mode for the given string name.

Parameters
nameThe name of the mode.
Returns
The idb_merge_mode, or IDB_MERGE_MODE_MAX on failure.