2 * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef SRC_VNET_SESSION_MMA_TEMPLATE_H_
17 #define SRC_VNET_SESSION_MMA_TEMPLATE_H_
19 #include <vppinfra/pool.h>
22 #error MMA_RT_TYPE not defined
25 #define _rt(a,b) a##_##b
26 #define __rt(a, b) _rt(a,b)
27 #define RT(a) __rt(a, MMA_RT_TYPE)
29 #define _rtt(a,b) a##_##b##_t
30 #define __rtt(a, b) _rtt(a,b)
31 #define RTT(a) __rtt(a, MMA_RT_TYPE)
33 #define MMA_TABLE_INVALID_INDEX ((u32)~0)
37 u64 as_u64[MMA_RT_TYPE / 8];
38 } RTT (mma_mask_or_match);
44 RTT (mma_mask_or_match) mask;
45 RTT (mma_mask_or_match) match;
46 RTT (mma_mask_or_match) max_match;
49 typedef int (*RTT (rule_cmp_fn)) (RTT (mma_rule) * rule1,
50 RTT (mma_rule) * rule2);
53 /** Root for rules tree */
57 RTT (mma_rule) * rules;
59 RTT (rule_cmp_fn) rule_cmp_fn;
60 } RTT (mma_rules_table);
63 RT (mma_table_lookup) (RTT (mma_rules_table) * srt,
64 RTT (mma_mask_or_match) * key, u32 rule_index);
66 RT (mma_table_lookup_rule) (RTT (mma_rules_table) * srt,
67 RTT (mma_mask_or_match) * key, u32 rule_index);
69 RT (mma_table_add_rule) (RTT (mma_rules_table) * srt, RTT (mma_rule) * rule);
71 RT (mma_table_del_rule) (RTT (mma_rules_table) * srt,
72 RTT (mma_rule) * rule, u32 rule_index);
74 RT (mma_rules_table_rule_alloc) (RTT (mma_rules_table) * srt);
76 RT (session_rule_free) (RTT (mma_rules_table) * srt, RTT (mma_rule) * rule);
78 RT (mma_table_get_rule) (RTT (mma_rules_table) * srt, u32 srt_index);
80 RT (mma_rules_table_rule_index) (RTT (mma_rules_table) * srt,
82 #endif /* SRC_VNET_SESSION_MMA_TEMPLATE_H_ */
85 * fd.io coding-style-patch-verification: ON
88 * eval: (c-set-style "gnu")