- rmp->worker_index = htonl (worker_index);
- 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);
-}
-
-static void
-vl_api_nat_worker_dump_t_handler (vl_api_nat_worker_dump_t * mp)
-{
- unix_shared_memory_queue_t *q;
- snat_main_t *sm = &snat_main;
- u32 *worker_index;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- return;
-
- /* *INDENT-OFF* */
- vec_foreach (worker_index, sm->workers)
- send_nat_worker_details(*worker_index, q, mp->context);
- /* *INDENT-ON* */
-}
-
-static void *
-vl_api_nat_worker_dump_t_print (vl_api_nat_worker_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: nat_worker_dump ");
-
- FINISH;
-}
-
-static void
-vl_api_nat_ipfix_enable_disable_t_handler (vl_api_nat_ipfix_enable_disable_t *
- mp)
-{
- snat_main_t *sm = &snat_main;
- vl_api_nat_ipfix_enable_disable_reply_t *rmp;
- int rv = 0;
-
- rv = snat_ipfix_logging_enable_disable (mp->enable,
- clib_host_to_net_u32
- (mp->domain_id),
- clib_host_to_net_u16
- (mp->src_port));
-
- REPLY_MACRO (VL_API_NAT_IPFIX_ENABLE_DISABLE_REPLY);
-}
-
-static void *
-vl_api_nat_ipfix_enable_disable_t_print (vl_api_nat_ipfix_enable_disable_t *
- mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: nat_ipfix_enable_disable ");
- if (mp->domain_id)
- s = format (s, "domain %d ", clib_net_to_host_u32 (mp->domain_id));
- if (mp->src_port)
- s = format (s, "src_port %d ", clib_net_to_host_u16 (mp->src_port));
- if (!mp->enable)
- s = format (s, "disable ");
-
- FINISH;
-}
-
-/*************/
-/*** NAT44 ***/
-/*************/
-static void
- vl_api_nat44_add_del_address_range_t_handler
- (vl_api_nat44_add_del_address_range_t * mp)
-{
- snat_main_t *sm = &snat_main;
- vl_api_nat44_add_del_address_range_reply_t *rmp;
- ip4_address_t this_addr;
- u32 start_host_order, end_host_order;
- u32 vrf_id;
- int i, count;
- int rv = 0;
- u32 *tmp;
-
- if (sm->static_mapping_only)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto send_reply;
- }
-
- tmp = (u32 *) mp->first_ip_address;
- start_host_order = clib_host_to_net_u32 (tmp[0]);
- tmp = (u32 *) mp->last_ip_address;
- end_host_order = clib_host_to_net_u32 (tmp[0]);
-
- count = (end_host_order - start_host_order) + 1;
-
- vrf_id = clib_host_to_net_u32 (mp->vrf_id);
-
- if (count > 1024)
- clib_warning ("%U - %U, %d addresses...",
- format_ip4_address, mp->first_ip_address,
- format_ip4_address, mp->last_ip_address, count);
-
- memcpy (&this_addr.as_u8, mp->first_ip_address, 4);
-
- for (i = 0; i < count; i++)