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_INTERNAL_H__
17 #define __ADJ_INTERNAL_H__
19 #include <vnet/adj/adj.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/mpls/mpls.h>
22 #include <vnet/adj/adj_l2.h>
26 * big switch to turn on Adjacency debugging
34 #define ADJ_DBG(_adj, _fmt, _args...) \
36 clib_warning("adj:[%d:%p]:" _fmt, \
37 _adj - adj_pool, _adj, \
41 #define ADJ_DBG(_e, _fmt, _args...)
45 adj_get_rewrite_node (vnet_link_t linkt)
49 return (ip4_rewrite_node.index);
51 return (ip6_rewrite_node.index);
53 return (mpls_output_node.index);
54 case VNET_LINK_ETHERNET:
55 return (adj_l2_rewrite_node.index);
63 static inline vnet_link_t
64 adj_fib_proto_2_nd (fib_protocol_t fp)
68 case FIB_PROTOCOL_IP4:
69 return (VNET_LINK_ARP);
70 case FIB_PROTOCOL_IP6:
71 return (VNET_LINK_IP6);
72 case FIB_PROTOCOL_MPLS:
73 return (VNET_LINK_MPLS);
80 * Get a pointer to an adjacency object from its index
82 static inline adj_index_t
83 adj_get_index (ip_adjacency_t *adj)
85 return (adj - adj_pool);
88 extern void adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
89 ip_lookup_next_t adj_next_index,
90 u32 complete_next_index,
94 extern ip_adjacency_t * adj_alloc(fib_protocol_t proto);
96 extern void adj_nbr_remove(adj_index_t ai,
97 fib_protocol_t nh_proto,
98 vnet_link_t link_type,
99 const ip46_address_t *nh_addr,
101 extern void adj_glean_remove(fib_protocol_t proto,
103 extern void adj_mcast_remove(fib_protocol_t proto,