2012-09-20 10:28:05 +00:00
|
|
|
/* Reorder the frames from an input dump file, and write to output dump file.
|
2012-10-04 18:24:21 +00:00
|
|
|
* Martin Mathieson and Jakub Jawadzki
|
2012-09-20 10:28:05 +00:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2012-09-20 10:28:05 +00:00
|
|
|
*/
|
|
|
|
|
2014-08-22 21:13:05 +00:00
|
|
|
#include <config.h>
|
2012-10-03 18:03:01 +00:00
|
|
|
|
2012-09-20 10:28:05 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-10-03 18:03:01 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
2014-07-03 04:50:54 +00:00
|
|
|
#ifdef HAVE_GETOPT_H
|
|
|
|
#include <getopt.h>
|
|
|
|
#endif
|
|
|
|
|
2016-01-06 00:24:52 +00:00
|
|
|
#include <wiretap/wtap.h>
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2014-12-25 01:10:40 +00:00
|
|
|
#ifndef HAVE_GETOPT_LONG
|
2012-10-03 18:03:01 +00:00
|
|
|
#include "wsutil/wsgetopt.h"
|
|
|
|
#endif
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2019-01-01 00:55:23 +00:00
|
|
|
#include <ui/cmdarg_err.h>
|
2016-03-21 22:51:12 +00:00
|
|
|
#include <wsutil/filesystem.h>
|
2015-02-20 00:05:49 +00:00
|
|
|
#include <wsutil/file_util.h>
|
2016-03-21 22:51:12 +00:00
|
|
|
#include <wsutil/privileges.h>
|
2018-12-12 10:53:08 +00:00
|
|
|
#include <cli_main.h>
|
2017-09-26 14:04:56 +00:00
|
|
|
#include <version_info.h>
|
2016-01-26 01:17:21 +00:00
|
|
|
#include <wiretap/wtap_opttypes.h>
|
2014-07-03 08:45:32 +00:00
|
|
|
|
2016-03-21 22:51:12 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
#include <wsutil/plugins.h>
|
|
|
|
#endif
|
|
|
|
|
2017-04-08 19:45:19 +00:00
|
|
|
#include <wsutil/report_message.h>
|
2016-03-21 22:51:12 +00:00
|
|
|
|
2017-04-20 07:19:01 +00:00
|
|
|
#include "ui/failure_message.h"
|
|
|
|
|
2017-02-04 15:26:34 +00:00
|
|
|
#define INVALID_OPTION 1
|
|
|
|
#define OPEN_ERROR 2
|
|
|
|
#define OUTPUT_FILE_ERROR 1
|
|
|
|
|
2012-09-20 10:28:05 +00:00
|
|
|
/* Show command-line usage */
|
2014-06-20 18:48:27 +00:00
|
|
|
static void
|
2014-07-03 08:45:32 +00:00
|
|
|
print_usage(FILE *output)
|
2012-09-20 10:28:05 +00:00
|
|
|
{
|
2013-12-31 16:23:00 +00:00
|
|
|
fprintf(output, "\n");
|
|
|
|
fprintf(output, "Usage: reordercap [options] <infile> <outfile>\n");
|
|
|
|
fprintf(output, "\n");
|
|
|
|
fprintf(output, "Options:\n");
|
|
|
|
fprintf(output, " -n don't write to output file if the input file is ordered.\n");
|
|
|
|
fprintf(output, " -h display this help and exit.\n");
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Remember where this frame was in the file */
|
|
|
|
typedef struct FrameRecord_t {
|
2013-11-09 10:38:02 +00:00
|
|
|
gint64 offset;
|
|
|
|
guint num;
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2015-09-28 13:11:44 +00:00
|
|
|
nstime_t frame_time;
|
2012-09-20 10:28:05 +00:00
|
|
|
} FrameRecord_t;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/* Debugging only */
|
|
|
|
|
|
|
|
/* Enable this symbol to see debug output */
|
2012-09-20 10:36:28 +00:00
|
|
|
/* #define REORDER_DEBUG */
|
2012-09-20 10:28:05 +00:00
|
|
|
|
|
|
|
#ifdef REORDER_DEBUG
|
|
|
|
#define DEBUG_PRINT printf
|
|
|
|
#else
|
|
|
|
#define DEBUG_PRINT(...)
|
|
|
|
#endif
|
|
|
|
/**************************************************/
|
|
|
|
|
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
static void
|
2014-12-01 00:30:19 +00:00
|
|
|
frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh,
|
2018-02-09 00:19:12 +00:00
|
|
|
wtap_rec *rec, Buffer *buf, const char *infile,
|
2017-04-20 07:19:01 +00:00
|
|
|
const char *outfile)
|
2012-09-20 10:28:05 +00:00
|
|
|
{
|
|
|
|
int err;
|
2013-07-26 21:49:42 +00:00
|
|
|
gchar *err_info;
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2014-02-07 19:14:52 +00:00
|
|
|
DEBUG_PRINT("\nDumping frame (offset=%" G_GINT64_MODIFIER "u)\n",
|
2014-01-02 20:47:21 +00:00
|
|
|
frame->offset);
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2014-02-07 19:14:52 +00:00
|
|
|
|
2014-12-01 00:30:19 +00:00
|
|
|
/* Re-read the frame from the stored location */
|
2018-02-09 00:19:12 +00:00
|
|
|
if (!wtap_seek_read(wth, frame->offset, rec, buf, &err, &err_info)) {
|
2013-07-26 21:49:42 +00:00
|
|
|
if (err != 0) {
|
|
|
|
/* Print a message noting that the read failed somewhere along the line. */
|
|
|
|
fprintf(stderr,
|
2017-04-20 07:19:01 +00:00
|
|
|
"reordercap: An error occurred while re-reading \"%s\".\n",
|
|
|
|
infile);
|
|
|
|
cfile_read_failure_message("reordercap", infile, err, err_info);
|
2013-07-26 21:49:42 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
2012-09-20 10:28:05 +00:00
|
|
|
|
|
|
|
/* Copy, and set length and timestamp from item. */
|
2018-02-09 00:19:12 +00:00
|
|
|
/* TODO: remove when wtap_seek_read() fills in rec,
|
2014-12-01 00:30:19 +00:00
|
|
|
including time stamps, for all file types */
|
2018-02-09 00:19:12 +00:00
|
|
|
rec->ts = frame->frame_time;
|
2012-09-20 10:28:05 +00:00
|
|
|
|
|
|
|
/* Dump frame to outfile */
|
2018-02-09 00:19:12 +00:00
|
|
|
if (!wtap_dump(pdh, rec, ws_buffer_start_ptr(buf), &err, &err_info)) {
|
2017-04-20 17:14:50 +00:00
|
|
|
cfile_write_failure_message("reordercap", infile, outfile, err,
|
|
|
|
err_info, frame->num,
|
|
|
|
wtap_file_type_subtype(wth));
|
2012-09-20 10:28:05 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2012-10-04 18:24:21 +00:00
|
|
|
}
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
/* Comparing timestamps between 2 frames.
|
2014-05-23 23:40:56 +00:00
|
|
|
negative if (t1 < t2)
|
|
|
|
zero if (t1 == t2)
|
|
|
|
positive if (t1 > t2)
|
2012-10-04 18:24:21 +00:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
frames_compare(gconstpointer a, gconstpointer b)
|
|
|
|
{
|
2014-01-15 08:36:09 +00:00
|
|
|
const FrameRecord_t *frame1 = *(const FrameRecord_t *const *) a;
|
|
|
|
const FrameRecord_t *frame2 = *(const FrameRecord_t *const *) b;
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2015-09-28 13:11:44 +00:00
|
|
|
const nstime_t *time1 = &frame1->frame_time;
|
|
|
|
const nstime_t *time2 = &frame2->frame_time;
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2014-05-23 23:40:56 +00:00
|
|
|
return nstime_cmp(time1, time2);
|
2012-10-04 18:24:21 +00:00
|
|
|
}
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2016-03-21 22:51:12 +00:00
|
|
|
/*
|
2017-04-08 19:45:19 +00:00
|
|
|
* General errors and warnings are reported with an console message
|
|
|
|
* in reordercap.
|
2016-03-21 22:51:12 +00:00
|
|
|
*/
|
|
|
|
static void
|
2017-04-08 19:45:19 +00:00
|
|
|
failure_warning_message(const char *msg_format, va_list ap)
|
2016-03-21 22:51:12 +00:00
|
|
|
{
|
2016-09-05 23:26:29 +00:00
|
|
|
fprintf(stderr, "reordercap: ");
|
|
|
|
vfprintf(stderr, msg_format, ap);
|
|
|
|
fprintf(stderr, "\n");
|
2016-03-21 22:51:12 +00:00
|
|
|
}
|
2017-09-11 15:45:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Report additional information for an error in command-line arguments.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
failure_message_cont(const char *msg_format, va_list ap)
|
|
|
|
{
|
|
|
|
vfprintf(stderr, msg_format, ap);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
}
|
2016-03-21 22:51:12 +00:00
|
|
|
|
2012-09-20 10:28:05 +00:00
|
|
|
/********************************************************************/
|
|
|
|
/* Main function. */
|
|
|
|
/********************************************************************/
|
2018-12-12 10:53:08 +00:00
|
|
|
int
|
2018-12-26 17:10:12 +00:00
|
|
|
main(int argc, char *argv[])
|
2012-09-20 10:28:05 +00:00
|
|
|
{
|
2016-12-05 04:25:51 +00:00
|
|
|
char *init_progfile_dir_error;
|
2014-05-09 05:18:49 +00:00
|
|
|
wtap *wth = NULL;
|
|
|
|
wtap_dumper *pdh = NULL;
|
2019-04-05 01:56:27 +00:00
|
|
|
wtap_rec rec;
|
2013-06-16 00:20:00 +00:00
|
|
|
Buffer buf;
|
2012-09-20 10:28:05 +00:00
|
|
|
int err;
|
|
|
|
gchar *err_info;
|
|
|
|
gint64 data_offset;
|
2012-10-04 18:24:21 +00:00
|
|
|
guint wrong_order_count = 0;
|
|
|
|
gboolean write_output_regardless = TRUE;
|
|
|
|
guint i;
|
2018-11-14 00:10:53 +00:00
|
|
|
wtap_dump_params params;
|
2017-02-04 15:26:34 +00:00
|
|
|
int ret = EXIT_SUCCESS;
|
2012-10-04 18:24:21 +00:00
|
|
|
|
|
|
|
GPtrArray *frames;
|
|
|
|
FrameRecord_t *prevFrame = NULL;
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2012-10-03 18:03:01 +00:00
|
|
|
int opt;
|
2014-07-03 04:50:54 +00:00
|
|
|
static const struct option long_options[] = {
|
2015-11-21 23:48:27 +00:00
|
|
|
{"help", no_argument, NULL, 'h'},
|
|
|
|
{"version", no_argument, NULL, 'v'},
|
2014-07-03 04:50:54 +00:00
|
|
|
{0, 0, 0, 0 }
|
|
|
|
};
|
2012-10-03 18:03:01 +00:00
|
|
|
int file_count;
|
2012-09-20 10:28:05 +00:00
|
|
|
char *infile;
|
2015-11-10 01:21:46 +00:00
|
|
|
const char *outfile;
|
2012-10-03 18:03:01 +00:00
|
|
|
|
2017-09-11 15:45:52 +00:00
|
|
|
cmdarg_err_init(failure_warning_message, failure_message_cont);
|
|
|
|
|
2018-12-13 02:16:15 +00:00
|
|
|
/* Initialize the version information. */
|
|
|
|
ws_init_version_info("Reordercap (Wireshark)", NULL, NULL, NULL);
|
2014-07-03 08:45:32 +00:00
|
|
|
|
2016-12-05 04:25:51 +00:00
|
|
|
/*
|
|
|
|
* Get credential information for later use.
|
|
|
|
*/
|
|
|
|
init_process_policies();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attempt to get the pathname of the directory containing the
|
|
|
|
* executable file.
|
|
|
|
*/
|
2018-05-05 07:19:09 +00:00
|
|
|
init_progfile_dir_error = init_progfile_dir(argv[0]);
|
2016-12-05 04:25:51 +00:00
|
|
|
if (init_progfile_dir_error != NULL) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"reordercap: Can't get pathname of directory containing the reordercap program: %s.\n",
|
|
|
|
init_progfile_dir_error);
|
|
|
|
g_free(init_progfile_dir_error);
|
|
|
|
}
|
2016-12-04 21:42:07 +00:00
|
|
|
|
2017-04-08 19:45:19 +00:00
|
|
|
init_report_message(failure_warning_message, failure_warning_message,
|
|
|
|
NULL, NULL, NULL);
|
2016-03-21 22:51:12 +00:00
|
|
|
|
2018-01-09 08:55:37 +00:00
|
|
|
wtap_init(TRUE);
|
2016-03-21 22:51:12 +00:00
|
|
|
|
2012-10-03 18:03:01 +00:00
|
|
|
/* Process the options first */
|
2014-07-03 04:50:54 +00:00
|
|
|
while ((opt = getopt_long(argc, argv, "hnv", long_options, NULL)) != -1) {
|
2012-10-03 18:03:01 +00:00
|
|
|
switch (opt) {
|
2012-10-04 18:24:21 +00:00
|
|
|
case 'n':
|
|
|
|
write_output_regardless = FALSE;
|
2012-10-03 18:03:01 +00:00
|
|
|
break;
|
2013-12-31 16:23:00 +00:00
|
|
|
case 'h':
|
2018-12-13 02:16:15 +00:00
|
|
|
show_help_header("Reorder timestamps of input file frames into output file.");
|
2014-07-03 08:45:32 +00:00
|
|
|
print_usage(stdout);
|
2017-02-04 15:26:34 +00:00
|
|
|
goto clean_exit;
|
2014-06-20 18:48:27 +00:00
|
|
|
case 'v':
|
2018-12-13 02:16:15 +00:00
|
|
|
show_version();
|
2017-02-04 15:26:34 +00:00
|
|
|
goto clean_exit;
|
2012-10-03 18:03:01 +00:00
|
|
|
case '?':
|
2014-07-03 08:45:32 +00:00
|
|
|
print_usage(stderr);
|
2017-02-04 15:26:34 +00:00
|
|
|
ret = INVALID_OPTION;
|
|
|
|
goto clean_exit;
|
2012-10-03 18:03:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
/* Remaining args are file names */
|
2012-10-03 18:03:01 +00:00
|
|
|
file_count = argc - optind;
|
|
|
|
if (file_count == 2) {
|
2013-12-31 16:23:00 +00:00
|
|
|
infile = argv[optind];
|
2012-10-03 18:03:01 +00:00
|
|
|
outfile = argv[optind+1];
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-07-03 08:45:32 +00:00
|
|
|
print_usage(stderr);
|
2017-02-04 15:26:34 +00:00
|
|
|
ret = INVALID_OPTION;
|
|
|
|
goto clean_exit;
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Open infile */
|
2014-03-20 16:57:29 +00:00
|
|
|
/* TODO: if reordercap is ever changed to give the user a choice of which
|
|
|
|
open_routine reader to use, then the following needs to change. */
|
2014-01-18 14:20:02 +00:00
|
|
|
wth = wtap_open_offline(infile, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
|
2012-09-20 10:28:05 +00:00
|
|
|
if (wth == NULL) {
|
2017-04-20 18:23:51 +00:00
|
|
|
cfile_open_failure_message("reordercap", infile, err, err_info);
|
2017-02-04 15:26:34 +00:00
|
|
|
ret = OPEN_ERROR;
|
|
|
|
goto clean_exit;
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
2015-11-16 21:02:43 +00:00
|
|
|
DEBUG_PRINT("file_type_subtype is %d\n", wtap_file_type_subtype(wth));
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2018-11-14 00:10:53 +00:00
|
|
|
wtap_dump_params_init(¶ms, wth);
|
2013-06-19 19:31:06 +00:00
|
|
|
|
2012-09-20 10:28:05 +00:00
|
|
|
/* Open outfile (same filetype/encap as input file) */
|
2015-11-10 01:21:46 +00:00
|
|
|
if (strcmp(outfile, "-") == 0) {
|
2018-11-16 04:06:36 +00:00
|
|
|
pdh = wtap_dump_open_stdout(wtap_file_type_subtype(wth), WTAP_UNCOMPRESSED, ¶ms, &err);
|
2015-11-10 01:21:46 +00:00
|
|
|
} else {
|
2018-11-16 04:06:36 +00:00
|
|
|
pdh = wtap_dump_open(outfile, wtap_file_type_subtype(wth), WTAP_UNCOMPRESSED, ¶ms, &err);
|
2015-11-10 01:21:46 +00:00
|
|
|
}
|
2018-11-14 00:10:53 +00:00
|
|
|
g_free(params.idb_inf);
|
|
|
|
params.idb_inf = NULL;
|
2015-07-20 14:35:06 +00:00
|
|
|
|
2012-09-20 10:28:05 +00:00
|
|
|
if (pdh == NULL) {
|
2017-04-20 18:23:51 +00:00
|
|
|
cfile_dump_open_failure_message("reordercap", outfile, err,
|
|
|
|
wtap_file_type_subtype(wth));
|
2018-11-14 00:10:53 +00:00
|
|
|
wtap_dump_params_cleanup(¶ms);
|
2017-02-04 15:26:34 +00:00
|
|
|
ret = OUTPUT_FILE_ERROR;
|
|
|
|
goto clean_exit;
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
/* Allocate the array of frame pointers. */
|
|
|
|
frames = g_ptr_array_new();
|
2012-09-20 10:28:05 +00:00
|
|
|
|
|
|
|
/* Read each frame from infile */
|
2019-04-05 01:56:27 +00:00
|
|
|
wtap_rec_init(&rec);
|
2019-04-06 21:02:49 +00:00
|
|
|
ws_buffer_init(&buf, 1514);
|
2019-04-05 01:56:27 +00:00
|
|
|
while (wtap_read(wth, &rec, &buf, &err, &err_info, &data_offset)) {
|
2014-05-23 10:50:02 +00:00
|
|
|
FrameRecord_t *newFrameRecord;
|
2012-10-04 18:24:21 +00:00
|
|
|
|
2014-05-23 10:50:02 +00:00
|
|
|
newFrameRecord = g_slice_new(FrameRecord_t);
|
|
|
|
newFrameRecord->num = frames->len + 1;
|
|
|
|
newFrameRecord->offset = data_offset;
|
2019-04-05 01:56:27 +00:00
|
|
|
if (rec.presence_flags & WTAP_HAS_TS) {
|
|
|
|
newFrameRecord->frame_time = rec.ts;
|
2014-05-23 23:40:56 +00:00
|
|
|
} else {
|
2015-09-28 13:11:44 +00:00
|
|
|
nstime_set_unset(&newFrameRecord->frame_time);
|
2014-05-23 23:40:56 +00:00
|
|
|
}
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2014-05-23 10:50:02 +00:00
|
|
|
if (prevFrame && frames_compare(&newFrameRecord, &prevFrame) < 0) {
|
|
|
|
wrong_order_count++;
|
2014-05-23 03:01:31 +00:00
|
|
|
}
|
2014-05-23 10:50:02 +00:00
|
|
|
|
|
|
|
g_ptr_array_add(frames, newFrameRecord);
|
|
|
|
prevFrame = newFrameRecord;
|
2012-10-04 18:24:21 +00:00
|
|
|
}
|
2019-04-05 01:56:27 +00:00
|
|
|
wtap_rec_cleanup(&rec);
|
|
|
|
ws_buffer_free(&buf);
|
2013-07-26 21:49:42 +00:00
|
|
|
if (err != 0) {
|
|
|
|
/* Print a message noting that the read failed somewhere along the line. */
|
2017-04-20 07:19:01 +00:00
|
|
|
cfile_read_failure_message("reordercap", infile, err, err_info);
|
2013-07-26 21:49:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
printf("%u frames, %u out of order\n", frames->len, wrong_order_count);
|
|
|
|
|
|
|
|
/* Sort the frames */
|
|
|
|
if (wrong_order_count > 0) {
|
|
|
|
g_ptr_array_sort(frames, frames_compare);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write out each sorted frame in turn */
|
2019-04-05 01:56:27 +00:00
|
|
|
wtap_rec_init(&rec);
|
2019-04-06 21:02:49 +00:00
|
|
|
ws_buffer_init(&buf, 1514);
|
2012-10-04 18:24:21 +00:00
|
|
|
for (i = 0; i < frames->len; i++) {
|
2013-03-20 01:18:10 +00:00
|
|
|
FrameRecord_t *frame = (FrameRecord_t *)frames->pdata[i];
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
/* Avoid writing if already sorted and configured to */
|
|
|
|
if (write_output_regardless || (wrong_order_count > 0)) {
|
2019-04-05 01:56:27 +00:00
|
|
|
frame_write(frame, wth, pdh, &rec, &buf, infile, outfile);
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
2012-10-04 18:24:21 +00:00
|
|
|
g_slice_free(FrameRecord_t, frame);
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
2019-04-05 01:56:27 +00:00
|
|
|
wtap_rec_cleanup(&rec);
|
2014-08-02 11:00:48 +00:00
|
|
|
ws_buffer_free(&buf);
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
if (!write_output_regardless && (wrong_order_count == 0)) {
|
2017-02-19 18:58:47 +00:00
|
|
|
printf("Not writing output file because input file is already in order.\n");
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 18:24:21 +00:00
|
|
|
/* Free the whole array */
|
|
|
|
g_ptr_array_free(frames, TRUE);
|
|
|
|
|
2012-09-20 10:28:05 +00:00
|
|
|
/* Close outfile */
|
2014-05-09 05:18:49 +00:00
|
|
|
if (!wtap_dump_close(pdh, &err)) {
|
2017-04-20 07:19:01 +00:00
|
|
|
cfile_close_failure_message(outfile, err);
|
2018-11-14 00:10:53 +00:00
|
|
|
wtap_dump_params_cleanup(¶ms);
|
2017-02-04 15:26:34 +00:00
|
|
|
ret = OUTPUT_FILE_ERROR;
|
|
|
|
goto clean_exit;
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
2018-11-14 00:10:53 +00:00
|
|
|
wtap_dump_params_cleanup(¶ms);
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2016-09-10 11:03:38 +00:00
|
|
|
/* Finally, close infile and release resources. */
|
|
|
|
wtap_close(wth);
|
2012-09-20 10:28:05 +00:00
|
|
|
|
2017-02-04 15:26:34 +00:00
|
|
|
clean_exit:
|
|
|
|
wtap_cleanup();
|
2017-02-20 14:36:54 +00:00
|
|
|
free_progdirs();
|
2017-02-04 15:26:34 +00:00
|
|
|
return ret;
|
2012-09-20 10:28:05 +00:00
|
|
|
}
|
|
|
|
|
2013-12-31 16:23:00 +00:00
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2013-12-31 16:23:00 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|