misc: move to new pool_foreach macros
[vpp.git] / src / plugins / map / map.h
index 16fc604..d874aa4 100644 (file)
@@ -12,6 +12,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#ifndef included_map_h
+#define included_map_h
+
 #include <stdbool.h>
 #include <vppinfra/error.h>
 #include <vnet/vnet.h>
@@ -23,6 +26,7 @@
 #include <vnet/dpo/load_balance.h>
 #include "lpm.h"
 #include <vppinfra/lock.h>
+#include <map/map.api_enum.h>
 
 #define MAP_SKIP_IP6_LOOKUP 1
 
@@ -205,37 +209,7 @@ typedef struct
   uword ip4_sv_reass_custom_next_index;
 } map_main_t;
 
-/*
- * MAP Error counters/messages
- */
-#define foreach_map_error                              \
-  /* Must be first. */                                 \
- _(NONE, "valid MAP packets")                          \
- _(BAD_PROTOCOL, "bad protocol")                       \
- _(SEC_CHECK, "security check failed")                 \
- _(ENCAP_SEC_CHECK, "encap security check failed")     \
- _(DECAP_SEC_CHECK, "decap security check failed")     \
- _(ICMP, "unable to translate ICMP")                   \
- _(ICMP_RELAY, "unable to relay ICMP")                 \
- _(UNKNOWN, "unknown")                                 \
- _(NO_BINDING, "no binding")                           \
- _(NO_DOMAIN, "no domain")                             \
- _(FRAGMENTED, "packet is a fragment")                  \
- _(FRAGMENT_MEMORY, "could not cache fragment")                \
- _(FRAGMENT_MALFORMED, "fragment has unexpected format")\
- _(FRAGMENT_DROPPED, "dropped cached fragment")         \
- _(MALFORMED, "malformed packet")                      \
- _(DF_SET, "can't fragment, DF set")                   \
- _(TIME_EXCEEDED, "time exceeded")                     \
-
-typedef enum
-{
-#define _(sym,str) MAP_ERROR_##sym,
-  foreach_map_error
-#undef _
-    MAP_N_ERROR,
-} map_error_t;
-
+typedef vl_counter_map_enum_t map_error_t;
 u64 map_error_counter_get (u32 node_index, map_error_t map_error);
 
 typedef struct
@@ -522,6 +496,7 @@ ip6_map_ip4_lookup_bypass (vlib_buffer_t * p0, ip4_header_t * ip)
   return (false);
 }
 
+#endif
 /*
  * fd.io coding-style-patch-verification: ON
  *