FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
abf_policy.h
Go to the documentation of this file.
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  */
39 
40  /**
41  * ACL index to match
42  */
44 
45  /**
46  * The path-list describing how to forward in case of a match
47  */
49 
50  /**
51  * Sibling index on the path-list
52  */
54 
55  /**
56  * The policy ID - as configured by the client
57  */
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  */
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
u32 acl_index
Definition: gbp.api:304
A representation of a path as described by a route producer.
Definition: fib_types.h:476
u32 ap_id
The policy ID - as configured by the client.
Definition: abf_policy.h:58
struct abf_policy_t_ abf_policy_t
An ACL based Forwarding &#39;policy&#39;.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
abf_policy_t * abf_policy_get(index_t index)
Get an ABF object from its VPP index.
Definition: abf_policy.c:41
fib_node_type_t abf_policy_fib_node_type
The FIB node type for ABF policies.
Definition: abf_policy.c:26
u32 ap_sibling
Sibling index on the path-list.
Definition: abf_policy.h:53
unsigned int u32
Definition: types.h:88
int abf_policy_delete(u32 policy_id, const fib_route_path_t *rpaths)
Delete paths from an ABF Policy.
Definition: abf_policy.c:175
long ctx[MAX_CONNS]
Definition: main.c:144
int(* abf_policy_walk_cb_t)(index_t index, void *ctx)
Callback function invoked during a walk of all policies.
Definition: abf_policy.h:102
void abf_policy_update(u32 policy_id, u32 acl_index, const fib_route_path_t *rpaths)
Create or update an ABF Policy.
Definition: abf_policy.c:80
index_t abf_policy_find(u32 policy_id)
Find a ABF object from the client&#39;s policy ID.
Definition: abf_policy.c:66
An node in the FIB graph.
Definition: fib_node.h:291
fib_node_index_t ap_pl
The path-list describing how to forward in case of a match.
Definition: abf_policy.h:48
void abf_policy_walk(abf_policy_walk_cb_t cb, void *ctx)
Walk/visit each of the ABF policies.
Definition: abf_policy.c:330
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
An ACL based Forwarding &#39;policy&#39;.
Definition: abf_policy.h:33
u32 ap_acl
ACL index to match.
Definition: abf_policy.h:43
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
fib_node_t ap_node
Linkage into the FIB graph.
Definition: abf_policy.h:38