api: multiple connections per process
[vpp.git] / src / vnet / lisp-gpe / lisp_gpe_api.c
index 97409f5..59a3fd1 100644 (file)
@@ -74,8 +74,8 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
     {
       /* local locator */
       r = &((vl_api_gpe_locator_t *) locs)[i];
-      memset (&pair, 0, sizeof (pair));
-      ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
+      clib_memset (&pair, 0, sizeof (pair));
+      ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? AF_IP4 : AF_IP6);
 
       pair.weight = r->weight;
       vec_add1 (pairs, pair);
@@ -86,7 +86,7 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
       /* remote locators */
       r = &((vl_api_gpe_locator_t *) locs)[i];
       p = &pairs[i - rloc_num];
-      ip_address_set (&p->rmt_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
+      ip_address_set (&p->rmt_loc, &r->addr, r->is_ip4 ? AF_IP4 : AF_IP6);
     }
   return pairs;
 }
@@ -99,13 +99,13 @@ unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
     {
     case 0:                    /* ipv4 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP4);
+      gid_address_ip_set (dst, src, AF_IP4);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
     case 1:                    /* ipv6 */
       gid_address_type (dst) = GID_ADDR_IP_PREFIX;
-      gid_address_ip_set (dst, src, IP6);
+      gid_address_ip_set (dst, src, AF_IP6);
       gid_address_ippref_len (dst) = len;
       ip_prefix_normalize (&gid_address_ippref (dst));
       break;
@@ -135,7 +135,7 @@ lisp_api_set_locator (vl_api_gpe_locator_t * loc,
                      const ip_address_t * addr, u8 weight)
 {
   loc->weight = weight;
-  if (IP4 == ip_addr_version (addr))
+  if (AF_IP4 == ip_addr_version (addr))
     {
       loc->is_ip4 = 1;
       memcpy (loc->addr, addr, 4);
@@ -174,7 +174,7 @@ static void
   vec_foreach (path, lfe->paths)
   {
     rmp = vl_msg_api_alloc (sizeof (*rmp));
-    memset (rmp, 0, sizeof (*rmp));
+    clib_memset (rmp, 0, sizeof (*rmp));
     const lisp_gpe_tunnel_t *lgt;
 
     rmp->_vl_msg_id =
@@ -200,7 +200,7 @@ gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst,
 
   vec_foreach (e, src)
   {
-    memset (&dst[i], 0, sizeof (*dst));
+    clib_memset (&dst[i], 0, sizeof (*dst));
     dst[i].dp_table = e->dp_table;
     dst[i].fwd_entry_index = e->fwd_entry_index;
     dst[i].vni = e->vni;
@@ -208,7 +208,7 @@ gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst,
     switch (fid_addr_type (&e->leid))
       {
       case FID_ADDR_IP_PREF:
-       if (IP4 == ip_prefix_version (&fid_addr_ippref (&e->leid)))
+       if (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&e->leid)))
          {
            memcpy (&dst[i].leid, &fid_addr_ippref (&e->leid), 4);
            memcpy (&dst[i].reid, &fid_addr_ippref (&e->reid), 4);
@@ -332,7 +332,7 @@ vl_api_gpe_add_del_fwd_entry_t_handler (vl_api_gpe_add_del_fwd_entry_t * mp)
   int rv = 0;
 
   gpe_add_del_fwd_entry_t_net_to_host (mp);
-  memset (a, 0, sizeof (a[0]));
+  clib_memset (a, 0, sizeof (a[0]));
 
   rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, mp->eid_type,
                              mp->rmt_eid, mp->rmt_len);
@@ -447,7 +447,7 @@ static void
   vnet_gpe_native_fwd_rpath_args_t _a, *a = &_a;
   int rv = 0;
 
-  memset (a, 0, sizeof (a[0]));
+  clib_memset (a, 0, sizeof (a[0]));
 
   if (mp->is_ip4)
     clib_memcpy (&a->rpath.frp_addr.ip4, mp->nh_addr, sizeof (ip4_address_t));
@@ -483,7 +483,7 @@ gpe_native_fwd_rpaths_copy (vl_api_gpe_native_fwd_rpath_t * dst,
 
   vec_foreach (e, src)
   {
-    memset (&dst[i], 0, sizeof (*dst));
+    clib_memset (&dst[i], 0, sizeof (*dst));
     table = fib_table_get (e->frp_fib_index, dpo_proto_to_fib (e->frp_proto));
     dst[i].fib_index = table->ft_table_id;
     dst[i].nh_sw_if_index = e->frp_sw_if_index;
@@ -547,7 +547,7 @@ vl_api_gpe_native_fwd_rpaths_get_t_handler (vl_api_gpe_native_fwd_rpaths_get_t
 /*
  * gpe_api_hookup
  * Add vpe's API message handlers to the table.
- * vlib has alread mapped shared memory and
+ * vlib has already mapped shared memory and
  * added the client registration handlers.
  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
  */
@@ -566,7 +566,7 @@ setup_message_id_table (api_main_t * am)
 static clib_error_t *
 gpe_api_hookup (vlib_main_t * vm)
 {
-  api_main_t *am = &api_main;
+  api_main_t *am = vlibapi_get_main ();
 
 #define _(N,n)                                                  \
     vl_msg_api_set_handlers(VL_API_##N, #n,                     \