| 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_inner; |
| 18 | extern struct expr_ops expr_ops_last; |
| 19 | extern struct expr_ops expr_ops_limit; |
| 20 | extern struct expr_ops expr_ops_log; |
| 21 | extern struct expr_ops expr_ops_lookup; |
| 22 | extern struct expr_ops expr_ops_masq; |
| 23 | extern struct expr_ops expr_ops_match; |
| 24 | extern struct expr_ops expr_ops_meta; |
| 25 | extern struct expr_ops expr_ops_ng; |
| 26 | extern struct expr_ops expr_ops_nat; |
| 27 | extern struct expr_ops expr_ops_tproxy; |
| 28 | extern struct expr_ops expr_ops_objref; |
| 29 | extern struct expr_ops expr_ops_payload; |
| 30 | extern struct expr_ops expr_ops_range; |
| 31 | extern struct expr_ops expr_ops_redir; |
| 32 | extern struct expr_ops expr_ops_reject; |
| 33 | extern struct expr_ops expr_ops_rt; |
| 34 | extern struct expr_ops expr_ops_queue; |
| 35 | extern struct expr_ops expr_ops_quota; |
| 36 | extern struct expr_ops expr_ops_target; |
| 37 | extern struct expr_ops expr_ops_dynset; |
| 38 | extern struct expr_ops expr_ops_hash; |
| 39 | extern struct expr_ops expr_ops_fib; |
| 40 | extern struct expr_ops expr_ops_flow; |
| 41 | extern struct expr_ops expr_ops_socket; |
| 42 | extern struct expr_ops expr_ops_synproxy; |
| 43 | extern struct expr_ops expr_ops_tunnel; |
| 44 | extern struct expr_ops expr_ops_osf; |
| 45 | extern struct expr_ops expr_ops_xfrm; |
| 46 | |
| 47 | static struct expr_ops expr_ops_notrack = { |
| 48 | .name = "notrack", |
| 49 | }; |
| 50 | |
| 51 | static 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 | |
| 95 | struct 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 | } |