summaryrefslogtreecommitdiff
path: root/ui/commandline.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-19 02:33:13 -0400
committerMichael Mann <mmann78@netscape.net>2016-06-19 18:59:07 +0000
commit147b3d5149ec6cfce1489f9922cc5e4ac0ca2209 (patch)
treef3dc7f2febdfe51dbef469c5cf4cefb9bb0d8c4a /ui/commandline.c
parentf4fc03d79b9e3aa3a63a1b88974b3417e308d96e (diff)
downloadwireshark-147b3d5149ec6cfce1489f9922cc5e4ac0ca2209.tar.gz
Ability to invoke "Decode As..." as command-line argument for GUIshark.
TShark has had the functionality for awhile. While the GUI version still has ways to change and persist Decode As functionality, adding command line functionality gives the Decode As from initial launch of the GUI. Was also an excuse to refactor a bunch of code out of tshark.c Bug: 5143 Change-Id: Ie67007d75e897bc06cc9afd9b84372a96b93778c Reviewed-on: https://code.wireshark.org/review/16008 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/commandline.c')
-rw-r--r--ui/commandline.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ui/commandline.c b/ui/commandline.c
index 4e6f28dba8..04b2d1cab9 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -1,4 +1,4 @@
-/* commandline.h
+/* commandline.c
* Common command line handling between GUIs
*
* Wireshark - Network traffic analyzer
@@ -56,6 +56,7 @@
#include "preference_utils.h"
#include "console.h"
#include "recent.h"
+#include "decode_as_utils.h"
#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
#include <epan/asn1.h>
@@ -134,6 +135,9 @@ commandline_print_usage(gboolean for_help_option) {
fprintf(output, " -R <read filter> packet filter in Wireshark display filter syntax\n");
fprintf(output, " -n disable all name resolutions (def: all enabled)\n");
fprintf(output, " -N <name resolve flags> enable specific name resolution(s): \"mnNtd\"\n");
+ fprintf(output, " -d %s ...\n", DECODE_AS_ARG_TEMPLATE);
+ fprintf(output, " \"Decode As\", see the man page for details\n");
+ fprintf(output, " Example: tcp.port==8888,http\n");
fprintf(output, " --disable-protocol <proto_name>\n");
fprintf(output, " disable dissection of proto_name\n");
fprintf(output, " --enable-heuristic <short_name>\n");
@@ -176,7 +180,7 @@ commandline_print_usage(gboolean for_help_option) {
#endif
}
-#define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:g:Hh" "jJ:kK:lm:nN:o:P:r:R:St:u:vw:X:Y:z:"
+#define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:d:g:Hh" "jJ:kK:lm:nN:o:P:r:R:St:u:vw:X:Y:z:"
static const struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"read-file", required_argument, NULL, 'r' },
@@ -400,6 +404,10 @@ void commandline_other_options(int argc, char *argv[], commandline_param_info_t*
case 'C':
/* Configuration profile settings were already processed just ignore them this time*/
break;
+ case 'd': /* Decode as rule */
+ if (!decode_as_command_option(optarg))
+ exit(1);
+ break;
case 'j': /* Search backwards for a matching packet from filter in option J */
param_info->jump_backwards = SD_BACKWARD;
break;