aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dfilter/dfvm.h
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-02-27 14:47:31 +0000
committerJoão Valverde <j@v6e.pt>2022-03-31 11:27:34 +0100
commit2a9cb588aa6fe2322d37cbe39604dd54b8477292 (patch)
treed5ced7003cf14f84dff4704c57566c518a0abf2d /epan/dfilter/dfvm.h
parentae537e24f03b3f06952276fce3c09b5f8a46bd79 (diff)
dfilter: Add binary arithmetic (add/subtract)
Add support for display filter binary addition and subtraction. The grammar is intentionally kept simple for now. The use case is to add a constant to a protocol field, or (maybe) add two fields in an expression. We use signed arithmetic with unsigned numbers, checking for overflow and casting where necessary to do the conversion. We could legitimately opt to use traditional modular arithmetic instead (like C) and if it turns out that that is more useful for some reason we may want to in the future. Fixes #15504.
Diffstat (limited to 'epan/dfilter/dfvm.h')
-rw-r--r--epan/dfilter/dfvm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/epan/dfilter/dfvm.h b/epan/dfilter/dfvm.h
index d5507c0830..83152ebb4c 100644
--- a/epan/dfilter/dfvm.h
+++ b/epan/dfilter/dfvm.h
@@ -69,6 +69,8 @@ typedef enum {
MK_RANGE,
MK_BITWISE_AND,
MK_MINUS,
+ DFVM_ADD,
+ DFVM_SUBTRACT,
CALL_FUNCTION,
ANY_IN_RANGE