diff options
Diffstat (limited to 'ui/dissect_opts.c')
-rw-r--r-- | ui/dissect_opts.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/ui/dissect_opts.c b/ui/dissect_opts.c index 4369bd26..5f812faa 100644 --- a/ui/dissect_opts.c +++ b/ui/dissect_opts.c @@ -41,7 +41,7 @@ dissect_options global_dissect_options = { .time_precision = TS_PREC_NOT_SET }; -gboolean +bool dissect_opts_handle_opt(int opt, char *optarg_str_p) { char badopt; @@ -51,14 +51,14 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) switch(opt) { case 'd': /* Decode as rule */ if (!decode_as_command_option(optarg_str_p)) - return FALSE; + 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; + return false; #endif break; case 'n': /* No name resolution */ @@ -75,9 +75,11 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) "\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's' to enable address resolution using SNI information found in captured\n" + "\t handshake packets\n" "\t't' to enable transport-layer port number resolution\n" "\t'v' to enable VLAN IDs to names resolution"); - return FALSE; + return false; } break; case 't': /* Time stamp type */ @@ -92,12 +94,12 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) * Precision must be a number giving the number of * digits of precision. */ - guint32 val; + uint32_t val; if (!ws_strtou32(dotp + 1, NULL, &val) || val > WS_TSPREC_MAX) { cmdarg_err("Invalid .N time stamp precision \"%s\"; N must be a value between 0 and %u or absent", dotp + 1, WS_TSPREC_MAX); - return FALSE; + return false; } tsp = val; } @@ -139,7 +141,7 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) "\t\"udoy\" for absolute UTC with YYYY/DOY date"); if (dotp) *dotp = '.'; - return FALSE; + return false; } if (dotp) { *dotp = '.'; @@ -155,7 +157,7 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) 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; + return false; } break; case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */ @@ -167,7 +169,7 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) case LONGOPT_DISABLE_HEURISTIC: /* disable heuristic dissection of protocol */ global_dissect_options.disable_heur_slist = g_slist_append(global_dissect_options.disable_heur_slist, optarg_str_p); break; - case LONGOPT_ENABLE_PROTOCOL: /* enable dissection of protocol (that is disableed by default) */ + case LONGOPT_ENABLE_PROTOCOL: /* enable dissection of protocol (that is disabled by default) */ global_dissect_options.enable_protocol_slist = g_slist_append(global_dissect_options.enable_protocol_slist, optarg_str_p); break; case LONGOPT_ONLY_PROTOCOLS: /* enable dissection of these comma separated protocols only */ @@ -183,16 +185,16 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p) /* the caller is responsible to send us only the right opt's */ ws_assert_not_reached(); } - return TRUE; + return true; } -typedef gboolean (proto_set_func)(const char *); +typedef bool (proto_set_func)(const char *); -static gboolean +static bool process_enable_disable_list(GSList *list, proto_set_func callback) { - gboolean success = TRUE; - gboolean rv; + bool success = true; + bool rv; GSList *iter; char *c; char *proto_name; @@ -204,7 +206,7 @@ process_enable_disable_list(GSList *list, proto_set_func callback) rv = callback(proto_name); if (!rv) { cmdarg_err("No such protocol %s", proto_name); - success = FALSE; + success = false; } } else { @@ -220,7 +222,7 @@ process_enable_disable_list(GSList *list, proto_set_func callback) rv = callback(start); if (!rv) { cmdarg_err("No such protocol %s", start); - success = FALSE; + success = false; } if (c != NULL) { *c = save; @@ -237,18 +239,18 @@ process_enable_disable_list(GSList *list, proto_set_func callback) return success; } -gboolean +bool setup_enabled_and_disabled_protocols(void) { - gboolean success = TRUE; + bool success = true; - success &= process_enable_disable_list(global_dissect_options.disable_protocol_slist, + success = success && process_enable_disable_list(global_dissect_options.disable_protocol_slist, proto_disable_proto_by_name); - success &= process_enable_disable_list(global_dissect_options.enable_protocol_slist, + success = success && process_enable_disable_list(global_dissect_options.enable_protocol_slist, proto_enable_proto_by_name); - success &= process_enable_disable_list(global_dissect_options.enable_heur_slist, + success = success && process_enable_disable_list(global_dissect_options.enable_heur_slist, proto_enable_heuristic_by_name); - success &= process_enable_disable_list(global_dissect_options.disable_heur_slist, + success = success && process_enable_disable_list(global_dissect_options.disable_heur_slist, proto_disable_heuristic_by_name); return success; } |