libnftnl  1.1.9
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_connlimit;
11 extern struct expr_ops expr_ops_counter;
12 extern struct expr_ops expr_ops_ct;
13 extern struct expr_ops expr_ops_dup;
14 extern struct expr_ops expr_ops_exthdr;
15 extern struct expr_ops expr_ops_fwd;
16 extern struct expr_ops expr_ops_immediate;
17 extern struct expr_ops expr_ops_limit;
18 extern struct expr_ops expr_ops_log;
19 extern struct expr_ops expr_ops_lookup;
20 extern struct expr_ops expr_ops_masq;
21 extern struct expr_ops expr_ops_match;
22 extern struct expr_ops expr_ops_meta;
23 extern struct expr_ops expr_ops_ng;
24 extern struct expr_ops expr_ops_nat;
25 extern struct expr_ops expr_ops_tproxy;
26 extern struct expr_ops expr_ops_objref;
27 extern struct expr_ops expr_ops_payload;
28 extern struct expr_ops expr_ops_range;
29 extern struct expr_ops expr_ops_redir;
30 extern struct expr_ops expr_ops_reject;
31 extern struct expr_ops expr_ops_rt;
32 extern struct expr_ops expr_ops_queue;
33 extern struct expr_ops expr_ops_quota;
34 extern struct expr_ops expr_ops_target;
35 extern struct expr_ops expr_ops_dynset;
36 extern struct expr_ops expr_ops_hash;
37 extern struct expr_ops expr_ops_fib;
38 extern struct expr_ops expr_ops_flow;
39 extern struct expr_ops expr_ops_socket;
40 extern struct expr_ops expr_ops_synproxy;
41 extern struct expr_ops expr_ops_tunnel;
42 extern struct expr_ops expr_ops_osf;
43 extern struct expr_ops expr_ops_xfrm;
44 
45 static struct expr_ops expr_ops_notrack = {
46  .name = "notrack",
47 };
48 
49 static struct expr_ops *expr_ops[] = {
50  &expr_ops_bitwise,
51  &expr_ops_byteorder,
52  &expr_ops_cmp,
53  &expr_ops_connlimit,
54  &expr_ops_counter,
55  &expr_ops_ct,
56  &expr_ops_dup,
57  &expr_ops_exthdr,
58  &expr_ops_fwd,
59  &expr_ops_immediate,
60  &expr_ops_limit,
61  &expr_ops_log,
62  &expr_ops_lookup,
63  &expr_ops_masq,
64  &expr_ops_match,
65  &expr_ops_meta,
66  &expr_ops_ng,
67  &expr_ops_nat,
68  &expr_ops_tproxy,
69  &expr_ops_notrack,
70  &expr_ops_payload,
71  &expr_ops_range,
72  &expr_ops_redir,
73  &expr_ops_reject,
74  &expr_ops_rt,
75  &expr_ops_queue,
76  &expr_ops_quota,
77  &expr_ops_target,
78  &expr_ops_dynset,
79  &expr_ops_hash,
80  &expr_ops_fib,
81  &expr_ops_objref,
82  &expr_ops_flow,
83  &expr_ops_socket,
84  &expr_ops_synproxy,
85  &expr_ops_tunnel,
86  &expr_ops_osf,
87  &expr_ops_xfrm,
88  NULL,
89 };
90 
91 struct expr_ops *nftnl_expr_ops_lookup(const char *name)
92 {
93  int i = 0;
94 
95  while (expr_ops[i] != NULL) {
96  if (strcmp(expr_ops[i]->name, name) == 0)
97  return expr_ops[i];
98 
99  i++;
100  }
101  return NULL;
102 }