aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes/ftype-ipv4.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2023-06-24 21:05:34 +0100
committerJoão Valverde <j@v6e.pt>2023-06-26 00:46:18 +0000
commit38a5b44d61cabf4ccda8adb89c94ae730f87d48c (patch)
tree56a1e4e7d64f64a42ff91b73a6a9c3e3855512ee /epan/ftypes/ftype-ipv4.c
parent0c4e9e83d3123bfdb9d26dda523a953b582697b8 (diff)
dflter: Fix semantics of fvalue length
Do not mix wire size, a protocol property, with fvalue length, a property of certain types of objects (sequences). Rename ftype_length() to ftype_wire_size(). Do not return wire_size with fvalue_length() (use ftype_wire_size() instead). Make the semantic check reject taking the len() of objects that are not arrays or lists. If the (fixed) len() of a number is somehow useful we can add a different function for that.
Diffstat (limited to 'epan/ftypes/ftype-ipv4.c')
-rw-r--r--epan/ftypes/ftype-ipv4.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c
index 9b02821d68..dc22944a0f 100644
--- a/epan/ftypes/ftype-ipv4.c
+++ b/epan/ftypes/ftype-ipv4.c
@@ -143,6 +143,12 @@ bitwise_and(fvalue_t *dst, const fvalue_t *fv_a, const fvalue_t *fv_b, char **er
return FT_OK;
}
+static guint
+len(fvalue_t *fv _U_)
+{
+ return 4;
+}
+
static void
slice(fvalue_t *fv, GByteArray *bytes, guint offset, guint length)
{
@@ -196,7 +202,7 @@ ftype_register_ipv4(void)
ipv4_hash,
is_zero,
NULL,
- NULL,
+ len,
slice,
bitwise_and,
NULL, /* unary_minus */