summaryrefslogtreecommitdiffstats
path: root/src/expr_ops.c
blob: 2b21d96bdca6707574824ece3c58972da60eadd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}