Trivial: Clean up some typos.
[vpp.git] / src / plugins / abf / abf_policy.h
1 /*
2  * Copyright (c) 2017 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:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15
16 #ifndef __ABF_H__
17 #define __ABF_H__
18
19 #include <vnet/fib/fib_node.h>
20
21 #define ABF_PLUGIN_VERSION_MAJOR 1
22 #define ABF_PLUGIN_VERSION_MINOR 0
23
24 /**
25  * An ACL based Forwarding 'policy'.
26  * This comprises the ACL index to match against and the forwarding
27  * path to take if the match is successful.
28  *
29  * ABF policies are then 'attached' to interfaces. An input feature
30  * will run through the list of policies a match will divert the packet,
31  * if all miss then we continues down the interface's feature arc
32  */
33 typedef struct abf_policy_t_
34 {
35   /**
36    * Linkage into the FIB graph
37    */
38   fib_node_t ap_node;
39
40   /**
41    * ACL index to match
42    */
43   u32 ap_acl;
44
45   /**
46    * The path-list describing how to forward in case of a match
47    */
48   fib_node_index_t ap_pl;
49
50   /**
51    * Sibling index on the path-list
52    */
53   u32 ap_sibling;
54
55   /**
56    * The policy ID - as configured by the client
57    */
58   u32 ap_id;
59 } abf_policy_t;
60
61 /**
62  * Get an ABF object from its VPP index
63  */
64 extern abf_policy_t *abf_policy_get (index_t index);
65
66 /**
67  * Find a ABF object from the client's policy ID
68  *
69  * @param policy_id Client's defined policy ID
70  * @return VPP's object index
71  */
72 extern index_t abf_policy_find (u32 policy_id);
73
74 /**
75  * The FIB node type for ABF policies
76  */
77 extern fib_node_type_t abf_policy_fib_node_type;
78
79 /**
80  * Create or update an ABF Policy
81  *
82  * @param policy_id User defined Policy ID
83  * @param acl_index The ACL the policy with match on
84  * @param rpaths The set of paths to add to the forwarding set
85  */
86 extern void abf_policy_update (u32 policy_id,
87                                u32 acl_index,
88                                const fib_route_path_t * rpaths);
89
90 /**
91  * Delete paths from an ABF Policy. If no more paths exist, the policy
92  * is deleted.
93  *
94  * @param policy_id User defined Policy ID
95  * @param rpaths The set of paths to forward remove
96  */
97 extern int abf_policy_delete (u32 policy_id, const fib_route_path_t * rpaths);
98
99 /**
100  * Callback function invoked during a walk of all policies
101  */
102 typedef int (*abf_policy_walk_cb_t) (index_t index, void *ctx);
103
104 /**
105  * Walk/visit each of the ABF policies
106  */
107 extern void abf_policy_walk (abf_policy_walk_cb_t cb, void *ctx);
108
109
110 /*
111  * fd.io coding-style-patch-verification: ON
112  *
113  * Local Variables:
114  * eval: (c-set-style "gnu")
115  * End:
116  */
117
118 #endif