FD.io VPP  v17.04-9-g99c0734
Vector Packet Processing
fib_entry_delegate.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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 __FIB_ENTRY_DELEGATE_T__
17 #define __FIB_ENTRY_DELEGATE_T__
18 
19 #include <vnet/fib/fib_node.h>
20 
21 /**
22  * Delegate types
23  */
25  /**
26  * Forwarding chain types:
27  * for the vast majority of FIB entries only one chain is required - the
28  * one that forwards traffic matching the fib_entry_t's fib_prefix_t. For those
29  * fib_entry_t that are a resolution target for other fib_entry_t's they will also
30  * need the chain to provide forwarding for those children. We store these additional
31  * chains in delegates to save memory in the common case.
32  */
39  /**
40  * Dependency list of covered entries.
41  * these are more specific entries that are interested in changes
42  * to their respective cover
43  */
45  /**
46  * Attached import/export functionality
47  */
51 
52 #define FOR_EACH_DELEGATE_CHAIN(_entry, _fdt, _fed, _body) \
53 { \
54  for (_fdt = FIB_ENTRY_DELEGATE_CHAIN_UNICAST_IP4; \
55  _fdt <= FIB_ENTRY_DELEGATE_CHAIN_NSH; \
56  _fdt++) \
57  { \
58  _fed = fib_entry_delegate_get(_entry, _fdt); \
59  if (NULL != _fed) { \
60  _body; \
61  } \
62  } \
63 }
64 
65 /**
66  * A Delagate is a means to implmenet the Delagation design pattern; the extension of an
67  * objects functionality through the composition of, and delgation to, other objects.
68  * These 'other' objects are delegates. Delagates are thus attached to other FIB objects
69  * to extend their functionality.
70  */
71 typedef struct fib_entry_delegate_t_
72 {
73  /**
74  * The FIB entry object to which the delagate is attached
75  */
77 
78  /**
79  * The delagate type
80  */
82 
83  /**
84  * A union of data for the different delegate types
85  * These delegates are stored in a sparse vector on the entry, so they
86  * must all be of the same size. We could use indirection here for all types,
87  * i.e. store an index, that's ok for large delegates, like the attached export
88  * but for the chain delegates it's excessive
89  */
90  union
91  {
92  /**
93  * Valid for the forwarding chain delegates. The LB that is built.
94  */
96 
97  /**
98  * Valid for the attached import cases. An index of the importer/exporter
99  */
101 
102  /**
103  * For the cover tracking. The node list;
104  */
106  };
108 
109 struct fib_entry_t_;
110 
111 extern void fib_entry_delegate_remove(struct fib_entry_t_ *fib_entry,
113 
116 extern fib_entry_delegate_t *fib_entry_delegate_get(const struct fib_entry_t_ *fib_entry,
118 
121 
124 
125 #endif
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:85
An entry in a FIB table.
Definition: fib_entry.h:373
void fib_entry_delegate_remove(struct fib_entry_t_ *fib_entry, fib_entry_delegate_type_t type)
fib_forward_chain_type_t fib_entry_delegate_type_to_chain_type(fib_entry_delegate_type_t type)
fib_node_index_t fd_index
Valid for the attached import cases.
enum fib_entry_delegate_type_t_ fib_entry_delegate_type_t
Delegate types.
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:81
fib_entry_delegate_type_t_
Delegate types.
dpo_id_t fd_dpo
Valid for the forwarding chain delegates.
fib_node_index_t fd_entry_index
The FIB entry object to which the delagate is attached.
Contribute an object that is to be used to forward Ethernet packets.
Definition: fib_types.h:109
fib_node_list_t fd_list
For the cover tracking.
fib_entry_delegate_type_t fd_type
The delagate type.
Attached import/export functionality.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:146
Contribute an object that is to be used to forward end-of-stack MPLS packets.
Definition: fib_types.h:97
struct fib_entry_delegate_t_ fib_entry_delegate_t
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...
fib_entry_delegate_t * fib_entry_delegate_find_or_add(struct fib_entry_t_ *fib_entry, fib_entry_delegate_type_t fdt)
fib_entry_delegate_t * fib_entry_delegate_get(const struct fib_entry_t_ *fib_entry, fib_entry_delegate_type_t type)
Contribute an object that is to be used to forward NSH packets.
Definition: fib_types.h:115
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
Forwarding chain types: for the vast majority of FIB entries only one chain is required - the one tha...
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_entry_delegate_type_t fib_entry_chain_type_to_delegate_type(fib_forward_chain_type_t type)
u32 fib_node_list_t
A list of FIB nodes.
Definition: fib_node.h:185
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
Definition: fib_types.h:90
Dependency list of covered entries.
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...