acl-plugin: bihash-based ACL lookup
[vpp.git] / src / plugins / acl / hash_lookup.h
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17
18 #ifndef _ACL_HASH_LOOKUP_H_
19 #define _ACL_HASH_LOOKUP_H_
20
21 #include <stddef.h>
22 #include "acl.h"
23
24 /*
25  * Do the necessary to logically apply the ACL to the existing vector of ACLs looked up
26  * during the packet processing
27  */
28
29 void hash_acl_apply(acl_main_t *am, u32 sw_if_index, u8 is_input, int acl_index);
30
31 /* Remove the ACL from the packet processing lookups on a given interface */
32
33 void hash_acl_unapply(acl_main_t *am, u32 sw_if_index, u8 is_input, int acl_index);
34
35 /*
36  * Add an ACL or delete an ACL. ACL may already have been referenced elsewhere,
37  * so potentially we also need to do the work to enable the lookups.
38  */
39
40 void hash_acl_add(acl_main_t *am, int acl_index);
41 void hash_acl_delete(acl_main_t *am, int acl_index);
42
43 /*
44  * Do the work required to match a given 5-tuple from the packet,
45  * and return the action as well as populate the values pointed
46  * to by the *_match_p pointers and maybe trace_bitmap.
47  */
48
49 u8
50 hash_multi_acl_match_5tuple (u32 sw_if_index, fa_5tuple_t * pkt_5tuple, int is_l2,
51                        int is_ip6, int is_input, u32 * acl_match_p,
52                        u32 * rule_match_p, u32 * trace_bitmap);
53
54
55 /*
56  * The debug function to show the contents of the ACL lookup hash
57  */
58 void show_hash_acl_hash(vlib_main_t * vm, acl_main_t *am, u32 verbose);
59
60 #endif