FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
ip_neighbor_types.c
Go to the documentation of this file.
1 /*
2  * ip_neighboor.h: ip neighbor generic services
3  *
4  * Copyright (c) 2018 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
19 
20 u8 *
21 format_ip_neighbor_flags (u8 * s, va_list * args)
22 {
23  ip_neighbor_flags_t flags = va_arg (*args, int);
24 
25  if (flags & IP_NEIGHBOR_FLAG_STATIC)
26  s = format (s, "S");
27 
28  if (flags & IP_NEIGHBOR_FLAG_DYNAMIC)
29  s = format (s, "D");
30 
32  s = format (s, "N");
33 
34  return s;
35 }
36 
37 
38 u8 *
39 format_ip_neighbor_key (u8 * s, va_list * va)
40 {
41  ip_neighbor_key_t *key = va_arg (*va, ip_neighbor_key_t *);
42 
43  return (format (s, "[%U, %U]",
45  key->ipnk_sw_if_index,
46  format_ip46_address, &key->ipnk_ip, key->ipnk_type));
47 }
48 
49 u8 *
50 format_ip_neighbor_watcher (u8 * s, va_list * va)
51 {
52  ip_neighbor_watcher_t *watcher = va_arg (*va, ip_neighbor_watcher_t *);
53 
54  return (format (s, "[pid:%d, client:%d]",
55  clib_host_to_net_u32 (watcher->ipw_pid),
56  clib_host_to_net_u32 (watcher->ipw_client)));
57 }
58 
59 u8 *
60 format_ip_neighbor (u8 * s, va_list * va)
61 {
62  index_t ipni = va_arg (*va, index_t);
63  ip_neighbor_t *ipn;
64 
65  ipn = ip_neighbor_get (ipni);
66 
67  return (format (s, "%=12U%=40U%=6U%=20U%U",
74  ipn->ipn_key->ipnk_sw_if_index));
75 }
76 
77 /*
78  * fd.io coding-style-patch-verification: ON
79  *
80  * Local Variables:
81  * eval: (c-set-style "gnu")
82  * End:
83  */
f64 ipn_time_last_updated
Aging related data.
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
ip46_address_t ipnk_ip
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
format_function_t format_vnet_sw_if_index_name
unsigned char u8
Definition: types.h:56
A representation of an IP neighbour/peer.
u8 * format_ip_neighbor(u8 *s, va_list *va)
u8 * format_ip_neighbor_key(u8 *s, va_list *va)
mac_address_t ipn_mac
The learned MAC address of the neighbour.
format_function_t format_ip46_address
Definition: ip46_address.h:50
u32 flags
Definition: vhost_user.h:141
u8 * format_ip_neighbor_flags(u8 *s, va_list *args)
ip_neighbor_key_t * ipn_key
The idempotent key.
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
typedef key
Definition: ipsec_types.api:83
u8 * format_ip_neighbor_watcher(u8 *s, va_list *va)
format_function_t format_vlib_time
Definition: node_funcs.h:1145
ip_neighbor_flags_t ipn_flags
Falgs for this object.
u8 * format_mac_address_t(u8 *s, va_list *args)
Definition: mac_address.c:27
ip_neighbor_t * ip_neighbor_get(index_t ipni)
Definition: ip_neighbor.c:88
enum ip_neighbor_flags_t_ ip_neighbor_flags_t