Пример #1
0
static clib_error_t *
ioam_export_init (vlib_main_t * vm)
{
  ioam_export_main_t *em = &ioam_export_main;
  clib_error_t *error = 0;
  u8 *name;
  u32 node_index = export_node.index;
  vlib_node_t *ip6_hbyh_node = NULL;

  em->vlib_main = vm;
  em->vnet_main = vnet_get_main ();
  em->set_id = IPFIX_IOAM_EXPORT_ID;
  ioam_export_reset_next_node (em);

  name = format (0, "ioam_export_%08x%c", api_version, 0);

  /* Ask for a correctly-sized block of API message decode slots */
  em->msg_id_base = vl_msg_api_get_msg_ids
    ((char *) name, VL_MSG_FIRST_AVAILABLE);
  em->unix_time_0 = (u32) time (0);	/* Store starting time */
  em->vlib_time_0 = vlib_time_now (vm);

  error = ioam_export_plugin_api_hookup (vm);

  /* Add our API messages to the global name_crc hash table */
  setup_message_id_table (em, &api_main);

  /* Hook this export node to ip6-hop-by-hop */
  ip6_hbyh_node = vlib_get_node_by_name (vm, (u8 *) "ip6-hop-by-hop");
  em->my_hbh_slot = vlib_node_add_next (vm, ip6_hbyh_node->index, node_index);
  vec_free (name);

  return error;
}
Пример #2
0
Файл: nsim.c Проект: chrisy/vpp
static clib_error_t *
nsim_init (vlib_main_t * vm)
{
  nsim_main_t *nsm = &nsim_main;
  clib_error_t *error = 0;
  u8 *name;

  nsm->vlib_main = vm;
  nsm->vnet_main = vnet_get_main ();

  name = format (0, "nsim_%08x%c", api_version, 0);

  /* Ask for a correctly-sized block of API message decode slots */
  nsm->msg_id_base = vl_msg_api_get_msg_ids
    ((char *) name, VL_MSG_FIRST_AVAILABLE);

  error = nsim_plugin_api_hookup (vm);

  /* Add our API messages to the global name_crc hash table */
  setup_message_id_table (nsm, &api_main);

  vec_free (name);

  return error;
}
Пример #3
0
static clib_error_t * sample_init (vlib_main_t * vm)
{
  sample_main_t * sm = &sample_main;
  clib_error_t * error = 0;
  u8 * name;

  name = format (0, "sample_%08x%c", api_version, 0);

  /* Ask for a correctly-sized block of API message decode slots */
  sm->msg_id_base = vl_msg_api_get_msg_ids 
      ((char *) name, VL_MSG_FIRST_AVAILABLE);

  error = sample_plugin_api_hookup (vm);

  vec_free(name);

  return error;
}