nat: ipfix logging separation & refactor
[vpp.git] / src / plugins / nat / nat44_cli.c
index f61ce2c..680a1e2 100644 (file)
@@ -18,8 +18,8 @@
  */
 
 #include <nat/nat.h>
-#include <nat/nat_ipfix_logging.h>
-#include <nat/nat64.h>
+#include <nat/lib/ipfix_logging.h>
+#include <nat/lib/nat_inlines.h>
 #include <nat/nat_inlines.h>
 #include <nat/nat44/inlines.h>
 #include <nat/nat_affinity.h>
@@ -156,8 +156,8 @@ snat_ipfix_logging_enable_disable_command_fn (vlib_main_t * vm,
   /* Get a line of input. */
   if (!unformat_user (input, unformat_line_input, line_input))
     {
-      rv = snat_ipfix_logging_enable_disable (enable, domain_id,
-                                             (u16) src_port);
+      rv = nat_ipfix_logging_enable_disable (enable, domain_id,
+                                            (u16) src_port);
       if (rv)
        return clib_error_return (0, "ipfix logging enable failed");
       return 0;
@@ -179,7 +179,7 @@ snat_ipfix_logging_enable_disable_command_fn (vlib_main_t * vm,
        }
     }
 
-  rv = snat_ipfix_logging_enable_disable (enable, domain_id, (u16) src_port);
+  rv = nat_ipfix_logging_enable_disable (enable, domain_id, (u16) src_port);
 
   if (rv)
     {
@@ -1774,55 +1774,18 @@ set_timeout_command_fn (vlib_main_t * vm,
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (line_input, "udp %u", &sm->udp_timeout))
-       {
-         if (nat64_set_udp_timeout (sm->udp_timeout))
-           {
-             error = clib_error_return (0, "Invalid UDP timeout value");
-             goto done;
-           }
-       }
+      if (unformat (line_input, "udp %u", &sm->udp_timeout));
       else if (unformat (line_input, "tcp-established %u",
-                        &sm->tcp_established_timeout))
-       {
-         if (nat64_set_tcp_timeouts
-             (sm->tcp_transitory_timeout, sm->tcp_established_timeout))
-           {
-             error =
-               clib_error_return (0,
-                                  "Invalid TCP established timeouts value");
-             goto done;
-           }
-       }
+                        &sm->tcp_established_timeout));
       else if (unformat (line_input, "tcp-transitory %u",
-                        &sm->tcp_transitory_timeout))
-       {
-         if (nat64_set_tcp_timeouts
-             (sm->tcp_transitory_timeout, sm->tcp_established_timeout))
-           {
-             error =
-               clib_error_return (0,
-                                  "Invalid TCP transitory timeouts value");
-             goto done;
-           }
-       }
-      else if (unformat (line_input, "icmp %u", &sm->icmp_timeout))
-       {
-         if (nat64_set_icmp_timeout (sm->icmp_timeout))
-           {
-             error = clib_error_return (0, "Invalid ICMP timeout value");
-             goto done;
-           }
-       }
+                        &sm->tcp_transitory_timeout));
+      else if (unformat (line_input, "icmp %u", &sm->icmp_timeout));
       else if (unformat (line_input, "reset"))
        {
          sm->udp_timeout = SNAT_UDP_TIMEOUT;
          sm->tcp_established_timeout = SNAT_TCP_ESTABLISHED_TIMEOUT;
          sm->tcp_transitory_timeout = SNAT_TCP_TRANSITORY_TIMEOUT;
          sm->icmp_timeout = SNAT_ICMP_TIMEOUT;
-         nat64_set_udp_timeout (0);
-         nat64_set_icmp_timeout (0);
-         nat64_set_tcp_timeouts (0, 0);
        }
       else
        {