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>
25 * big switch to turn on Adjacency debugging
33 #define ADJ_DBG(_adj, _fmt, _args...) \
35 clib_warning("adj:[%d:%p]:" _fmt, \
36 _adj->heap_handle, _adj, \
40 #define ADJ_DBG(_e, _fmt, _args...)
43 static inline vlib_node_registration_t*
44 adj_get_rewrite_node (fib_link_t linkt)
48 return (&ip4_rewrite_node);
50 return (&ip6_rewrite_node);
52 return (&mpls_output_node);
58 static inline vnet_l3_packet_type_t
59 adj_fib_link_2_vnet (fib_link_t linkt)
64 return (VNET_L3_PACKET_TYPE_IP4);
66 return (VNET_L3_PACKET_TYPE_IP6);
68 return (VNET_L3_PACKET_TYPE_MPLS_UNICAST);
73 static inline vnet_l3_packet_type_t
74 adj_fib_proto_2_nd (fib_protocol_t fp)
78 case FIB_PROTOCOL_IP4:
79 return (VNET_L3_PACKET_TYPE_ARP);
80 case FIB_PROTOCOL_IP6:
81 return (VNET_L3_PACKET_TYPE_IP6);
82 case FIB_PROTOCOL_MPLS:
83 return (VNET_L3_PACKET_TYPE_MPLS_UNICAST);
88 extern ip_adjacency_t * adj_alloc(fib_protocol_t proto);
90 extern void adj_nbr_remove(fib_protocol_t nh_proto,
92 const ip46_address_t *nh_addr,
94 extern void adj_glean_remove(fib_protocol_t proto,