From 97a1a50e200a6c50e0014dde7e8ec932c30190a1 Mon Sep 17 00:00:00 2001 From: Roland Knall Date: Thu, 28 Jan 2016 10:41:38 +0100 Subject: extcap: Cleanup complex types and add save option Cleanup handling of complex data types and use only glib defined datatypes while handling argument values. Add a save parameter, which (additionally) can set, that a parameter is not saved in a configuration file. Passwords are by default not saved, which may be overwritten using this parameter Change-Id: I67eff0f3286170f082d532e806a39511c40df647 Reviewed-on: https://code.wireshark.org/review/13573 Petri-Dish: Roland Knall Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo Reviewed-by: Roland Knall --- extcap_parser.h | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'extcap_parser.h') diff --git a/extcap_parser.h b/extcap_parser.h index 83600510aa..d1074c8a9b 100644 --- a/extcap_parser.h +++ b/extcap_parser.h @@ -71,6 +71,7 @@ typedef enum { EXTCAP_PARAM_FILE_EXTENSION, EXTCAP_PARAM_PARENT, EXTCAP_PARAM_REQUIRED, + EXTCAP_PARAM_SAVE, EXTCAP_PARAM_VALIDATION, EXTCAP_PARAM_VERSION } extcap_param_type; @@ -91,15 +92,7 @@ typedef struct _extcap_value { /* Complex-ish struct for storing complex values */ typedef struct _extcap_complex { extcap_arg_type complex_type; - union { - int int_value; - unsigned int uint_value; - long long_value; - double double_value; - gboolean bool_value; - gchar *string_value; - } complex_value; - gboolean value_filled; + gchar * _val; } extcap_complex; /* An argument sentence and accompanying options */ @@ -114,6 +107,7 @@ typedef struct _extcap_arg { gboolean fileexists; gboolean is_required; + gboolean do_not_save; gchar * regexp; @@ -192,10 +186,10 @@ void extcap_printf_complex(extcap_complex *comp); */ gchar *extcap_get_complex_as_string(extcap_complex *comp); -int extcap_complex_get_int(extcap_complex *comp); -unsigned int extcap_complex_get_uint(extcap_complex *comp); -long extcap_complex_get_long(extcap_complex *comp); -double extcap_complex_get_double(extcap_complex *comp); +gint extcap_complex_get_int(extcap_complex *comp); +guint extcap_complex_get_uint(extcap_complex *comp); +gint64 extcap_complex_get_long(extcap_complex *comp); +gdouble extcap_complex_get_double(extcap_complex *comp); gboolean extcap_complex_get_bool(extcap_complex *comp); gchar *extcap_complex_get_string(extcap_complex *comp); @@ -221,8 +215,6 @@ extcap_token_param *extcap_find_param_by_type(extcap_token_param *first, void extcap_free_value(extcap_value *v); -extcap_arg *extcap_new_arg(void); - /* Free a single argument */ void extcap_free_arg(extcap_arg *a); -- cgit v1.2.3