libnftnl  1.0.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 */
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_dup;
13 extern struct expr_ops expr_ops_exthdr;
14 extern struct expr_ops expr_ops_fwd;
15 extern struct expr_ops expr_ops_immediate;
16 extern struct expr_ops expr_ops_limit;
17 extern struct expr_ops expr_ops_log;
18 extern struct expr_ops expr_ops_lookup;
19 extern struct expr_ops expr_ops_masq;
20 extern struct expr_ops expr_ops_match;
21 extern struct expr_ops expr_ops_meta;
22 extern struct expr_ops expr_ops_nat;
23 extern struct expr_ops expr_ops_payload;
24 extern struct expr_ops expr_ops_redir;
25 extern struct expr_ops expr_ops_reject;
26 extern struct expr_ops expr_ops_queue;
27 extern struct expr_ops expr_ops_target;
28 extern struct expr_ops expr_ops_dynset;
29 
30 static struct expr_ops *expr_ops[] = {
31  &expr_ops_bitwise,
32  &expr_ops_byteorder,
33  &expr_ops_cmp,
34  &expr_ops_counter,
35  &expr_ops_ct,
36  &expr_ops_dup,
37  &expr_ops_exthdr,
38  &expr_ops_fwd,
39  &expr_ops_immediate,
40  &expr_ops_limit,
41  &expr_ops_log,
42  &expr_ops_lookup,
43  &expr_ops_masq,
44  &expr_ops_match,
45  &expr_ops_meta,
46  &expr_ops_nat,
47  &expr_ops_payload,
48  &expr_ops_redir,
49  &expr_ops_reject,
50  &expr_ops_queue,
51  &expr_ops_target,
52  &expr_ops_dynset,
53  NULL,
54 };
55 
56 struct expr_ops *nftnl_expr_ops_lookup(const char *name)
57 {
58  int i = 0;
59 
60  while (expr_ops[i] != NULL) {
61  if (strcmp(expr_ops[i]->name, name) == 0)
62  return expr_ops[i];
63 
64  i++;
65  }
66  return NULL;
67 }