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