aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-12-29 15:35:43 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-01-05 14:41:12 +0000
commitcfd5457ec0575be3b1b8726daf95fdc4da0e50fb (patch)
treefe3ff5d04d5f0c8d077831b3fb9135ae9520960e /extcap.c
parenta7e3ba03ce6eaeebc762322cb1691adeeda46ff8 (diff)
extcap: Add regular expression validation support
Regular expressions follow the Qt Regex syntax, which is formulated after the Perl Regex syntax. A more detailed overview of the possible rules can be found at: http://doc.qt.io/qt-4.8/qregexp.html If a required option is present, even the double-click on the interface will first start the options dialog (Qt only) Required fields are marked bold and put first in the dialog. Additionally if validation failes (which it will if a required field is kept empty, but also if a non-required textfield is violating the defined regex), the label of the field is marked with red. Change-Id: If04a1146d0dfa778332ab2a39122c7a6ee1e93d2 Reviewed-on: https://code.wireshark.org/review/12914 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/extcap.c b/extcap.c
index 0a5e19ba3c..6d66ad167c 100644
--- a/extcap.c
+++ b/extcap.c
@@ -440,7 +440,7 @@ extcap_get_if_configuration(const char * ifname) {
}
gboolean
-extcap_has_configuration(const char * ifname) {
+extcap_has_configuration(const char * ifname, gboolean is_required) {
GList * arguments = 0;
GList * walker = 0, * item = 0;
@@ -455,7 +455,11 @@ extcap_has_configuration(const char * ifname) {
while ( item != NULL && ! found )
{
if ( (extcap_arg *)(item->data) != NULL )
- found = TRUE;
+ {
+ /* Should required options be present, or any kind of options */
+ if ( ! is_required || ((extcap_arg *)(item->data))->is_required )
+ found = TRUE;
+ }
item = item->next;
}
@@ -869,7 +873,7 @@ void extcap_debug_arguments ( extcap_arg *arg_iter )
for ( walker = g_list_first ( arg_iter->value_list ); walker; walker = walker->next )
{
v = (extcap_value *)walker->data;
- if (v->is_default == TRUE)
+ if (v->is_default)
printf("*");
printf("\tcall=\"%p\" display=\"%p\"\n", v->call, v->display);
printf("\tcall=\"%s\" display=\"%s\"\n", v->call, v->display);