2001-02-01 20:31:21 +00:00
|
|
|
/*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
2008-01-08 22:54:51 +00:00
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-02-01 20:31:21 +00:00
|
|
|
* Copyright 2001 Gerald Combs
|
|
|
|
*
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2001-02-01 20:31:21 +00:00
|
|
|
*/
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
#include "syntax-tree.h"
|
|
|
|
#include "sttype-test.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guint32 magic;
|
|
|
|
test_op_t op;
|
|
|
|
stnode_t *val1;
|
|
|
|
stnode_t *val2;
|
|
|
|
} test_t;
|
|
|
|
|
|
|
|
#define TEST_MAGIC 0xab9009ba
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
test_new(gpointer junk)
|
|
|
|
{
|
2021-10-26 12:53:06 +00:00
|
|
|
test_t *test;
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2021-12-16 10:19:45 +00:00
|
|
|
ws_assert(junk == NULL);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
test = g_new(test_t, 1);
|
|
|
|
|
|
|
|
test->magic = TEST_MAGIC;
|
|
|
|
test->op = TEST_OP_UNINITIALIZED;
|
|
|
|
test->val1 = NULL;
|
|
|
|
test->val2 = NULL;
|
|
|
|
|
2021-10-26 12:53:06 +00:00
|
|
|
return test;
|
2001-02-01 20:21:25 +00:00
|
|
|
}
|
|
|
|
|
2012-06-19 12:12:41 +00:00
|
|
|
static gpointer
|
|
|
|
test_dup(gconstpointer data)
|
|
|
|
{
|
2021-10-26 12:53:06 +00:00
|
|
|
const test_t *org = data;
|
|
|
|
test_t *test;
|
2012-06-19 12:12:41 +00:00
|
|
|
|
2021-10-26 12:53:06 +00:00
|
|
|
test = test_new(NULL);
|
2012-06-19 12:12:41 +00:00
|
|
|
test->op = org->op;
|
|
|
|
test->val1 = stnode_dup(org->val1);
|
|
|
|
test->val2 = stnode_dup(org->val1);
|
|
|
|
|
2021-10-26 12:53:06 +00:00
|
|
|
return test;
|
2012-06-19 12:12:41 +00:00
|
|
|
}
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
static void
|
|
|
|
test_free(gpointer value)
|
|
|
|
{
|
2021-10-26 12:53:06 +00:00
|
|
|
test_t *test = value;
|
2021-10-06 11:21:59 +00:00
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
if (test->val1)
|
|
|
|
stnode_free(test->val1);
|
|
|
|
if (test->val2)
|
|
|
|
stnode_free(test->val2);
|
|
|
|
|
|
|
|
g_free(test);
|
|
|
|
}
|
|
|
|
|
2021-11-28 01:10:11 +00:00
|
|
|
static const char *
|
|
|
|
test_todisplay(test_op_t op)
|
2021-09-26 15:28:39 +00:00
|
|
|
{
|
2022-02-27 09:56:41 +00:00
|
|
|
const char *s = "<notset>";
|
2021-09-26 15:28:39 +00:00
|
|
|
|
2021-11-28 01:10:11 +00:00
|
|
|
switch(op) {
|
|
|
|
case TEST_OP_EXISTS:
|
2022-02-25 19:37:53 +00:00
|
|
|
s = "<exists>";
|
2021-11-28 01:10:11 +00:00
|
|
|
break;
|
|
|
|
case TEST_OP_NOT:
|
|
|
|
s = "!";
|
|
|
|
break;
|
|
|
|
case TEST_OP_AND:
|
|
|
|
s = "&&";
|
|
|
|
break;
|
|
|
|
case TEST_OP_OR:
|
|
|
|
s = "||";
|
|
|
|
break;
|
2021-12-13 01:06:01 +00:00
|
|
|
case TEST_OP_ALL_EQ:
|
|
|
|
s = "===";
|
|
|
|
break;
|
2021-11-28 01:10:11 +00:00
|
|
|
case TEST_OP_ANY_EQ:
|
|
|
|
s = "==";
|
|
|
|
break;
|
|
|
|
case TEST_OP_ALL_NE:
|
|
|
|
s = "!=";
|
|
|
|
break;
|
|
|
|
case TEST_OP_ANY_NE:
|
|
|
|
s = "~=";
|
|
|
|
break;
|
|
|
|
case TEST_OP_GT:
|
|
|
|
s = ">";
|
|
|
|
break;
|
|
|
|
case TEST_OP_GE:
|
|
|
|
s = ">=";
|
|
|
|
break;
|
|
|
|
case TEST_OP_LT:
|
|
|
|
s = "<";
|
|
|
|
break;
|
|
|
|
case TEST_OP_LE:
|
|
|
|
s = "<=";
|
|
|
|
break;
|
2022-02-25 19:37:53 +00:00
|
|
|
case OP_BITWISE_AND:
|
2021-11-28 01:10:11 +00:00
|
|
|
s = "&";
|
|
|
|
break;
|
2022-02-27 14:47:31 +00:00
|
|
|
case OP_ADD:
|
|
|
|
s = "+";
|
|
|
|
break;
|
2022-02-27 09:56:41 +00:00
|
|
|
case OP_UNARY_MINUS:
|
2022-02-27 14:47:31 +00:00
|
|
|
case OP_SUBTRACT:
|
2022-02-27 09:56:41 +00:00
|
|
|
s = "-";
|
|
|
|
break;
|
2022-03-31 13:50:20 +00:00
|
|
|
case OP_MULTIPLY:
|
|
|
|
s = "*";
|
|
|
|
break;
|
|
|
|
case OP_DIVIDE:
|
|
|
|
s = "/";
|
|
|
|
break;
|
|
|
|
case OP_MODULO:
|
|
|
|
s = "%";
|
|
|
|
break;
|
2022-02-25 19:37:53 +00:00
|
|
|
case TEST_OP_NOTZERO:
|
|
|
|
s = "<notzero>";
|
|
|
|
break;
|
2021-11-28 01:10:11 +00:00
|
|
|
case TEST_OP_CONTAINS:
|
|
|
|
s = "contains";
|
|
|
|
break;
|
|
|
|
case TEST_OP_MATCHES:
|
|
|
|
s = "matches";
|
|
|
|
break;
|
|
|
|
case TEST_OP_IN:
|
|
|
|
s = "in";
|
|
|
|
break;
|
|
|
|
case TEST_OP_UNINITIALIZED:
|
|
|
|
s = "<uninitialized>";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
2021-10-21 08:03:51 +00:00
|
|
|
|
2021-11-28 01:10:11 +00:00
|
|
|
static const char *
|
|
|
|
test_todebug(test_op_t op)
|
|
|
|
{
|
2022-02-27 09:56:41 +00:00
|
|
|
const char *s = "<notset>";
|
2021-09-26 15:28:39 +00:00
|
|
|
|
2021-11-28 01:10:11 +00:00
|
|
|
switch(op) {
|
2021-09-26 15:28:39 +00:00
|
|
|
case TEST_OP_EXISTS:
|
2021-09-30 16:05:02 +00:00
|
|
|
s = "TEST_EXISTS";
|
2021-09-26 15:28:39 +00:00
|
|
|
break;
|
|
|
|
case TEST_OP_NOT:
|
|
|
|
s = "TEST_NOT";
|
|
|
|
break;
|
|
|
|
case TEST_OP_AND:
|
|
|
|
s = "TEST_AND";
|
|
|
|
break;
|
|
|
|
case TEST_OP_OR:
|
|
|
|
s = "TEST_OR";
|
|
|
|
break;
|
2021-12-13 01:06:01 +00:00
|
|
|
case TEST_OP_ALL_EQ:
|
|
|
|
s = "TEST_ALL_EQ";
|
|
|
|
break;
|
dfilter: Fix "!=" relation to be free of contradictions
Wireshark defines the relation of equality A == B as
A any_eq B <=> An == Bn for at least one An, Bn.
More accurately I think this is (formally) an equivalence
relation, not true equality.
Whichever definition for "==" we choose we must keep the
definition of "!=" as !(A == B), otherwise it will
lead to logical contradictions like (A == B) AND (A != B)
being true.
Fix the '!=' relation to match the definition of equality:
A != B <=> !(A == B) <=> A all_ne B <=> An != Bn, for
every n.
This has been the recomended way to write "not equal" for a
long time in the documentation, even to the point where != was
deprecated, but it just wasn't implemented consistently in the
language, which has understandably been a persistent source
of confusion. Even a field that is normally well-behaved
with "!=" like "ip.src" or "ip.dst" will produce unexpected
results with encapsulations like IP-over-IP.
The opcode ALL_NE could have been implemented in the compiler
instead using NOT and ANY_EQ but I chose to implement it in
bytecode. It just seemed more elegant and efficient
but the difference was not very significant.
Keep around "~=" for any_ne relation, in case someone depends
on that, and because we don't have an operator for true equality:
A strict_equal B <=> A all_eq B <=> !(A any_ne B).
If there is only one value then any_ne and all_ne are the same
comparison operation.
Implementing this change did not require fixing any tests so it
is unlikely the relation "~=" (any_ne) will be very useful.
Note that the behaviour of the '<' (less than) comparison relation
is a separate, more subtle issue. In the general case the definition
of '<' that is used is only a partial order.
2021-10-18 20:07:06 +00:00
|
|
|
case TEST_OP_ANY_EQ:
|
|
|
|
s = "TEST_ANY_EQ";
|
2021-09-26 15:28:39 +00:00
|
|
|
break;
|
dfilter: Fix "!=" relation to be free of contradictions
Wireshark defines the relation of equality A == B as
A any_eq B <=> An == Bn for at least one An, Bn.
More accurately I think this is (formally) an equivalence
relation, not true equality.
Whichever definition for "==" we choose we must keep the
definition of "!=" as !(A == B), otherwise it will
lead to logical contradictions like (A == B) AND (A != B)
being true.
Fix the '!=' relation to match the definition of equality:
A != B <=> !(A == B) <=> A all_ne B <=> An != Bn, for
every n.
This has been the recomended way to write "not equal" for a
long time in the documentation, even to the point where != was
deprecated, but it just wasn't implemented consistently in the
language, which has understandably been a persistent source
of confusion. Even a field that is normally well-behaved
with "!=" like "ip.src" or "ip.dst" will produce unexpected
results with encapsulations like IP-over-IP.
The opcode ALL_NE could have been implemented in the compiler
instead using NOT and ANY_EQ but I chose to implement it in
bytecode. It just seemed more elegant and efficient
but the difference was not very significant.
Keep around "~=" for any_ne relation, in case someone depends
on that, and because we don't have an operator for true equality:
A strict_equal B <=> A all_eq B <=> !(A any_ne B).
If there is only one value then any_ne and all_ne are the same
comparison operation.
Implementing this change did not require fixing any tests so it
is unlikely the relation "~=" (any_ne) will be very useful.
Note that the behaviour of the '<' (less than) comparison relation
is a separate, more subtle issue. In the general case the definition
of '<' that is used is only a partial order.
2021-10-18 20:07:06 +00:00
|
|
|
case TEST_OP_ALL_NE:
|
|
|
|
s = "TEST_ALL_NE";
|
|
|
|
break;
|
|
|
|
case TEST_OP_ANY_NE:
|
|
|
|
s = "TEST_ANY_NE";
|
2021-09-26 15:28:39 +00:00
|
|
|
break;
|
|
|
|
case TEST_OP_GT:
|
|
|
|
s = "TEST_GT";
|
|
|
|
break;
|
|
|
|
case TEST_OP_GE:
|
|
|
|
s = "TEST_GE";
|
|
|
|
break;
|
|
|
|
case TEST_OP_LT:
|
|
|
|
s = "TEST_LT";
|
|
|
|
break;
|
|
|
|
case TEST_OP_LE:
|
|
|
|
s = "TEST_LE";
|
|
|
|
break;
|
2022-02-25 19:37:53 +00:00
|
|
|
case OP_BITWISE_AND:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_BITWISE_AND";
|
2022-02-25 19:37:53 +00:00
|
|
|
break;
|
2022-02-27 09:56:41 +00:00
|
|
|
case OP_UNARY_MINUS:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_UNARY_MINUS";
|
2022-02-27 09:56:41 +00:00
|
|
|
break;
|
2022-02-27 14:47:31 +00:00
|
|
|
case OP_ADD:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_ADD";
|
2022-02-27 14:47:31 +00:00
|
|
|
break;
|
|
|
|
case OP_SUBTRACT:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_SUBTRACT";
|
2022-02-27 14:47:31 +00:00
|
|
|
break;
|
2022-03-31 13:50:20 +00:00
|
|
|
case OP_MULTIPLY:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_MULTIPLY";
|
2022-03-31 13:50:20 +00:00
|
|
|
break;
|
|
|
|
case OP_DIVIDE:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_DIVIDE";
|
2022-03-31 13:50:20 +00:00
|
|
|
break;
|
|
|
|
case OP_MODULO:
|
2022-04-04 22:42:52 +00:00
|
|
|
s = "OP_MODULO";
|
2022-03-31 13:50:20 +00:00
|
|
|
break;
|
2022-02-25 19:37:53 +00:00
|
|
|
case TEST_OP_NOTZERO:
|
|
|
|
s = "TEST_NOTZERO";
|
2021-09-26 15:28:39 +00:00
|
|
|
break;
|
|
|
|
case TEST_OP_CONTAINS:
|
|
|
|
s = "TEST_CONTAINS";
|
|
|
|
break;
|
|
|
|
case TEST_OP_MATCHES:
|
|
|
|
s = "TEST_MATCHES";
|
|
|
|
break;
|
|
|
|
case TEST_OP_IN:
|
|
|
|
s = "TEST_IN";
|
|
|
|
break;
|
|
|
|
case TEST_OP_UNINITIALIZED:
|
|
|
|
s = "<uninitialized>";
|
|
|
|
break;
|
|
|
|
}
|
2021-11-28 01:10:11 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
test_tostr(const void *value, gboolean pretty)
|
|
|
|
{
|
|
|
|
const test_t *test = value;
|
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
if (pretty)
|
|
|
|
s = test_todisplay(test->op);
|
|
|
|
else
|
|
|
|
s = test_todebug(test->op);
|
2021-09-26 15:28:39 +00:00
|
|
|
return g_strdup(s);
|
|
|
|
}
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
static int
|
|
|
|
num_operands(test_op_t op)
|
|
|
|
{
|
|
|
|
switch(op) {
|
|
|
|
case TEST_OP_UNINITIALIZED:
|
2011-10-25 14:19:34 +00:00
|
|
|
break;
|
2001-02-01 20:21:25 +00:00
|
|
|
case TEST_OP_EXISTS:
|
|
|
|
case TEST_OP_NOT:
|
2022-02-25 19:37:53 +00:00
|
|
|
case TEST_OP_NOTZERO:
|
2022-02-27 09:56:41 +00:00
|
|
|
case OP_UNARY_MINUS:
|
2001-02-01 20:21:25 +00:00
|
|
|
return 1;
|
|
|
|
case TEST_OP_AND:
|
|
|
|
case TEST_OP_OR:
|
2021-12-13 01:06:01 +00:00
|
|
|
case TEST_OP_ALL_EQ:
|
dfilter: Fix "!=" relation to be free of contradictions
Wireshark defines the relation of equality A == B as
A any_eq B <=> An == Bn for at least one An, Bn.
More accurately I think this is (formally) an equivalence
relation, not true equality.
Whichever definition for "==" we choose we must keep the
definition of "!=" as !(A == B), otherwise it will
lead to logical contradictions like (A == B) AND (A != B)
being true.
Fix the '!=' relation to match the definition of equality:
A != B <=> !(A == B) <=> A all_ne B <=> An != Bn, for
every n.
This has been the recomended way to write "not equal" for a
long time in the documentation, even to the point where != was
deprecated, but it just wasn't implemented consistently in the
language, which has understandably been a persistent source
of confusion. Even a field that is normally well-behaved
with "!=" like "ip.src" or "ip.dst" will produce unexpected
results with encapsulations like IP-over-IP.
The opcode ALL_NE could have been implemented in the compiler
instead using NOT and ANY_EQ but I chose to implement it in
bytecode. It just seemed more elegant and efficient
but the difference was not very significant.
Keep around "~=" for any_ne relation, in case someone depends
on that, and because we don't have an operator for true equality:
A strict_equal B <=> A all_eq B <=> !(A any_ne B).
If there is only one value then any_ne and all_ne are the same
comparison operation.
Implementing this change did not require fixing any tests so it
is unlikely the relation "~=" (any_ne) will be very useful.
Note that the behaviour of the '<' (less than) comparison relation
is a separate, more subtle issue. In the general case the definition
of '<' that is used is only a partial order.
2021-10-18 20:07:06 +00:00
|
|
|
case TEST_OP_ANY_EQ:
|
|
|
|
case TEST_OP_ALL_NE:
|
|
|
|
case TEST_OP_ANY_NE:
|
2001-02-01 20:21:25 +00:00
|
|
|
case TEST_OP_GT:
|
|
|
|
case TEST_OP_GE:
|
|
|
|
case TEST_OP_LT:
|
|
|
|
case TEST_OP_LE:
|
2022-02-25 19:37:53 +00:00
|
|
|
case OP_BITWISE_AND:
|
2022-02-27 14:47:31 +00:00
|
|
|
case OP_ADD:
|
|
|
|
case OP_SUBTRACT:
|
2022-03-31 13:50:20 +00:00
|
|
|
case OP_MULTIPLY:
|
|
|
|
case OP_DIVIDE:
|
|
|
|
case OP_MODULO:
|
2003-08-27 15:23:11 +00:00
|
|
|
case TEST_OP_CONTAINS:
|
2003-12-06 16:35:20 +00:00
|
|
|
case TEST_OP_MATCHES:
|
2015-08-19 03:03:41 +00:00
|
|
|
case TEST_OP_IN:
|
2003-12-06 16:35:20 +00:00
|
|
|
return 2;
|
2001-02-01 20:21:25 +00:00
|
|
|
}
|
2021-12-16 10:19:45 +00:00
|
|
|
ws_assert_not_reached();
|
2001-02-01 20:21:25 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
sttype_test_set1(stnode_t *node, test_op_t op, stnode_t *val1)
|
|
|
|
{
|
2021-10-26 12:53:06 +00:00
|
|
|
test_t *test = stnode_data(node);
|
2021-10-06 11:21:59 +00:00
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2021-12-16 10:19:45 +00:00
|
|
|
ws_assert(num_operands(op) == 1);
|
2001-02-01 20:21:25 +00:00
|
|
|
test->op = op;
|
|
|
|
test->val1 = val1;
|
2022-04-04 22:42:52 +00:00
|
|
|
test->val2 = NULL;
|
2001-02-01 20:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sttype_test_set2(stnode_t *node, test_op_t op, stnode_t *val1, stnode_t *val2)
|
|
|
|
{
|
2021-10-26 12:53:06 +00:00
|
|
|
test_t *test = stnode_data(node);
|
2021-10-06 11:21:59 +00:00
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2021-12-16 10:19:45 +00:00
|
|
|
ws_assert(num_operands(op) == 2);
|
2001-02-01 20:21:25 +00:00
|
|
|
test->op = op;
|
|
|
|
test->val1 = val1;
|
|
|
|
test->val2 = val2;
|
|
|
|
}
|
|
|
|
|
2021-11-28 01:10:11 +00:00
|
|
|
void
|
|
|
|
sttype_test_set1_args(stnode_t *node, stnode_t *val1)
|
|
|
|
{
|
|
|
|
test_t *test;
|
|
|
|
|
|
|
|
test = (test_t*)stnode_data(node);
|
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
|
|
|
|
2021-12-16 10:19:45 +00:00
|
|
|
ws_assert(num_operands(test->op) == 1);
|
2021-11-28 01:10:11 +00:00
|
|
|
test->val1 = val1;
|
2022-04-04 22:42:52 +00:00
|
|
|
test->val2 = NULL;
|
2021-11-28 01:10:11 +00:00
|
|
|
}
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
void
|
|
|
|
sttype_test_set2_args(stnode_t *node, stnode_t *val1, stnode_t *val2)
|
|
|
|
{
|
|
|
|
test_t *test;
|
|
|
|
|
2012-06-03 20:59:41 +00:00
|
|
|
test = (test_t*)stnode_data(node);
|
2021-10-06 11:21:59 +00:00
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2021-12-16 10:19:45 +00:00
|
|
|
ws_assert(num_operands(test->op) == 2);
|
2001-02-01 20:21:25 +00:00
|
|
|
test->val1 = val1;
|
|
|
|
test->val2 = val2;
|
|
|
|
}
|
|
|
|
|
2021-11-28 01:10:11 +00:00
|
|
|
void
|
|
|
|
sttype_test_set_op(stnode_t *node, test_op_t op)
|
|
|
|
{
|
|
|
|
test_t *test = stnode_data(node);
|
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
|
|
|
ws_assert(test->op == TEST_OP_UNINITIALIZED);
|
|
|
|
test->op = op;
|
|
|
|
}
|
|
|
|
|
2021-10-21 08:03:51 +00:00
|
|
|
test_op_t
|
|
|
|
sttype_test_get_op(stnode_t *node)
|
|
|
|
{
|
|
|
|
ws_assert_magic(node, TEST_MAGIC);
|
|
|
|
return ((test_t *)node)->op;
|
|
|
|
}
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
void
|
|
|
|
sttype_test_get(stnode_t *node, test_op_t *p_op, stnode_t **p_val1, stnode_t **p_val2)
|
|
|
|
{
|
2021-10-26 12:53:06 +00:00
|
|
|
test_t *test = stnode_data(node);
|
2021-10-06 11:21:59 +00:00
|
|
|
ws_assert_magic(test, TEST_MAGIC);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2012-06-19 12:12:41 +00:00
|
|
|
if (p_op)
|
|
|
|
*p_op = test->op;
|
|
|
|
if (p_val1)
|
|
|
|
*p_val1 = test->val1;
|
|
|
|
if (p_val2)
|
|
|
|
*p_val2 = test->val2;
|
2001-02-01 20:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sttype_register_test(void)
|
|
|
|
{
|
|
|
|
static sttype_t test_type = {
|
|
|
|
STTYPE_TEST,
|
|
|
|
"TEST",
|
|
|
|
test_new,
|
|
|
|
test_free,
|
2021-09-26 15:28:39 +00:00
|
|
|
test_dup,
|
|
|
|
test_tostr
|
2001-02-01 20:21:25 +00:00
|
|
|
};
|
2022-02-25 19:37:53 +00:00
|
|
|
/* XXX Bitwise ops are not "tests". */
|
|
|
|
static sttype_t bitwise_type = {
|
|
|
|
STTYPE_BITWISE,
|
|
|
|
"BITWISE",
|
|
|
|
test_new,
|
|
|
|
test_free,
|
|
|
|
test_dup,
|
|
|
|
test_tostr
|
|
|
|
};
|
2022-02-27 09:56:41 +00:00
|
|
|
static sttype_t arithmetic_type = {
|
|
|
|
STTYPE_ARITHMETIC,
|
|
|
|
"ARITHMETIC",
|
|
|
|
test_new,
|
|
|
|
test_free,
|
|
|
|
test_dup,
|
|
|
|
test_tostr
|
|
|
|
};
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
sttype_register(&test_type);
|
2022-02-25 19:37:53 +00:00
|
|
|
sttype_register(&bitwise_type);
|
2022-02-27 09:56:41 +00:00
|
|
|
sttype_register(&arithmetic_type);
|
2001-02-01 20:21:25 +00:00
|
|
|
}
|
2015-02-13 19:02:43 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2015-02-13 19:02:43 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|