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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __ADJ_DELEGATE_T__
17 #define __ADJ_DELEGATE_T__
19 #include <vnet/adj/adj.h>
24 typedef enum adj_delegate_type_t_ {
29 } adj_delegate_type_t;
31 #define FOR_EACH_ADJ_DELEGATE(_adj, _adt, _aed, _body) \
33 for (_adt = ADJ_DELEGATE_BFD; \
34 _adt <= ADJ_DELEGATE_BFD; \
37 _aed = adj_delegate_get(_adj, _adt); \
45 * Distillation of the BFD session states into a go/no-go for using
46 * the associated tracked adjacency
48 typedef enum adj_bfd_state_t_
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.
61 typedef struct adj_delegate_t_
64 * The ADJ entry object to which the delagate is attached
66 adj_index_t ad_adj_index;
71 adj_delegate_type_t ad_type;
74 * A union of data for the different delegate types
85 adj_bfd_state_t ad_bfd_state;
94 extern void adj_delegate_remove(ip_adjacency_t *adj,
95 adj_delegate_type_t type);
97 extern adj_delegate_t *adj_delegate_find_or_add(ip_adjacency_t *adj,
98 adj_delegate_type_t fdt);
99 extern adj_delegate_t *adj_delegate_get(const ip_adjacency_t *adj,
100 adj_delegate_type_t type);
102 extern u8 *format_adj_deletegate(u8 * s, va_list * args);