+ mp->protocol, clib_net_to_host_u32 (mp->vrf_id),
+ mp->flags & NAT_API_IS_INSIDE);
+ if (mp->flags & NAT_API_IS_EXT_HOST_VALID)
+ s = format (s, "ext_host_address %U ext_host_port %d",
+ format_ip4_address, mp->ext_host_address,
+ clib_net_to_host_u16 (mp->ext_host_port));
+
+ FINISH;
+}
+
+static void
+ vl_api_nat44_forwarding_enable_disable_t_handler
+ (vl_api_nat44_forwarding_enable_disable_t * mp)
+{
+ snat_main_t *sm = &snat_main;
+ vl_api_nat44_forwarding_enable_disable_reply_t *rmp;
+ int rv = 0;
+ u32 *ses_to_be_removed = 0, *ses_index;
+ snat_main_per_thread_data_t *tsm;
+ snat_session_t *s;
+
+ sm->forwarding_enabled = mp->enable != 0;
+
+ if (mp->enable == 0)
+ {
+ /* *INDENT-OFF* */
+ vec_foreach (tsm, sm->per_thread_data)
+ {
+ pool_foreach (s, tsm->sessions,
+ ({
+ if (is_fwd_bypass_session(s))
+ {
+ vec_add1 (ses_to_be_removed, s - tsm->sessions);
+ }
+ }));
+ vec_foreach (ses_index, ses_to_be_removed)
+ {
+ s = pool_elt_at_index(tsm->sessions, ses_index[0]);
+ nat_free_session_data (sm, s, tsm - sm->per_thread_data, 0);
+ nat44_delete_session (sm, s, tsm - sm->per_thread_data);
+ }
+ vec_free (ses_to_be_removed);
+ }
+ /* *INDENT-ON* */
+ }
+
+ REPLY_MACRO (VL_API_NAT44_FORWARDING_ENABLE_DISABLE_REPLY);
+}
+
+static void *vl_api_nat44_forwarding_enable_disable_t_print
+ (vl_api_nat44_forwarding_enable_disable_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: nat44_forwarding_enable_disable ");
+ s = format (s, "enable %d", mp->enable != 0);
+
+ FINISH;
+}
+
+static void
+ vl_api_nat44_forwarding_is_enabled_t_handler
+ (vl_api_nat44_forwarding_is_enabled_t * mp)
+{
+ vl_api_registration_t *reg;
+ snat_main_t *sm = &snat_main;
+ vl_api_nat44_forwarding_is_enabled_reply_t *rmp;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id =
+ ntohs (VL_API_NAT44_FORWARDING_IS_ENABLED_REPLY + sm->msg_id_base);
+ rmp->context = mp->context;
+
+ rmp->enabled = sm->forwarding_enabled;
+
+ vl_api_send_msg (reg, (u8 *) rmp);
+}
+
+static void *vl_api_nat44_forwarding_is_enabled_t_print
+ (vl_api_nat44_forwarding_is_enabled_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: nat44_forwarding_is_enabled ");