aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes/ftypes.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 /epan/ftypes/ftypes.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 'epan/ftypes/ftypes.c')
-rw-r--r--epan/ftypes/ftypes.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c
index aa2239397f..58f4afda60 100644
--- a/epan/ftypes/ftypes.c
+++ b/epan/ftypes/ftypes.c
@@ -1,5 +1,5 @@
/*
- * $Id: ftypes.c,v 1.10 2003/07/25 03:44:03 gram Exp $
+ * $Id: ftypes.c,v 1.11 2003/08/27 15:23:08 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -198,6 +198,15 @@ ftype_can_le(enum ftenum ftype)
return ft->cmp_le ? TRUE : FALSE;
}
+gboolean
+ftype_can_contains(enum ftenum ftype)
+{
+ ftype_t *ft;
+
+ ft = ftype_lookup(ftype);
+ return ft->cmp_contains ? TRUE : FALSE;
+}
+
/* ---------------------------------------------------------- */
/* Allocate and initialize an fvalue_t, given an ftype */
@@ -236,13 +245,13 @@ fvalue_free(fvalue_t *fv)
}
fvalue_t*
-fvalue_from_unparsed(ftenum_t ftype, char *s, LogFunc logfunc)
+fvalue_from_unparsed(ftenum_t ftype, char *s, gboolean allow_partial_value, LogFunc logfunc)
{
fvalue_t *fv;
fv = fvalue_new(ftype);
if (fv->ftype->val_from_unparsed) {
- if (fv->ftype->val_from_unparsed(fv, s, logfunc)) {
+ if (fv->ftype->val_from_unparsed(fv, s, allow_partial_value, logfunc)) {
return fv;
}
}
@@ -507,3 +516,11 @@ fvalue_le(fvalue_t *a, fvalue_t *b)
g_assert(a->ftype->cmp_le);
return a->ftype->cmp_le(a, b);
}
+
+gboolean
+fvalue_contains(fvalue_t *a, fvalue_t *b)
+{
+ /* XXX - check compatibility of a and b */
+ g_assert(a->ftype->cmp_contains);
+ return a->ftype->cmp_contains(a, b);
+}