aboutsummaryrefslogtreecommitdiffstats
path: root/extcap_parser.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-12-29 14:57:53 +0100
committerAnders Broman <a.broman58@gmail.com>2015-12-30 08:11:57 +0000
commit0d47113ddc53714ecd6d3c1b58b694321649d89e (patch)
tree1fb4c3b5fe3092d6442aaf924b37b2e165c1c223 /extcap_parser.c
parent0921c8214ef225fe2b84c5ace0113ea1e931c70c (diff)
extcap: Add file extension check
The file-open dialog can now be set with file extensions, allowing the exclusion of unwanted file types. The syntax is the same as for the Qt QFileDialog, e.g.: "Wireshark (*.pcap *.pcapng)" Also, the mustexist option is now considered correctly Change-Id: I9d4efbb5089ce1af640b2a894de07ed79520271e Reviewed-on: https://code.wireshark.org/review/12913 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'extcap_parser.c')
-rw-r--r--extcap_parser.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/extcap_parser.c b/extcap_parser.c
index 154e4aa068..ef683f1a40 100644
--- a/extcap_parser.c
+++ b/extcap_parser.c
@@ -339,6 +339,8 @@ extcap_token_sentence *extcap_tokenize_sentence(const gchar *s) {
tv->param_type = EXTCAP_PARAM_TOOLTIP;
} else if (g_ascii_strcasecmp(tv->arg, "mustexist") == 0) {
tv->param_type = EXTCAP_PARAM_FILE_MUSTEXIST;
+ } else if (g_ascii_strcasecmp(tv->arg, "fileext") == 0) {
+ tv->param_type = EXTCAP_PARAM_FILE_EXTENSION;
} else if (g_ascii_strcasecmp(tv->arg, "name") == 0) {
tv->param_type = EXTCAP_PARAM_NAME;
} else if (g_ascii_strcasecmp(tv->arg, "enabled") == 0) {
@@ -477,6 +479,7 @@ extcap_arg *extcap_new_arg(void) {
r->range_end = NULL;
r->default_complex = NULL;
r->fileexists = FALSE;
+ r->fileextension = NULL;
r->is_required = FALSE;
r->values = NULL;
@@ -503,6 +506,9 @@ void extcap_free_arg(extcap_arg *a) {
if (a->tooltip != NULL)
g_free(a->tooltip);
+ if (a->fileextension != NULL)
+ g_free(a->fileextension);
+
if (a->range_start != NULL)
extcap_free_complex(a->range_start);
@@ -594,6 +600,11 @@ extcap_arg *extcap_parse_arg_sentence(GList * args, extcap_token_sentence *s) {
target_arg->fileexists = (v->value[0] == 't' || v->value[0] == 'T');
}
+ if ((v = extcap_find_param_by_type(s->param_list, EXTCAP_PARAM_FILE_EXTENSION))
+ != NULL) {
+ target_arg->fileextension = g_strdup(v->value);
+ }
+
if ((v = extcap_find_param_by_type(s->param_list, EXTCAP_PARAM_REQUIRED))
!= NULL) {
target_arg->is_required = (v->value[0] == 't' || v->value[0] == 'T');