aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat_api.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-05 03:20:25 -0800
committerDave Barach <openvpp@barachs.net>2018-01-09 18:33:08 +0000
commite86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch)
tree480219864cadd743fdb95c21379aeaf88a985e23 /src/plugins/nat/nat_api.c
parent4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (diff)
api: refactor vlibmemory
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_api.c')
-rw-r--r--src/plugins/nat/nat_api.c81
1 files changed, 35 insertions, 46 deletions
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index d0efb001843..bc192a782f6 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -174,8 +174,7 @@ 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, unix_shared_memory_queue_t * q,
- u32 context)
+send_nat_worker_details (u32 worker_index, svm_queue_t * q, u32 context)
{
vl_api_nat_worker_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -196,7 +195,7 @@ send_nat_worker_details (u32 worker_index, unix_shared_memory_queue_t * q,
static void
vl_api_nat_worker_dump_t_handler (vl_api_nat_worker_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
u32 *worker_index;
@@ -316,7 +315,7 @@ vl_api_nat_get_reass_t_print (vl_api_nat_get_reass_t * mp, void *handle)
typedef struct nat_api_walk_ctx_t_
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
u32 context;
} nat_api_walk_ctx_t;
@@ -369,7 +368,7 @@ 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)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
@@ -469,8 +468,7 @@ static void *vl_api_nat44_add_del_address_range_t_print
static void
send_nat44_address_details (snat_address_t * a,
- unix_shared_memory_queue_t * q, u32 context,
- u8 twice_nat)
+ svm_queue_t * q, u32 context, u8 twice_nat)
{
vl_api_nat44_address_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -495,7 +493,7 @@ send_nat44_address_details (snat_address_t * a,
static void
vl_api_nat44_address_dump_t_handler (vl_api_nat44_address_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_address_t *a;
@@ -556,7 +554,7 @@ static void *vl_api_nat44_interface_add_del_feature_t_print
static void
send_nat44_interface_details (snat_interface_t * i,
- unix_shared_memory_queue_t * q, u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_interface_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -576,7 +574,7 @@ send_nat44_interface_details (snat_interface_t * i,
static void
vl_api_nat44_interface_dump_t_handler (vl_api_nat44_interface_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_interface_t *i;
@@ -638,8 +636,7 @@ static void *vl_api_nat44_interface_add_del_output_feature_t_print
static void
send_nat44_interface_output_feature_details (snat_interface_t * i,
- unix_shared_memory_queue_t * q,
- u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_interface_output_feature_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -659,7 +656,7 @@ static void
vl_api_nat44_interface_output_feature_dump_t_handler
(vl_api_nat44_interface_output_feature_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_interface_t *i;
@@ -745,8 +742,7 @@ static void *vl_api_nat44_add_del_static_mapping_t_print
static void
send_nat44_static_mapping_details (snat_static_mapping_t * m,
- unix_shared_memory_queue_t * q,
- u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_static_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -771,8 +767,7 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m,
static void
send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m,
- unix_shared_memory_queue_t * q,
- u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_static_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -798,7 +793,7 @@ static void
vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t
* mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
snat_static_map_resolve_t *rp;
@@ -891,8 +886,7 @@ static void *vl_api_nat44_add_del_identity_mapping_t_print
static void
send_nat44_identity_mapping_details (snat_static_mapping_t * m,
- unix_shared_memory_queue_t * q,
- u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_identity_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -914,8 +908,7 @@ send_nat44_identity_mapping_details (snat_static_mapping_t * m,
static void
send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m,
- unix_shared_memory_queue_t * q,
- u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_identity_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -938,7 +931,7 @@ static void
vl_api_nat44_identity_mapping_dump_t_handler
(vl_api_nat44_identity_mapping_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
snat_static_map_resolve_t *rp;
@@ -1008,8 +1001,7 @@ static void *vl_api_nat44_add_del_interface_addr_t_print
static void
send_nat44_interface_addr_details (u32 sw_if_index,
- unix_shared_memory_queue_t * q,
- u32 context, u8 twice_nat)
+ svm_queue_t * q, u32 context, u8 twice_nat)
{
vl_api_nat44_interface_addr_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1029,7 +1021,7 @@ static void
vl_api_nat44_interface_addr_dump_t_handler (vl_api_nat44_interface_addr_dump_t
* mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
u32 *i;
@@ -1057,8 +1049,7 @@ 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, unix_shared_memory_queue_t * q,
- u32 context)
+send_nat44_user_details (snat_user_t * u, svm_queue_t * q, u32 context)
{
vl_api_nat44_user_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1081,7 +1072,7 @@ send_nat44_user_details (snat_user_t * u, unix_shared_memory_queue_t * q,
static void
vl_api_nat44_user_dump_t_handler (vl_api_nat44_user_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_main_per_thread_data_t *tsm;
snat_user_t *u;
@@ -1109,7 +1100,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,
- unix_shared_memory_queue_t * q, u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_user_session_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1145,7 +1136,7 @@ static void
vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t *
mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_main_per_thread_data_t *tsm;
snat_session_t *s;
@@ -1267,8 +1258,7 @@ 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,
- unix_shared_memory_queue_t * q,
- u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat44_lb_static_mapping_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1306,7 +1296,7 @@ static void
vl_api_nat44_lb_static_mapping_dump_t_handler
(vl_api_nat44_lb_static_mapping_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
@@ -1397,7 +1387,7 @@ static void
vl_api_nat44_forwarding_is_enabled_t_handler
(vl_api_nat44_forwarding_is_enabled_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
vl_api_nat44_forwarding_is_enabled_reply_t *rmp;
@@ -1562,8 +1552,7 @@ 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, unix_shared_memory_queue_t * q,
- u32 context)
+sent_nat_det_map_details (snat_det_map_t * m, svm_queue_t * q, u32 context)
{
vl_api_nat_det_map_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1587,7 +1576,7 @@ sent_nat_det_map_details (snat_det_map_t * m, unix_shared_memory_queue_t * q,
static void
vl_api_nat_det_map_dump_t_handler (vl_api_nat_det_map_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
snat_det_map_t *m;
@@ -1778,7 +1767,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,
- unix_shared_memory_queue_t * q, u32 context)
+ svm_queue_t * q, u32 context)
{
vl_api_nat_det_session_details_t *rmp;
snat_main_t *sm = &snat_main;
@@ -1800,7 +1789,7 @@ send_nat_det_session_details (snat_det_session_t * s,
static void
vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
snat_main_t *sm = &snat_main;
ip4_address_t user_addr;
snat_det_map_t *dm;
@@ -1896,7 +1885,7 @@ static void *vl_api_nat64_add_del_pool_addr_range_t_print
typedef struct nat64_api_walk_ctx_t_
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
u32 context;
nat64_db_t *db;
} nat64_api_walk_ctx_t;
@@ -1931,7 +1920,7 @@ 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)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
@@ -2013,7 +2002,7 @@ 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)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
@@ -2111,7 +2100,7 @@ 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)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
nat64_main_t *nm = &nat64_main;
nat64_db_t *db;
@@ -2244,7 +2233,7 @@ 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)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
nat64_main_t *nm = &nat64_main;
nat64_db_t *db;
@@ -2328,7 +2317,7 @@ 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)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)