diff options
Diffstat (limited to 'src/expr_ops.c')
-rw-r--r-- | src/expr_ops.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/expr_ops.c b/src/expr_ops.c new file mode 100644 index 0000000..2b21d96 --- /dev/null +++ b/src/expr_ops.c @@ -0,0 +1,36 @@ +#include <string.h> + +#include "expr_ops.h" + +extern struct expr_ops expr_ops_cmp; +extern struct expr_ops expr_ops_counter; +extern struct expr_ops expr_ops_immediate; +extern struct expr_ops expr_ops_match; +extern struct expr_ops expr_ops_meta; +extern struct expr_ops expr_ops_payload; +extern struct expr_ops expr_ops_target; + +struct expr_ops *expr_ops[] = { + &expr_ops_cmp, + &expr_ops_counter, + &expr_ops_immediate, + &expr_ops_match, + &expr_ops_meta, + &expr_ops_payload, + &expr_ops_target, + NULL, +}; + +struct expr_ops *nft_expr_ops_lookup(const char *name) +{ + int i = 0; + + while (expr_ops[i] != NULL) { + if (strcmp(expr_ops[i]->name, name) == 0) + return expr_ops[i]; + + i++; + } + + return NULL; +} |