#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/ip_format_fns.h>
#include <vpp/api/types.h>
-#include "jsonconvert.h"
-
-#define _(T) \
-int vl_api_ ##T## _fromjson(cJSON *o, T *d) \
-{ \
- if (!cJSON_IsNumber(o)) return -1; \
- memcpy(d, &o->valueint, sizeof(T)); \
- return 0; \
-}
- foreach_vat2_fromjson
+#include "jsonformat.h"
+
+#define _(T) \
+ int vl_api_##T##_fromjson (cJSON *o, T *d) \
+ { \
+ if (!cJSON_IsNumber (o)) \
+ return -1; \
+ d[0] = (T) cJSON_GetNumberValue (o); \
+ return 0; \
+ }
+foreach_type_fromjson
#undef _
-int vl_api_bool_fromjson(cJSON *o, bool *d)
+ int
+ vl_api_bool_fromjson (cJSON *o, bool *d)
{
if (!cJSON_IsBool(o)) return -1;
*d = o->valueint ? true : false;
return len + sizeof (u32);
}
-u8 *
-format_vl_api_interface_index_t (u8 *s, va_list *args)
-{
- u32 *a = va_arg (*args, u32 *);
- return format (s, "%u", *a);
-}
-
void
vl_api_string_cJSON_AddToObject(cJSON * const object, const char * const name, vl_api_string_t *astr)
{
{
return 0;
}
-u8 *format_vl_api_gbp_scope_t(u8 * s, va_list * args)
-{
- return 0;
-}
uword unformat_vl_api_gbp_scope_t(unformat_input_t * input, va_list * args)
{
return 0;
vec_free(s); \
return o; \
}
-foreach_vat2_tojson
+foreach_type_tojson
#undef _