FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
mfib_entry_delegate.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 __MFIB_ENTRY_DELEGATE_T__
17 #define __MFIB_ENTRY_DELEGATE_T__
18 
19 #include <vnet/fib/fib_node.h>
20 
21 /**
22  * Delegate types
23  */
25  /**
26  * Dependency list of covered entries.
27  * these are more specific entries that are interested in changes
28  * to their respective cover
29  */
32 
33 #define FOR_EACH_MFIB_DELEGATE(_entry, _fdt, _fed, _body) \
34 { \
35  for (_fdt = MFIB_ENTRY_DELEGATE_CHAIN_UNICAST_IP4; \
36  _fdt <= MFIB_ENTRY_DELEGATE_ATTACHED_EXPORT; \
37  _fdt++) \
38  { \
39  _fed = mfib_entry_delegate_get(_entry, _fdt); \
40  if (NULL != _fed) { \
41  _body; \
42  } \
43  } \
44 }
45 
46 /**
47  * A Delagate is a means to implmenet the Delagation design pattern; the extension of an
48  * objects functionality through the composition of, and delgation to, other objects.
49  * These 'other' objects are delegates. Delagates are thus attached to other MFIB objects
50  * to extend their functionality.
51  */
52 typedef struct mfib_entry_delegate_t_
53 {
54  /**
55  * The MFIB entry object to which the delagate is attached
56  */
58 
59  /**
60  * The delagate type
61  */
63 
64  /**
65  * A union of data for the different delegate types
66  * These delegates are stored in a sparse vector on the entry, so they
67  * must all be of the same size.
68  */
69  union
70  {
71  /**
72  * For the cover tracking. The node list;
73  */
75  };
77 
78 struct mfib_entry_t_;
79 
80 extern void mfib_entry_delegate_remove(struct mfib_entry_t_ *mfib_entry,
82 
85 extern mfib_entry_delegate_t *mfib_entry_delegate_get(const struct mfib_entry_t_ *mfib_entry,
87 
88 extern u8 *format_mfib_entry_deletegate(u8 * s, va_list * args);
89 
90 #endif
mfib_entry_delegate_t * mfib_entry_delegate_get(const struct mfib_entry_t_ *mfib_entry, mfib_entry_delegate_type_t type)
fib_node_index_t mfd_entry_index
The MFIB entry object to which the delagate is attached.
mfib_entry_delegate_type_t_
Delegate types.
u8 * format_mfib_entry_deletegate(u8 *s, va_list *args)
void mfib_entry_delegate_remove(struct mfib_entry_t_ *mfib_entry, mfib_entry_delegate_type_t type)
An entry in a FIB table.
Definition: mfib_entry.h:32
unsigned char u8
Definition: types.h:56
vl_api_fib_path_type_t type
Definition: fib_types.api:123
mfib_entry_delegate_type_t mfd_type
The delagate type.
fib_node_list_t mfd_list
For the cover tracking.
enum mfib_entry_delegate_type_t_ mfib_entry_delegate_type_t
Delegate types.
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
mfib_entry_delegate_t * mfib_entry_delegate_find_or_add(struct mfib_entry_t_ *mfib_entry, mfib_entry_delegate_type_t fdt)
Dependency list of covered entries.
struct mfib_entry_delegate_t_ mfib_entry_delegate_t
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...
u32 fib_node_list_t
A list of FIB nodes.
Definition: fib_node.h:203