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