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