aboutsummaryrefslogtreecommitdiffstats
path: root/ui/dissect_opts.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-10-30 18:47:59 -0700
committerGuy Harris <guy@alum.mit.edu>2016-10-31 05:05:50 +0000
commit5aacafba8e53b3c17f00181e91418927d1c94efe (patch)
treef570d5f90dbd6e2bbfd4687dea5a813fa4c22b9c /ui/dissect_opts.c
parent706c10663499b90639ab8e46e171c4d4952778bf (diff)
Handle -K, -n, -N, and -u in the common dissection option code.
Also update tfshark to use that code. Change-Id: Ic03fb8ff48c8bfc460298d180b436e53f0076cbe Reviewed-on: https://code.wireshark.org/review/18588 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/dissect_opts.c')
-rw-r--r--ui/dissect_opts.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/ui/dissect_opts.c b/ui/dissect_opts.c
index 471f0467fd..267b363669 100644
--- a/ui/dissect_opts.c
+++ b/ui/dissect_opts.c
@@ -31,10 +31,16 @@
#include <glib.h>
+#include <epan/prefs.h>
#include <epan/timestamp.h>
+#include <epan/addr_resolv.h>
#include "ui/decode_as_utils.h"
+#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
+#include <epan/dissectors/read_keytab_file.h>
+#endif
+
#include <wsutil/clopts_common.h>
#include <wsutil/cmdarg_err.h>
#include <wsutil/file_util.h>
@@ -55,11 +61,38 @@ dissect_opts_init(void)
gboolean
dissect_opts_handle_opt(int opt, char *optarg_str_p)
{
+ char badopt;
+
switch(opt) {
case 'd': /* Decode as rule */
if (!decode_as_command_option(optarg_str_p))
return FALSE;
break;
+ case 'K': /* Kerberos keytab file */
+#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
+ read_keytab_file(optarg_str_p);
+#else
+ cmdarg_err("-K specified, but Kerberos keytab file support isn't present");
+ return FALSE;
+#endif
+ break;
+ case 'n': /* No name resolution */
+ disable_name_resolution();
+ break;
+ case 'N': /* Select what types of addresses/port #s to resolve */
+ badopt = string_to_name_resolve(optarg_str_p, &gbl_resolv_flags);
+ if (badopt != '\0') {
+ cmdarg_err("-N specifies unknown resolving option '%c'; valid options are:",
+ badopt);
+ cmdarg_err_cont("\t'd' to enable address resolution from captured DNS packets\n"
+ "\t'm' to enable MAC address resolution\n"
+ "\t'n' to enable network address resolution\n"
+ "\t'N' to enable using external resolvers (e.g., DNS)\n"
+ "\t for network address resolution\n"
+ "\t't' to enable transport-layer port number resolution");
+ return FALSE;
+ }
+ break;
case 't': /* Time stamp type */
if (strcmp(optarg_str_p, "r") == 0)
global_dissect_options.time_format = TS_RELATIVE;
@@ -96,6 +129,18 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p)
return FALSE;
}
break;
+ case 'u': /* Seconds type */
+ if (strcmp(optarg_str_p, "s") == 0)
+ timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
+ else if (strcmp(optarg_str_p, "hms") == 0)
+ timestamp_set_seconds_type(TS_SECONDS_HOUR_MIN_SEC);
+ else {
+ cmdarg_err("Invalid seconds type \"%s\"; it must be one of:", optarg_str_p);
+ cmdarg_err_cont("\t\"s\" for seconds\n"
+ "\t\"hms\" for hours, minutes and seconds");
+ return FALSE;
+ }
+ break;
case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */
global_dissect_options.disable_protocol_slist = g_slist_append(global_dissect_options.disable_protocol_slist, optarg_str_p);
break;