FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
adj_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 __ADJ_DELEGATE_T__
17 #define __ADJ_DELEGATE_T__
18 
19 #include <vnet/adj/adj.h>
20 
21 /**
22  * Delegate types
23  */
24 typedef enum adj_delegate_type_t_ {
25  /**
26  * BFD session state
27  */
30 
31 #define FOR_EACH_ADJ_DELEGATE(_adj, _adt, _aed, _body) \
32 { \
33  for (_adt = ADJ_DELEGATE_BFD; \
34  _adt <= ADJ_DELEGATE_BFD; \
35  _adt++) \
36  { \
37  _aed = adj_delegate_get(_adj, _adt); \
38  if (NULL != _aed) { \
39  _body; \
40  } \
41  } \
42 }
43 
44 /**
45  * Distillation of the BFD session states into a go/no-go for using
46  * the associated tracked adjacency
47  */
48 typedef enum adj_bfd_state_t_
49 {
53 
54 /**
55  * A Delagate is a means to implement the Delagation design pattern;
56  * the extension of an object's functionality through the composition of,
57  * and delgation to, other objects.
58  * These 'other' objects are delegates. Delagates are thus attached to
59  * ADJ objects to extend their functionality.
60  */
61 typedef struct adj_delegate_t_
62 {
63  /**
64  * The ADJ entry object to which the delagate is attached
65  */
67 
68  /**
69  * The delagate type
70  */
72 
73  /**
74  * A union of data for the different delegate types
75  */
76  union
77  {
78  /**
79  * BFD delegate daa
80  */
81  struct {
82  /**
83  * BFD session state
84  */
86  /**
87  * BFD session index
88  */
90  };
91  };
93 
94 extern void adj_delegate_remove(ip_adjacency_t *adj,
95  adj_delegate_type_t type);
96 
100  adj_delegate_type_t type);
101 
102 extern u8 *format_adj_deletegate(u8 * s, va_list * args);
103 
104 #endif
adj_delegate_type_t ad_type
The delagate type.
Definition: adj_delegate.h:71
IP unicast adjacency.
Definition: adj.h:174
adj_bfd_state_t ad_bfd_state
BFD session state.
Definition: adj_delegate.h:85
u32 ad_bfd_index
BFD session index.
Definition: adj_delegate.h:89
A Delagate is a means to implement the Delagation design pattern; the extension of an object&#39;s functi...
Definition: adj_delegate.h:61
u8 * format_adj_deletegate(u8 *s, va_list *args)
Definition: adj_delegate.c:137
enum adj_bfd_state_t_ adj_bfd_state_t
Distillation of the BFD session states into a go/no-go for using the associated tracked adjacency...
struct adj_delegate_t_ adj_delegate_t
A Delagate is a means to implement the Delagation design pattern; the extension of an object&#39;s functi...
enum adj_delegate_type_t_ adj_delegate_type_t
Delegate types.
adj_index_t ad_adj_index
The ADJ entry object to which the delagate is attached.
Definition: adj_delegate.h:66
adj_bfd_state_t_
Distillation of the BFD session states into a go/no-go for using the associated tracked adjacency...
Definition: adj_delegate.h:48
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
adj_delegate_t * adj_delegate_find_or_add(ip_adjacency_t *adj, adj_delegate_type_t fdt)
Definition: adj_delegate.c:93
BFD session state.
Definition: adj_delegate.h:28
unsigned int u32
Definition: types.h:88
void adj_delegate_remove(ip_adjacency_t *adj, adj_delegate_type_t type)
Definition: adj_delegate.c:55
adj_delegate_t * adj_delegate_get(const ip_adjacency_t *adj, adj_delegate_type_t type)
Definition: adj_delegate.c:48
unsigned char u8
Definition: types.h:56
adj_delegate_type_t_
Delegate types.
Definition: adj_delegate.h:24