23 #include <vnet/ip-neighbor/ip_neighbor.api_enum.h> 24 #include <vnet/ip-neighbor/ip_neighbor.api_types.h> 45 uword event_type = ~0;
73 .name =
"ip-neighbor-event",
90 watchers = (ip_neighbor_watcher_t*) *v;
92 vec_foreach_index_backwards (pos, watchers) {
93 if (watchers[pos].ipw_client == client_index)
94 vec_del1(watchers, pos);
125 .ipnk_sw_if_index = (sw_if_index == 0 ? ~0 :
sw_if_index),
156 .ipnk_sw_if_index = (sw_if_index == 0 ? ~0 :
sw_if_index),
193 0, 1,
sizeof(*ipne));
246 watchers = (ip_neighbor_watcher_t*) *v;
248 ASSERT(vec_len(watchers));
249 vlib_cli_output (vm,
"Key: %U", format_ip_neighbor_key, key);
251 vec_foreach (watcher, watchers)
252 vlib_cli_output (vm,
" %U", format_ip_neighbor_watcher, watcher);
260 .path =
"show ip neighbor-watcher",
262 .short_help =
"show ip neighbors-watcher",
static clib_error_t * want_ip_neighbor_events_reaper(u32 client_index)
static uword ip_neighbor_event_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static int ip_neighbor_watch_cmp(const ip_neighbor_watcher_t *w1, const ip_neighbor_watcher_t *w2)
static clib_error_t * ip_neighbor_watch_init(vlib_main_t *vm)
vlib_node_registration_t ip_neighbor_event_process_node
(constructor) VLIB_REGISTER_NODE (ip_neighbor_event_process_node)
vl_api_wireguard_peer_flags_t flags
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
void ip_neighbor_clone(const ip_neighbor_t *ipn, ip_neighbor_t *clone)
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
struct ip_neighbor_watch_db_t_ ip_neighbor_watch_db_t
Database of registered watchers The key for a watcher is {type, sw_if_index, addreess} interface=~0 /...
#define mhash_foreach(k, v, mh, body)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_neighbor_event_flags_t ipne_flags
void ip_neighbor_handle_event(ip_neighbor_event_t *ipne)
From the watcher to the API to publish a new neighbor.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define clib_memcpy(d, s, n)
static void ip46_address_reset(ip46_address_t *ip46)
#define VLIB_INIT_FUNCTION(x)
A representation of an IP neighbour/peer.
void ip_neighbor_publish(index_t ipni, ip_neighbor_event_flags_t flags)
VL_MSG_API_REAPER_FUNCTION(want_ip_neighbor_events_reaper)
void ip_neighbor_watch(const ip46_address_t *ip, ip46_type_t type, u32 sw_if_index, const ip_neighbor_watcher_t *watch)
vl_api_fib_path_type_t type
Database of registered watchers The key for a watcher is {type, sw_if_index, addreess} interface=~0 /...
static void * vlib_process_signal_event_data(vlib_main_t *vm, uword node_index, uword type_opaque, uword n_data_elts, uword n_data_elt_bytes)
#define vec_del1(v, i)
Delete the element at index I.
static void ip_neighbor_signal(ip_neighbor_watcher_t *watchers, index_t ipni, ip_neighbor_event_flags_t flags)
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#define VLIB_REGISTER_NODE(x,...)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
#define clib_memcmp(s1, s2, m1)
#define vec_free(V)
Free vector's memory (no header).
static ip_neighbor_watch_db_t ipnw_db
#define vec_search_with_function(v, E, fn)
Search a vector for the index of the entry that matches.
#define VLIB_CLI_COMMAND(x,...)
static uword * mhash_get(mhash_t *h, const void *key)
enum ip_neighbor_event_flags_t_ ip_neighbor_event_flags_t
ip_neighbor_key_t * ipn_key
The idempotent key.
static vlib_main_t * vlib_get_main(void)
static void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip_neighbor_t * ip_neighbor_get(index_t ipni)
#define vec_foreach(var, vec)
Vector iterator.
static clib_error_t * ip_neighbor_watchers_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vl_api_interface_index_t sw_if_index
ip_neighbor_watcher_t ipne_watch
void ip_neighbor_unwatch(const ip46_address_t *ip, ip46_type_t type, u32 sw_if_index, const ip_neighbor_watcher_t *watch)