+_(PUNT_SOCKET_DUMP, punt_socket_dump) \
+_(PUNT_REASON_DUMP, punt_reason_dump)
+
+static int
+vl_api_punt_type_decode (vl_api_punt_type_t in, punt_type_t * out)
+{
+ in = clib_net_to_host_u32 (in);
+
+ switch (in)
+ {
+#define _(v, s) \
+ case PUNT_API_TYPE_##v: \
+ *out = PUNT_TYPE_##v; \
+ return (0);
+ foreach_punt_type
+#undef _
+ }
+
+ return (-1);
+}
+
+static vl_api_punt_type_t
+vl_api_punt_type_encode (punt_type_t in)
+{
+ vl_api_punt_type_t pt = PUNT_API_TYPE_L4;
+
+ switch (in)
+ {
+#define _(v, s) \
+ case PUNT_TYPE_##v: \
+ pt = PUNT_API_TYPE_##v; \
+ break;
+ foreach_punt_type
+#undef _
+ }
+
+ return (clib_host_to_net_u32 (pt));
+}
+
+static int
+vl_api_punt_l4_decode (const vl_api_punt_l4_t * in, punt_l4_t * out)
+{
+ int rv;
+
+ rv = ip_address_family_decode (in->af, &out->af);
+ rv += ip_proto_decode (in->protocol, &out->protocol);
+ out->port = clib_net_to_host_u16 (in->port);
+
+ return (rv);
+}
+
+static int
+vl_api_punt_ip_proto_decode (const vl_api_punt_ip_proto_t * in,
+ punt_ip_proto_t * out)
+{
+ int rv;
+
+ rv = ip_address_family_decode (in->af, &out->af);
+ rv += ip_proto_decode (in->protocol, &out->protocol);
+
+ return (rv);
+}
+
+static int
+vl_api_punt_exception_decode (const vl_api_punt_exception_t * in,
+ punt_exception_t * out)
+{
+ int rv;
+
+ out->reason = clib_net_to_host_u32 (in->id);
+ rv = vlib_punt_reason_validate (out->reason);
+
+ return (rv);
+}
+
+static int
+vl_api_punt_decode (const vl_api_punt_t * in, punt_reg_t * out)
+{
+ int rv;
+
+ rv = vl_api_punt_type_decode (in->type, &out->type);
+
+ if (rv)
+ return (rv);
+
+ switch (out->type)
+ {
+ case PUNT_TYPE_L4:
+ return (vl_api_punt_l4_decode (&in->punt.l4, &out->punt.l4));
+ case PUNT_TYPE_EXCEPTION:
+ return (vl_api_punt_exception_decode (&in->punt.exception,
+ &out->punt.exception));
+ case PUNT_TYPE_IP_PROTO:
+ return (vl_api_punt_ip_proto_decode (&in->punt.ip_proto,
+ &out->punt.ip_proto));
+ }
+
+ return (-1);
+}
+
+static void
+vl_api_punt_l4_encode (const punt_l4_t * in, vl_api_punt_l4_t * out)
+{
+ out->af = ip_address_family_encode (in->af);
+ out->protocol = ip_proto_encode (in->protocol);
+ out->port = clib_net_to_host_u16 (in->port);
+}
+
+static void
+vl_api_punt_ip_proto_encode (const punt_ip_proto_t * in,
+ vl_api_punt_ip_proto_t * out)
+{
+ out->af = ip_address_family_encode (in->af);
+ out->protocol = ip_proto_encode (in->protocol);
+}
+
+static void
+vl_api_punt_exception_encode (const punt_exception_t * in,
+ vl_api_punt_exception_t * out)
+{
+ out->id = clib_host_to_net_u32 (in->reason);
+}
+
+static void
+vl_api_punt_encode (const punt_reg_t * in, vl_api_punt_t * out)
+{
+ out->type = vl_api_punt_type_encode (in->type);
+
+ switch (in->type)
+ {
+ case PUNT_TYPE_L4:
+ vl_api_punt_l4_encode (&in->punt.l4, &out->punt.l4);
+ break;
+ case PUNT_TYPE_IP_PROTO:
+ vl_api_punt_ip_proto_encode (&in->punt.ip_proto, &out->punt.ip_proto);
+ break;
+ case PUNT_TYPE_EXCEPTION:
+ vl_api_punt_exception_encode (&in->punt.exception,
+ &out->punt.exception);
+ break;
+ }
+}