libnftnl  1.0.5
expr_ops.c
1 #include <string.h>
2 #include <linux_list.h>
3 
4 #include "expr_ops.h"
5 
6 /* Unfortunately, __attribute__((constructor)) breaks library static linking */
7 extern struct expr_ops expr_ops_bitwise;
8 extern struct expr_ops expr_ops_byteorder;
9 extern struct expr_ops expr_ops_cmp;
10 extern struct expr_ops expr_ops_counter;
11 extern struct expr_ops expr_ops_ct;
12 extern struct expr_ops expr_ops_exthdr;
13 extern struct expr_ops expr_ops_immediate;
14 extern struct expr_ops expr_ops_limit;
15 extern struct expr_ops expr_ops_log;
16 extern struct expr_ops expr_ops_lookup;
17 extern struct expr_ops expr_ops_masq;
18 extern struct expr_ops expr_ops_match;
19 extern struct expr_ops expr_ops_meta;
20 extern struct expr_ops expr_ops_nat;
21 extern struct expr_ops expr_ops_payload;
22 extern struct expr_ops expr_ops_redir;
23 extern struct expr_ops expr_ops_reject;
24 extern struct expr_ops expr_ops_queue;
25 extern struct expr_ops expr_ops_target;
26 extern struct expr_ops expr_ops_dynset;
27 
28 static struct expr_ops *expr_ops[] = {
29  &expr_ops_bitwise,
30  &expr_ops_byteorder,
31  &expr_ops_cmp,
32  &expr_ops_counter,
33  &expr_ops_ct,
34  &expr_ops_exthdr,
35  &expr_ops_immediate,
36  &expr_ops_limit,
37  &expr_ops_log,
38  &expr_ops_lookup,
39  &expr_ops_masq,
40  &expr_ops_match,
41  &expr_ops_meta,
42  &expr_ops_nat,
43  &expr_ops_payload,
44  &expr_ops_redir,
45  &expr_ops_reject,
46  &expr_ops_queue,
47  &expr_ops_target,
48  &expr_ops_dynset,
49  NULL,
50 };
51 
52 struct expr_ops *nftnl_expr_ops_lookup(const char *name)
53 {
54  int i = 0;
55 
56  while (expr_ops[i] != NULL) {
57  if (strcmp(expr_ops[i]->name, name) == 0)
58  return expr_ops[i];
59 
60  i++;
61  }
62  return NULL;
63 }