| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
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
| Structure to manage input files during merge. More...
struct | merge_progress_callback_t
| Callback information for merging. More...

## Typedefs
typedef struct merge_in_file_s | merge_in_file_t
| Structure to manage input files during merge.

## Enumerations
enum | in_file_state_e { RECORD_PRESENT , RECORD_NOT_PRESENT , AT_EOF , GOT_ERROR }
| State of input file during merge. More...
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 }
| Merge event types passed to the callback function. More...
enum | idb_merge_mode { IDB_MERGE_MODE_NONE = 0 , IDB_MERGE_MODE_ALL_SAME , IDB_MERGE_MODE_ANY_SAME , IDB_MERGE_MODE_MAX }
| Merge mode for Interface Description Blocks (IDBs). More...

## Functions
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.
WS_DLL_PUBLIC const char * | merge_idb_merge_mode_to_string (const int mode)
| Returns the string name for the given number.
WS_DLL_PUBLIC bool | merge_files (const char *out_filename, const int file_type, const char *const *in_filenames, const unsigned in_file_count, const bool add_merging_comment, const bool do_append, const idb_merge_mode mode, unsigned snaplen, const char *app_name, const char *app_env_var_prefix, merge_progress_callback_t *cb, ws_compression_type compression_type)
| Merge the given input files to a file with the given filename.
WS_DLL_PUBLIC bool | 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 add_merging_comment, const bool do_append, const idb_merge_mode mode, unsigned snaplen, const char *app_name, const char *app_env_var_prefix, merge_progress_callback_t *cb)
| Merge the given input files to a temporary file.
WS_DLL_PUBLIC bool | merge_files_to_stdout (const int file_type, const char *const *in_filenames, const unsigned in_file_count, const bool add_merging_comment, const bool do_append, const idb_merge_mode mode, unsigned snaplen, const char *app_name, const char *app_env_var_prefix, merge_progress_callback_t *cb, ws_compression_type compression_type)
| Merge the given input files to the standard output.

## 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

typedef struct merge_in_file_s merge_in_file_t

Structure to manage input files during merge.

Holds state and metadata for each input file processed.

## Enumeration Type Documentation

## ◆ idb_merge_mode

enum idb_merge_mode

Merge mode for Interface Description Blocks (IDBs).

Controls how duplicate IDBs are handled during file merge.

Enumerator
IDB_MERGE_MODE_NONE | No merging; all IDBs are copied into the merged file.
IDB_MERGE_MODE_ALL_SAME | Merge only if all input files share identical IDBs.
IDB_MERGE_MODE_ANY_SAME | Merge any duplicate IDBs, even within a single file.
IDB_MERGE_MODE_MAX | Sentinel value; not a valid mode.

## ◆ in_file_state_e

enum in_file_state_e

State of input file during merge.

Indicates the result of reading from an input file.

Enumerator
RECORD_PRESENT | A record was successfully read.
RECORD_NOT_PRESENT | No record available at current position.
AT_EOF | End of file reached.
GOT_ERROR | An error occurred while reading.

## ◆ merge_event

enum merge_event

Merge event types passed to the callback function.

Indicates the stage at which the merge callback was invoked.

Enumerator
MERGE_EVENT_INPUT_FILES_OPENED | Input files have been opened.
MERGE_EVENT_FRAME_TYPE_SELECTED | Frame type has been selected.
MERGE_EVENT_READY_TO_MERGE | Ready to begin merging packets.
MERGE_EVENT_RECORD_WAS_READ | A packet record was read.
MERGE_EVENT_DONE | Merge process is complete.

## Function Documentation

## ◆ merge_files()

WS_DLL_PUBLIC bool merge_files | ( | const char * | out_filename,
|  | const int | file_type,
|  | const char *const * | in_filenames,
|  | const unsigned | in_file_count,
|  | const bool | add_merging_comment,
|  | const bool | do_append,
|  | const idb_merge_mode | mode,
|  | unsigned | snaplen,
|  | const char * | app_name,
|  | const char * | app_env_var_prefix,
|  | merge_progress_callback_t * | cb,
|  | ws_compression_type | compression_type
| ) |  |

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

Parameters

  out_filename | The output filename
  file_type | The WTAP_FILE_TYPE_SUBTYPE_XXX output file type
  in_filenames | An array of input filenames to merge from
  in_file_count | The number of entries in in_filenames
  add_merging_comment | Whether to add "File created by merging:..." comment
  do_append | Whether to append by file order instead of chronological order
  mode | The IDB_MERGE_MODE_XXX merge mode for interface data
  snaplen | The snaplen to limit it to, or 0 to leave as it is in the files
  app_name | The application name performing the merge, used in SHB info
  app_env_var_prefix | The prefix for the application environment variable used to get the personal config directory.
  cb | The callback information to use during execution
  compression_type | The compression type to use for the output

Returns
  true on success, false on failure

## ◆ merge_files_to_stdout()

WS_DLL_PUBLIC bool merge_files_to_stdout | ( | const int | file_type,
|  | const char *const * | in_filenames,
|  | const unsigned | in_file_count,
|  | const bool | add_merging_comment,
|  | const bool | do_append,
|  | const idb_merge_mode | mode,
|  | unsigned | snaplen,
|  | const char * | app_name,
|  | const char * | app_env_var_prefix,
|  | merge_progress_callback_t * | cb,
|  | ws_compression_type | compression_type
| ) |  |

Merge the given input files to the standard output.

Parameters

  file_type | The WTAP_FILE_TYPE_SUBTYPE_XXX output file type
  in_filenames | An array of input filenames to merge from
  in_file_count | The number of entries in in_filenames
  add_merging_comment | Whether to add "File created by merging:..." comment
  do_append | Whether to append by file order instead of chronological order
  mode | The IDB_MERGE_MODE_XXX merge mode for interface data
  snaplen | The snaplen to limit it to, or 0 to leave as it is in the files
  app_name | The application name performing the merge, used in SHB info
  app_env_var_prefix | The prefix for the application environment variable used to get the personal config directory.
  cb | The callback information to use during execution

Returns
  true on success, false on failure

## ◆ merge_files_to_tempfile()

WS_DLL_PUBLIC bool 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 | add_merging_comment,
|  | const bool | do_append,
|  | const idb_merge_mode | mode,
|  | unsigned | snaplen,
|  | const char * | app_name,
|  | const char * | app_env_var_prefix,
|  | merge_progress_callback_t * | cb
| ) |  |

Merge the given input files to a temporary file.

Parameters

  tmpdir | Points to the directory in which to write the temporary file
  out_filenamep | Points to a pointer that's set to point to the pathname of the temporary file; it's allocated with g_malloc()
  pfx | A string to be used as the prefix for the temporary file name
  file_type | The WTAP_FILE_TYPE_SUBTYPE_XXX output file type
  in_filenames | An array of input filenames to merge from
  in_file_count | The number of entries in in_filenames
  add_merging_comment | Whether to add "File created by merging:..." comment
  do_append | Whether to append by file order instead of chronological order
  mode | The IDB_MERGE_MODE_XXX merge mode for interface data
  snaplen | The snaplen to limit it to, or 0 to leave as it is in the files
  app_name | The application name performing the merge, used in SHB info
  app_env_var_prefix | The prefix for the application environment variable used to get the personal config directory.
  cb | The callback information to use during execution

Returns
  true on success, false on failure

## ◆ 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

  mode | The 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

  name | The name of the mode.

Returns
  The idb_merge_mode, or IDB_MERGE_MODE_MAX on failure.