22 #include <vnet/ip-neighbor/ip_neighbor.api_enum.h> 23 #include <vnet/ip-neighbor/ip_neighbor.api_types.h> 44 uword event_type = ~0;
72 .name =
"ip-neighbor-event",
89 watchers = (ip_neighbor_watcher_t*) *v;
91 vec_foreach_index_backwards (pos, watchers) {
92 if (watchers[pos].ipw_client == client_index)
93 vec_del1(watchers, pos);
124 .ipnk_sw_if_index = (sw_if_index == 0 ? ~0 :
sw_if_index),
155 .ipnk_sw_if_index = (sw_if_index == 0 ? ~0 :
sw_if_index),
190 0, 1,
sizeof(*ipne));
241 watchers = (ip_neighbor_watcher_t*) *v;
243 ASSERT(vec_len(watchers));
244 vlib_cli_output (vm,
"Key: %U", format_ip_neighbor_key, key);
246 vec_foreach (watcher, watchers)
247 vlib_cli_output (vm,
" %U", format_ip_neighbor_watcher, watcher);
255 .path =
"show ip neighbor-watcher",
257 .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)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
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).
#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)
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
void ip_neighbor_publish(index_t ipni)
A representation of an IP neighbour/peer.
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)
static void ip_neighbor_signal(ip_neighbor_watcher_t *watchers, index_t ipni)
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.
void ip_neighbor_handle_event(const ip_neighbor_event_t *ipne)
From the watcher to the API to publish a new neighbor.
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)
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)
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)