diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-11-13 16:10:53 -0800 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2018-11-16 02:18:26 +0000 |
commit | 4e17bd6229a09c149c4e0ac7e5a090febfc15c10 (patch) | |
tree | 3a389fbe89a5ee12abfe6d3ab1a770c830643d03 /wiretap/merge.c | |
parent | 658c30dc4b98c7afd1f0a7a5f8380a9399cbb082 (diff) |
Use the dump parameters structure for non-pcapng-specific stuff.
Use it for all the per-file information, including the per-file
link-layer type and the per-file snapshot length.
Change-Id: Id75687c7faa6418a2bfcf7f8198206a9f95db629
Reviewed-on: https://code.wireshark.org/review/30616
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'wiretap/merge.c')
-rw-r--r-- | wiretap/merge.c | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c index ed99904e62..0a5c69fb9a 100644 --- a/wiretap/merge.c +++ b/wiretap/merge.c @@ -1008,6 +1008,9 @@ merge_files(const gchar* out_filename, const int file_type, cb->callback_func(MERGE_EVENT_FRAME_TYPE_SELECTED, frame_type, in_files, in_file_count, cb->data); /* prepare the outfile */ + wtap_dump_params params = WTAP_DUMP_PARAMS_INIT; + params.encap = frame_type; + params.snaplen = snaplen; if (file_type == WTAP_FILE_TYPE_SUBTYPE_PCAPNG) { shb_hdrs = create_shb_header(in_files, in_file_count, app_name); merge_debug("merge_files: SHB created"); @@ -1016,18 +1019,11 @@ merge_files(const gchar* out_filename, const int file_type, merge_debug("merge_files: IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0); /* XXX other blocks like NRB are now discarded. */ - const wtapng_dump_params ng_params = { - .shb_hdrs = shb_hdrs, - .idb_inf = idb_inf, - }; - pdh = wtap_dump_open(out_filename, file_type, frame_type, snaplen, - FALSE /* compressed */, &ng_params, err); + params.shb_hdrs = shb_hdrs; + params.idb_inf = idb_inf; } - else { - pdh = wtap_dump_open(out_filename, file_type, frame_type, snaplen, - FALSE /* compressed */, NULL, err); - } - + pdh = wtap_dump_open(out_filename, file_type, FALSE /* compressed */, + ¶ms, err); if (pdh == NULL) { merge_close_in_files(in_file_count, in_files); g_free(in_files); @@ -1115,6 +1111,9 @@ merge_files_to_tempfile(gchar **out_filenamep, const char *pfx, cb->callback_func(MERGE_EVENT_FRAME_TYPE_SELECTED, frame_type, in_files, in_file_count, cb->data); /* prepare the outfile */ + wtap_dump_params params = WTAP_DUMP_PARAMS_INIT; + params.encap = frame_type; + params.snaplen = snaplen; if (file_type == WTAP_FILE_TYPE_SUBTYPE_PCAPNG) { shb_hdrs = create_shb_header(in_files, in_file_count, app_name); merge_debug("merge_files: SHB created"); @@ -1123,21 +1122,11 @@ merge_files_to_tempfile(gchar **out_filenamep, const char *pfx, merge_debug("merge_files: IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0); /* XXX other blocks like NRB are now discarded. */ - const wtapng_dump_params ng_params = { - .shb_hdrs = shb_hdrs, - .idb_inf = idb_inf, - }; - pdh = wtap_dump_open_tempfile(out_filenamep, pfx, file_type, - frame_type, snaplen, - FALSE /* compressed */, - &ng_params, err); - } - else { - pdh = wtap_dump_open_tempfile(out_filenamep, pfx, file_type, frame_type, - snaplen, FALSE /* compressed */, - NULL, err); + params.shb_hdrs = shb_hdrs; + params.idb_inf = idb_inf; } - + pdh = wtap_dump_open_tempfile(out_filenamep, pfx, file_type, + FALSE /* compressed */, ¶ms, err); if (pdh == NULL) { merge_close_in_files(in_file_count, in_files); g_free(in_files); @@ -1220,6 +1209,9 @@ merge_files_to_stdout(const int file_type, const char *const *in_filenames, cb->callback_func(MERGE_EVENT_FRAME_TYPE_SELECTED, frame_type, in_files, in_file_count, cb->data); /* prepare the outfile */ + wtap_dump_params params = WTAP_DUMP_PARAMS_INIT; + params.encap = frame_type; + params.snaplen = snaplen; if (file_type == WTAP_FILE_TYPE_SUBTYPE_PCAPNG) { shb_hdrs = create_shb_header(in_files, in_file_count, app_name); merge_debug("merge_files: SHB created"); @@ -1228,18 +1220,10 @@ merge_files_to_stdout(const int file_type, const char *const *in_filenames, merge_debug("merge_files: IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0); /* XXX other blocks like NRB are now discarded. */ - const wtapng_dump_params ng_params = { - .shb_hdrs = shb_hdrs, - .idb_inf = idb_inf, - }; - pdh = wtap_dump_open_stdout(file_type, frame_type, snaplen, - FALSE /* compressed */, &ng_params, err); - } - else { - pdh = wtap_dump_open_stdout(file_type, frame_type, snaplen, - FALSE /* compressed */, NULL, err); + params.shb_hdrs = shb_hdrs; + params.idb_inf = idb_inf; } - + pdh = wtap_dump_open_stdout(file_type, FALSE /* compressed */, ¶ms, err); if (pdh == NULL) { merge_close_in_files(in_file_count, in_files); g_free(in_files); |