aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/acl/acl.c102
-rw-r--r--src/plugins/gtpu/gtpu_api.c18
-rw-r--r--src/plugins/memif/memif_api.c12
-rw-r--r--src/plugins/nat/nat_api.c243
-rw-r--r--src/plugins/pppoe/pppoe_api.c18
5 files changed, 193 insertions, 200 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index b93d3bca1c4..2a2aaa08d7e 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -138,13 +138,11 @@ vl_api_acl_plugin_get_version_t_handler (vl_api_acl_plugin_get_version_t * mp)
acl_main_t *am = &acl_main;
vl_api_acl_plugin_get_version_reply_t *rmp;
int msg_size = sizeof (*rmp);
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
rmp = vl_msg_api_alloc (msg_size);
memset (rmp, 0, msg_size);
@@ -154,7 +152,7 @@ vl_api_acl_plugin_get_version_t_handler (vl_api_acl_plugin_get_version_t * mp)
rmp->major = htonl (ACL_PLUGIN_VERSION_MAJOR);
rmp->minor = htonl (ACL_PLUGIN_VERSION_MINOR);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
@@ -1871,7 +1869,7 @@ copy_acl_rule_to_api_rule (vl_api_acl_rule_t * api_rule, acl_rule_t * r)
}
static void
-send_acl_details (acl_main_t * am, svm_queue_t * q,
+send_acl_details (acl_main_t * am, vl_api_registration_t * reg,
acl_list_t * acl, u32 context)
{
vl_api_acl_details_t *mp;
@@ -1897,7 +1895,7 @@ send_acl_details (acl_main_t * am, svm_queue_t * q,
}
clib_mem_set_heap (oldheap);
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
@@ -1907,15 +1905,12 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp)
acl_main_t *am = &acl_main;
u32 acl_index;
acl_list_t *acl;
-
int rv = -1;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
if (mp->acl_index == ~0)
{
@@ -1923,7 +1918,7 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp)
/* Just dump all ACLs */
pool_foreach (acl, am->acls,
({
- send_acl_details(am, q, acl, mp->context);
+ send_acl_details(am, reg, acl, mp->context);
}));
/* *INDENT-ON* */
}
@@ -1933,7 +1928,7 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp)
if (!pool_is_free_index (am->acls, acl_index))
{
acl = pool_elt_at_index (am->acls, acl_index);
- send_acl_details (am, q, acl, mp->context);
+ send_acl_details (am, reg, acl, mp->context);
}
}
@@ -1946,7 +1941,7 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp)
static void
send_acl_interface_list_details (acl_main_t * am,
- svm_queue_t * q,
+ vl_api_registration_t * reg,
u32 sw_if_index, u32 context)
{
vl_api_acl_interface_list_details_t *mp;
@@ -1987,7 +1982,7 @@ send_acl_interface_list_details (acl_main_t * am,
htonl (am->output_acl_vec_by_sw_if_index[sw_if_index][i]);
}
clib_mem_set_heap (oldheap);
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
static void
@@ -1999,20 +1994,18 @@ vl_api_acl_interface_list_dump_t_handler (vl_api_acl_interface_list_dump_t *
vnet_interface_main_t *im = &am->vnet_main->interface_main;
u32 sw_if_index;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
if (mp->sw_if_index == ~0)
{
/* *INDENT-OFF* */
pool_foreach (swif, im->sw_interfaces,
({
- send_acl_interface_list_details(am, q, swif->sw_if_index, mp->context);
+ send_acl_interface_list_details(am, reg, swif->sw_if_index, mp->context);
}));
/* *INDENT-ON* */
}
@@ -2020,7 +2013,7 @@ vl_api_acl_interface_list_dump_t_handler (vl_api_acl_interface_list_dump_t *
{
sw_if_index = ntohl (mp->sw_if_index);
if (!pool_is_free_index (im->sw_interfaces, sw_if_index))
- send_acl_interface_list_details (am, q, sw_if_index, mp->context);
+ send_acl_interface_list_details (am, reg, sw_if_index, mp->context);
}
}
@@ -2113,7 +2106,7 @@ static void
}
static void
-send_macip_acl_details (acl_main_t * am, svm_queue_t * q,
+send_macip_acl_details (acl_main_t * am, vl_api_registration_t * reg,
macip_acl_list_t * acl, u32 context)
{
vl_api_macip_acl_details_t *mp;
@@ -2158,7 +2151,7 @@ send_macip_acl_details (acl_main_t * am, svm_queue_t * q,
mp->count = 0;
}
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
@@ -2168,22 +2161,21 @@ vl_api_macip_acl_dump_t_handler (vl_api_macip_acl_dump_t * mp)
acl_main_t *am = &acl_main;
macip_acl_list_t *acl;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
if (mp->acl_index == ~0)
{
/* Just dump all ACLs for now, with sw_if_index = ~0 */
pool_foreach (acl, am->macip_acls, (
{
- send_macip_acl_details (am, q, acl,
- mp->
- context);}
+ send_macip_acl_details (am, reg,
+ acl,
+ mp->context);
+ }
));
/* *INDENT-ON* */
}
@@ -2193,7 +2185,7 @@ vl_api_macip_acl_dump_t_handler (vl_api_macip_acl_dump_t * mp)
if (!pool_is_free_index (am->macip_acls, acl_index))
{
acl = pool_elt_at_index (am->macip_acls, acl_index);
- send_macip_acl_details (am, q, acl, mp->context);
+ send_macip_acl_details (am, reg, acl, mp->context);
}
}
}
@@ -2206,14 +2198,12 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t *
vl_api_macip_acl_interface_get_reply_t *rmp;
u32 count = vec_len (am->macip_acl_by_sw_if_index);
int msg_size = sizeof (*rmp) + sizeof (rmp->acls[0]) * count;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
int i;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
rmp = vl_msg_api_alloc (msg_size);
memset (rmp, 0, msg_size);
@@ -2226,12 +2216,12 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t *
rmp->acls[i] = htonl (am->macip_acl_by_sw_if_index[i]);
}
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
send_macip_acl_interface_list_details (acl_main_t * am,
- svm_queue_t * q,
+ vl_api_registration_t * reg,
u32 sw_if_index,
u32 acl_index, u32 context)
{
@@ -2250,22 +2240,20 @@ send_macip_acl_interface_list_details (acl_main_t * am,
rmp->sw_if_index = htonl (sw_if_index);
rmp->acls[0] = htonl (acl_index);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_macip_acl_interface_list_dump_t_handler
(vl_api_macip_acl_interface_list_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
acl_main_t *am = &acl_main;
u32 sw_if_index = ntohl (mp->sw_if_index);
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
if (sw_if_index == ~0)
{
@@ -2273,7 +2261,7 @@ static void
{
if (~0 != am->macip_acl_by_sw_if_index[sw_if_index])
{
- send_macip_acl_interface_list_details (am, q, sw_if_index,
+ send_macip_acl_interface_list_details (am, reg, sw_if_index,
am->macip_acl_by_sw_if_index
[sw_if_index],
mp->context);
@@ -2284,7 +2272,7 @@ static void
{
if (vec_len (am->macip_acl_by_sw_if_index) > sw_if_index)
{
- send_macip_acl_interface_list_details (am, q, sw_if_index,
+ send_macip_acl_interface_list_details (am, reg, sw_if_index,
am->macip_acl_by_sw_if_index
[sw_if_index], mp->context);
}
diff --git a/src/plugins/gtpu/gtpu_api.c b/src/plugins/gtpu/gtpu_api.c
index 1b93578a95d..502720df179 100644
--- a/src/plugins/gtpu/gtpu_api.c
+++ b/src/plugins/gtpu/gtpu_api.c
@@ -148,7 +148,7 @@ out:
}
static void send_gtpu_tunnel_details
- (gtpu_tunnel_t * t, svm_queue_t * q, u32 context)
+ (gtpu_tunnel_t * t, vl_api_registration_t * reg, u32 context)
{
vl_api_gtpu_tunnel_details_t *rmp;
ip4_main_t *im4 = &ip4_main;
@@ -177,22 +177,20 @@ static void send_gtpu_tunnel_details
rmp->is_ipv6 = is_ipv6;
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_gtpu_tunnel_dump_t_handler (vl_api_gtpu_tunnel_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
gtpu_main_t *gtm = &gtpu_main;
gtpu_tunnel_t *t;
u32 sw_if_index;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
sw_if_index = ntohl (mp->sw_if_index);
@@ -201,7 +199,7 @@ vl_api_gtpu_tunnel_dump_t_handler (vl_api_gtpu_tunnel_dump_t * mp)
/* *INDENT-OFF* */
pool_foreach (t, gtm->tunnels,
({
- send_gtpu_tunnel_details(t, q, mp->context);
+ send_gtpu_tunnel_details(t, reg, mp->context);
}));
/* *INDENT-ON* */
}
@@ -213,7 +211,7 @@ vl_api_gtpu_tunnel_dump_t_handler (vl_api_gtpu_tunnel_dump_t * mp)
return;
}
t = &gtm->tunnels[gtm->tunnel_index_by_sw_if_index[sw_if_index]];
- send_gtpu_tunnel_details (t, q, mp->context);
+ send_gtpu_tunnel_details (t, reg, mp->context);
}
}
diff --git a/src/plugins/memif/memif_api.c b/src/plugins/memif/memif_api.c
index 068fd3d69f0..f9f74ccdcb3 100644
--- a/src/plugins/memif/memif_api.c
+++ b/src/plugins/memif/memif_api.c
@@ -219,7 +219,7 @@ vl_api_memif_delete_t_handler (vl_api_memif_delete_t * mp)
}
static void
-send_memif_details (svm_queue_t * q,
+send_memif_details (vl_api_registration_t * reg,
memif_if_t * mif,
vnet_sw_interface_t * swif,
u8 * interface_name, u32 context)
@@ -255,7 +255,7 @@ send_memif_details (svm_queue_t * q,
mp->admin_up_down = (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? 1 : 0;
mp->link_up_down = (hwif->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ? 1 : 0;
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
/**
@@ -270,10 +270,10 @@ vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp)
vnet_sw_interface_t *swif;
memif_if_t *mif;
u8 *if_name = 0;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
@@ -285,7 +285,7 @@ vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp)
format_vnet_sw_interface_name,
vnm, swif, 0);
- send_memif_details (q, mif, swif, if_name, mp->context);
+ send_memif_details (reg, mif, swif, if_name, mp->context);
_vec_len (if_name) = 0;
}));
/* *INDENT-ON* */
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index dc9fc5d9a6d..f3d353fa20e 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -174,7 +174,8 @@ vl_api_nat_set_workers_t_print (vl_api_nat_set_workers_t * mp, void *handle)
}
static void
-send_nat_worker_details (u32 worker_index, svm_queue_t * q, u32 context)
+send_nat_worker_details (u32 worker_index, vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat_worker_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -189,23 +190,23 @@ send_nat_worker_details (u32 worker_index, svm_queue_t * q, u32 context)
rmp->lcore_id = htonl (w->lcore_id);
strncpy ((char *) rmp->name, (char *) w->name, ARRAY_LEN (rmp->name) - 1);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat_worker_dump_t_handler (vl_api_nat_worker_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
u32 *worker_index;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
vec_foreach (worker_index, sm->workers)
- send_nat_worker_details(*worker_index, q, mp->context);
+ send_nat_worker_details(*worker_index, reg, mp->context);
/* *INDENT-ON* */
}
@@ -315,7 +316,7 @@ vl_api_nat_get_reass_t_print (vl_api_nat_get_reass_t * mp, void *handle)
typedef struct nat_api_walk_ctx_t_
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
u32 context;
} nat_api_walk_ctx_t;
@@ -337,7 +338,7 @@ nat_ip4_reass_walk_api (nat_reass_ip4_t * reass, void *arg)
rmp->frag_n = reass->frag_n;
rmp->is_ip4 = 1;
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -360,7 +361,7 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg)
rmp->frag_n = reass->frag_n;
rmp->is_ip4 = 0;
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -368,14 +369,14 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg)
static void
vl_api_nat_reass_dump_t_handler (vl_api_nat_reass_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
nat_api_walk_ctx_t ctx = {
- .q = q,
+ .reg = reg,
.context = mp->context,
};
@@ -468,7 +469,8 @@ static void *vl_api_nat44_add_del_address_range_t_print
static void
send_nat44_address_details (snat_address_t * a,
- svm_queue_t * q, u32 context, u8 twice_nat)
+ vl_api_registration_t * reg, u32 context,
+ u8 twice_nat)
{
vl_api_nat44_address_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -487,25 +489,25 @@ send_nat44_address_details (snat_address_t * a,
rmp->twice_nat = twice_nat;
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_address_dump_t_handler (vl_api_nat44_address_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_address_t *a;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
vec_foreach (a, sm->addresses)
- send_nat44_address_details (a, q, mp->context, 0);
+ send_nat44_address_details (a, reg, mp->context, 0);
vec_foreach (a, sm->twice_nat_addresses)
- send_nat44_address_details (a, q, mp->context, 1);
+ send_nat44_address_details (a, reg, mp->context, 1);
/* *INDENT-ON* */
}
@@ -554,7 +556,7 @@ static void *vl_api_nat44_interface_add_del_feature_t_print
static void
send_nat44_interface_details (snat_interface_t * i,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg, u32 context)
{
vl_api_nat44_interface_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -568,24 +570,24 @@ send_nat44_interface_details (snat_interface_t * i,
nat_interface_is_inside (i);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_interface_dump_t_handler (vl_api_nat44_interface_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_interface_t *i;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
pool_foreach (i, sm->interfaces,
({
- send_nat44_interface_details(i, q, mp->context);
+ send_nat44_interface_details(i, reg, mp->context);
}));
/* *INDENT-ON* */
}
@@ -636,7 +638,8 @@ static void *vl_api_nat44_interface_add_del_output_feature_t_print
static void
send_nat44_interface_output_feature_details (snat_interface_t * i,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat44_interface_output_feature_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -649,25 +652,25 @@ send_nat44_interface_output_feature_details (snat_interface_t * i,
rmp->context = context;
rmp->is_inside = nat_interface_is_inside (i);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_interface_output_feature_dump_t_handler
(vl_api_nat44_interface_output_feature_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_interface_t *i;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
pool_foreach (i, sm->output_feature_interfaces,
({
- send_nat44_interface_output_feature_details(i, q, mp->context);
+ send_nat44_interface_output_feature_details(i, reg, mp->context);
}));
/* *INDENT-ON* */
}
@@ -742,7 +745,7 @@ static void *vl_api_nat44_add_del_static_mapping_t_print
static void
send_nat44_static_mapping_details (snat_static_mapping_t * m,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg, u32 context)
{
vl_api_nat44_static_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -762,12 +765,13 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m,
rmp->context = context;
rmp->twice_nat = m->twice_nat;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat44_static_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -786,28 +790,28 @@ send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m,
rmp->context = context;
rmp->twice_nat = m->twice_nat;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t
* mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
snat_static_map_resolve_t *rp;
int j;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
if (!vec_len(m->locals) && (m->local_addr.as_u32 != m->external_addr.as_u32))
- send_nat44_static_mapping_details (m, q, mp->context);
+ send_nat44_static_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */
@@ -815,7 +819,7 @@ vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t
{
rp = sm->to_resolve + j;
if (rp->l_addr.as_u32 != 0)
- send_nat44_static_map_resolve_details (rp, q, mp->context);
+ send_nat44_static_map_resolve_details (rp, reg, mp->context);
}
}
@@ -886,7 +890,7 @@ static void *vl_api_nat44_add_del_identity_mapping_t_print
static void
send_nat44_identity_mapping_details (snat_static_mapping_t * m,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg, u32 context)
{
vl_api_nat44_identity_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -903,12 +907,13 @@ send_nat44_identity_mapping_details (snat_static_mapping_t * m,
rmp->protocol = snat_proto_to_ip_proto (m->proto);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat44_identity_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -924,28 +929,28 @@ send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m,
rmp->protocol = snat_proto_to_ip_proto (m->proto);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_identity_mapping_dump_t_handler
(vl_api_nat44_identity_mapping_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
snat_static_map_resolve_t *rp;
int j;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
if (!vec_len(m->locals) && (m->local_addr.as_u32 == m->external_addr.as_u32))
- send_nat44_identity_mapping_details (m, q, mp->context);
+ send_nat44_identity_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */
@@ -953,7 +958,7 @@ static void
{
rp = sm->to_resolve + j;
if (rp->l_addr.as_u32 == 0)
- send_nat44_identity_map_resolve_details (rp, q, mp->context);
+ send_nat44_identity_map_resolve_details (rp, reg, mp->context);
}
}
@@ -1001,7 +1006,8 @@ static void *vl_api_nat44_add_del_interface_addr_t_print
static void
send_nat44_interface_addr_details (u32 sw_if_index,
- svm_queue_t * q, u32 context, u8 twice_nat)
+ vl_api_registration_t * reg, u32 context,
+ u8 twice_nat)
{
vl_api_nat44_interface_addr_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1014,26 +1020,26 @@ send_nat44_interface_addr_details (u32 sw_if_index,
rmp->twice_nat = twice_nat;
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_interface_addr_dump_t_handler (vl_api_nat44_interface_addr_dump_t
* mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
u32 *i;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
vec_foreach (i, sm->auto_add_sw_if_indices)
- send_nat44_interface_addr_details(*i, q, mp->context, 0);
+ send_nat44_interface_addr_details(*i, reg, mp->context, 0);
vec_foreach (i, sm->auto_add_sw_if_indices_twice_nat)
- send_nat44_interface_addr_details(*i, q, mp->context, 1);
+ send_nat44_interface_addr_details(*i, reg, mp->context, 1);
/* *INDENT-ON* */
}
@@ -1049,7 +1055,8 @@ vl_api_nat44_interface_addr_dump_t_print (vl_api_nat44_interface_addr_dump_t *
}
static void
-send_nat44_user_details (snat_user_t * u, svm_queue_t * q, u32 context)
+send_nat44_user_details (snat_user_t * u, vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat44_user_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1066,25 +1073,25 @@ send_nat44_user_details (snat_user_t * u, svm_queue_t * q, u32 context)
rmp->nstaticsessions = ntohl (u->nstaticsessions);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_user_dump_t_handler (vl_api_nat44_user_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_main_per_thread_data_t *tsm;
snat_user_t *u;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
vec_foreach (tsm, sm->per_thread_data)
vec_foreach (u, tsm->users)
- send_nat44_user_details (u, q, mp->context);
+ send_nat44_user_details (u, reg, mp->context);
/* *INDENT-ON* */
}
@@ -1100,7 +1107,7 @@ vl_api_nat44_user_dump_t_print (vl_api_nat44_user_dump_t * mp, void *handle)
static void
send_nat44_user_session_details (snat_session_t * s,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg, u32 context)
{
vl_api_nat44_user_session_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1129,14 +1136,14 @@ send_nat44_user_session_details (snat_session_t * s,
rmp->protocol = ntohs (snat_proto_to_ip_proto (s->in2out.protocol));
}
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t *
mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_main_per_thread_data_t *tsm;
snat_session_t *s;
@@ -1147,8 +1154,8 @@ vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t *
dlist_elt_t *head, *elt;
ip4_header_t ip;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
clib_memcpy (&ukey.addr, mp->ip_address, 4);
@@ -1176,7 +1183,7 @@ vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t *
{
s = pool_elt_at_index (tsm->sessions, session_index);
- send_nat44_user_session_details (s, q, mp->context);
+ send_nat44_user_session_details (s, reg, mp->context);
elt_index = elt->next;
elt = pool_elt_at_index (tsm->list_pool, elt_index);
@@ -1260,7 +1267,8 @@ static void *vl_api_nat44_add_del_lb_static_mapping_t_print
static void
send_nat44_lb_static_mapping_details (snat_static_mapping_t * m,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat44_lb_static_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1292,26 +1300,26 @@ send_nat44_lb_static_mapping_details (snat_static_mapping_t * m,
rmp->local_num++;
}
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat44_lb_static_mapping_dump_t_handler
(vl_api_nat44_lb_static_mapping_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
if (vec_len(m->locals))
- send_nat44_lb_static_mapping_details (m, q, mp->context);
+ send_nat44_lb_static_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */
}
@@ -1390,12 +1398,12 @@ static void
vl_api_nat44_forwarding_is_enabled_t_handler
(vl_api_nat44_forwarding_is_enabled_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
vl_api_nat44_forwarding_is_enabled_reply_t *rmp;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
@@ -1406,7 +1414,7 @@ static void
rmp->enabled = sm->forwarding_enabled;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void *vl_api_nat44_forwarding_is_enabled_t_print
@@ -1555,7 +1563,8 @@ vl_api_nat_det_reverse_t_print (vl_api_nat_det_reverse_t * mp, void *handle)
}
static void
-sent_nat_det_map_details (snat_det_map_t * m, svm_queue_t * q, u32 context)
+sent_nat_det_map_details (snat_det_map_t * m, vl_api_registration_t * reg,
+ u32 context)
{
vl_api_nat_det_map_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1573,23 +1582,23 @@ sent_nat_det_map_details (snat_det_map_t * m, svm_queue_t * q, u32 context)
rmp->ses_num = htonl (m->ses_num);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat_det_map_dump_t_handler (vl_api_nat_det_map_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
snat_det_map_t *m;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
/* *INDENT-OFF* */
vec_foreach(m, sm->det_maps)
- sent_nat_det_map_details(m, q, mp->context);
+ sent_nat_det_map_details(m, reg, mp->context);
/* *INDENT-ON* */
}
@@ -1770,7 +1779,7 @@ vl_api_nat_det_close_session_in_t_print (vl_api_nat_det_close_session_in_t *
static void
send_nat_det_session_details (snat_det_session_t * s,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg, u32 context)
{
vl_api_nat_det_session_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1786,21 +1795,21 @@ send_nat_det_session_details (snat_det_session_t * s,
rmp->expire = ntohl (s->expire);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
snat_main_t *sm = &snat_main;
ip4_address_t user_addr;
snat_det_map_t *dm;
snat_det_session_t *s, empty_ses;
u16 i;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
if (!mp->is_nat44)
return;
@@ -1815,7 +1824,7 @@ vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp)
for (i = 0; i < SNAT_DET_SES_PER_USER; i++)
{
if (s->out.as_u64)
- send_nat_det_session_details (s, q, mp->context);
+ send_nat_det_session_details (s, reg, mp->context);
s++;
}
}
@@ -1888,7 +1897,7 @@ static void *vl_api_nat64_add_del_pool_addr_range_t_print
typedef struct nat64_api_walk_ctx_t_
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
u32 context;
nat64_db_t *db;
} nat64_api_walk_ctx_t;
@@ -1915,7 +1924,7 @@ nat64_api_pool_walk (snat_address_t * a, void *arg)
rmp->vrf_id = ~0;
rmp->context = ctx->context;
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -1923,14 +1932,14 @@ nat64_api_pool_walk (snat_address_t * a, void *arg)
static void
vl_api_nat64_pool_addr_dump_t_handler (vl_api_nat64_pool_addr_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
nat64_api_walk_ctx_t ctx = {
- .q = q,
+ .reg = reg,
.context = mp->context,
};
@@ -1997,7 +2006,7 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg)
nat_interface_is_inside (i);
rmp->context = ctx->context;
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -2005,14 +2014,14 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg)
static void
vl_api_nat64_interface_dump_t_handler (vl_api_nat64_interface_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
nat64_api_walk_ctx_t ctx = {
- .q = q,
+ .reg = reg,
.context = mp->context,
};
@@ -2095,7 +2104,7 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg)
rmp->is_static = bibe->is_static;
rmp->ses_num = ntohl (bibe->ses_num);
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -2103,16 +2112,16 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg)
static void
vl_api_nat64_bib_dump_t_handler (vl_api_nat64_bib_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
nat64_main_t *nm = &nat64_main;
nat64_db_t *db;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
nat64_api_walk_ctx_t ctx = {
- .q = q,
+ .reg = reg,
.context = mp->context,
};
@@ -2228,7 +2237,7 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg)
rmp->vrf_id = ntohl (fib->ft_table_id);
rmp->proto = ste->proto;
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -2236,16 +2245,16 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg)
static void
vl_api_nat64_st_dump_t_handler (vl_api_nat64_st_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
nat64_main_t *nm = &nat64_main;
nat64_db_t *db;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
nat64_api_walk_ctx_t ctx = {
- .q = q,
+ .reg = reg,
.context = mp->context,
};
@@ -2312,7 +2321,7 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg)
rmp->vrf_id = ntohl (p->vrf_id);
rmp->context = ctx->context;
- vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp);
+ vl_api_send_msg (ctx->reg, (u8 *) rmp);
return 0;
}
@@ -2320,14 +2329,14 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg)
static void
vl_api_nat64_prefix_dump_t_handler (vl_api_nat64_prefix_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
nat64_api_walk_ctx_t ctx = {
- .q = q,
+ .reg = reg,
.context = mp->context,
};
diff --git a/src/plugins/pppoe/pppoe_api.c b/src/plugins/pppoe/pppoe_api.c
index f8a02279cc9..4c65ec4ebd6 100644
--- a/src/plugins/pppoe/pppoe_api.c
+++ b/src/plugins/pppoe/pppoe_api.c
@@ -118,7 +118,7 @@ out:
}
static void send_pppoe_session_details
- (pppoe_session_t * t, svm_queue_t * q, u32 context)
+ (pppoe_session_t * t, vl_api_registration_t * reg, u32 context)
{
vl_api_pppoe_session_details_t *rmp;
ip4_main_t *im4 = &ip4_main;
@@ -146,22 +146,20 @@ static void send_pppoe_session_details
rmp->is_ipv6 = is_ipv6;
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
pppoe_main_t *pem = &pppoe_main;
pppoe_session_t *t;
u32 sw_if_index;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
sw_if_index = ntohl (mp->sw_if_index);
@@ -170,7 +168,7 @@ vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp)
/* *INDENT-OFF* */
pool_foreach (t, pem->sessions,
({
- send_pppoe_session_details(t, q, mp->context);
+ send_pppoe_session_details(t, reg, mp->context);
}));
/* *INDENT-ON* */
}
@@ -182,7 +180,7 @@ vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp)
return;
}
t = &pem->sessions[pem->session_index_by_sw_if_index[sw_if_index]];
- send_pppoe_session_details (t, q, mp->context);
+ send_pppoe_session_details (t, reg, mp->context);
}
}