summaryrefslogtreecommitdiff
path: root/tshark.c
diff options
context:
space:
mode:
authorMoshe Kaplan <me@moshekaplan.com>2016-11-24 09:37:01 -0500
committerMichael Mann <mmann78@netscape.net>2016-12-02 16:07:35 +0000
commit20c57cb298e4f3b7ac66a22fb7477e4cf424a11b (patch)
tree3929a45a2f0df5182af007af697edfa9a55a4634 /tshark.c
parent9ca313cfbe4993a0a36520d216a3e4282b0b7b99 (diff)
downloadwireshark-20c57cb298e4f3b7ac66a22fb7477e4cf424a11b.tar.gz
Enable exporting objects with tshark
A new "--export-object <protocol>,<destdir>" option is added to tshark. This required refactoring Export Object behavior in all GUIs to give the export object handling to the dissector, rather than the ui layer. Included in the refactoring was fixing some serious memory leaks in Qt Export Object dialog, crash due to memory scope issues in GTK Export Object dialog, and addition sorting column feature in Qt dialog (set up by creating a widget to manage the items that were previously leaking memory) Bug: 9319 Ping-Bug: 13174 Change-Id: I515d7662fa1f150f672b1476716f347ec27deb9b Reviewed-on: https://code.wireshark.org/review/18927 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tshark.c b/tshark.c
index ff290c2f15..79bc27a81b 100644
--- a/tshark.c
+++ b/tshark.c
@@ -85,6 +85,7 @@
#include "ui/ui_util.h"
#include "ui/decode_as_utils.h"
#include "ui/cli/tshark-tap.h"
+#include "ui/cli/tap-exportobject.h"
#include "ui/tap_export_pdu.h"
#include "ui/dissect_opts.h"
#include "register.h"
@@ -396,6 +397,8 @@ print_usage(FILE *output)
fprintf(output, " --capture-comment <comment>\n");
fprintf(output, " add a capture comment to the newly created\n");
fprintf(output, " output file (only for pcapng)\n");
+ fprintf(output, " --export-objects <protocol>,<destdir> save exported objects for a protocol to\n");
+ fprintf(output, " a directory named \"destdir\"\n");
fprintf(output, "\n");
fprintf(output, "Miscellaneous:\n");
@@ -538,6 +541,7 @@ main(int argc, char *argv[])
{"version", no_argument, NULL, 'v'},
LONGOPT_CAPTURE_COMMON
LONGOPT_DISSECT_COMMON
+ {"export-objects", required_argument, NULL, LONGOPT_EXPORT_OBJECTS},
{0, 0, 0, 0 }
};
gboolean arg_error = FALSE;
@@ -1282,6 +1286,15 @@ main(int argc, char *argv[])
if (!dissect_opts_handle_opt(opt, optarg))
return 1;
break;
+ case LONGOPT_EXPORT_OBJECTS: /* --export-objects */
+ if (strcmp("help", optarg) == 0) {
+ fprintf(stderr, "tshark: The available export object types for the \"--export-objects\" option are:\n");
+ eo_list_object_types();
+ return 0;
+ }
+ if (!eo_tap_opt_add(optarg))
+ return 1;
+ break;
default:
case '?': /* Bad flag - print usage message */
switch(optopt) {
@@ -1572,6 +1585,9 @@ main(int argc, char *argv[])
of the filter. We can now process all the "-z" arguments. */
start_requested_stats();
+ /* We can also enable specified taps for export object */
+ start_exportobjects();
+
/* At this point MATE will have registered its field array so we can
check if the fields specified by the user are all good.
*/