aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/dfilter_expr_dlg.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2003-08-27 15:23:11 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2003-08-27 15:23:11 +0000
commit52338a3bafa30b1c1ea6759ea14a60c5d3fd35da (patch)
treea4104c638529709d8c4f8b869d76c7f5253c6d16 /gtk/dfilter_expr_dlg.c
parentd3562c0480240333a99315699992e3165702a369 (diff)
Add a "contains" operator for byte-strings, strings, and tvbuffs (protocols).
The search uses a naive approach; more work is required to add a Boyer-Moore Search algorithm. svn path=/trunk/; revision=8280
Diffstat (limited to 'gtk/dfilter_expr_dlg.c')
-rw-r--r--gtk/dfilter_expr_dlg.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk/dfilter_expr_dlg.c b/gtk/dfilter_expr_dlg.c
index a91c8c68e3..20c79e19d9 100644
--- a/gtk/dfilter_expr_dlg.c
+++ b/gtk/dfilter_expr_dlg.c
@@ -7,7 +7,7 @@
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> and
* Guy Harris <guy@alum.mit.edu>
*
- * $Id: dfilter_expr_dlg.c,v 1.35 2003/08/25 00:15:02 guy Exp $
+ * $Id: dfilter_expr_dlg.c,v 1.36 2003/08/27 15:23:10 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -280,6 +280,9 @@ show_relations(GtkWidget *relation_label, GtkWidget *relation_list,
if (ftype_can_le(ftype) ||
(ftype_can_slice(ftype) && ftype_can_le(FT_BYTES)))
add_relation_list(relation_list, "<=");
+ if (ftype_can_contains(ftype) ||
+ (ftype_can_slice(ftype) && ftype_can_contains(FT_BYTES)))
+ add_relation_list(relation_list, "contains");
/*
* And show the list.
@@ -883,6 +886,8 @@ dfilter_expr_dlg_accept_cb(GtkWidget *w, gpointer filter_te_arg)
can_compare = ftype_can_ge(ftype);
else if (strcmp(item_str, "<=") == 0)
can_compare = ftype_can_le(ftype);
+ else if (strcmp(item_str, "contains") == 0)
+ can_compare = ftype_can_contains(ftype);
else
can_compare = TRUE; /* not a comparison */
if (!can_compare) {
@@ -928,8 +933,14 @@ dfilter_expr_dlg_accept_cb(GtkWidget *w, gpointer filter_te_arg)
* for the type of the field; if a range string was
* specified, must be valid for FT_BYTES.
*/
- fvalue = fvalue_from_unparsed(ftype, stripped_value_str,
- dfilter_report_bad_value);
+ if (strcmp(item_str, "contains") == 0) {
+ fvalue = fvalue_from_unparsed(ftype, stripped_value_str, TRUE,
+ dfilter_report_bad_value);
+ }
+ else {
+ fvalue = fvalue_from_unparsed(ftype, stripped_value_str, FALSE,
+ dfilter_report_bad_value);
+ }
if (fvalue == NULL) {
/*
* It's not valid.