summaryrefslogtreecommitdiffstats
path: root/src/vlibapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlibapi')
-rw-r--r--src/vlibapi/api_shared.c12
-rw-r--r--src/vlibapi/api_types.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index ce7c4aec712..1e7f5c420c6 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -249,7 +249,6 @@ vl_msg_api_trace_save (api_main_t * am, vl_api_trace_which_t which, FILE * fp)
fh.wrapped = tp->wrapped;
fh.nitems = clib_host_to_net_u32 (vec_len (tp->traces));
u8 *m = vl_api_serialize_message_table (am, 0);
- clib_warning ("Message table length %d", vec_len (m));
fh.msgtbl_size = clib_host_to_net_u32 (vec_len (m));
if (fwrite (&fh, sizeof (fh), 1, fp) != 1)
@@ -1059,7 +1058,8 @@ vl_msg_pop_heap (void *oldheap)
int
vl_api_to_api_string (u32 len, const char *buf, vl_api_string_t * str)
{
- clib_memcpy_fast (str->buf, buf, len);
+ if (len)
+ clib_memcpy_fast (str->buf, buf, len);
str->length = htonl (len);
return len + sizeof (u32);
}
@@ -1086,6 +1086,14 @@ vl_api_string_len (vl_api_string_t * astr)
return clib_net_to_host_u32 (astr->length);
}
+u8 *
+vl_api_format_string (u8 * s, va_list * args)
+{
+ vl_api_string_t *a = va_arg (*args, vl_api_string_t *);
+ vec_add (s, a->buf, clib_net_to_host_u32 (a->length));
+ return s;
+}
+
/*
* Returns a new vector. Remember to free it after use.
*/
diff --git a/src/vlibapi/api_types.h b/src/vlibapi/api_types.h
index 04f84a5f908..8cd47bb770f 100644
--- a/src/vlibapi/api_types.h
+++ b/src/vlibapi/api_types.h
@@ -21,7 +21,7 @@
#define included_api_types_h
#include <stdbool.h>
-
+#include <stdarg.h>
#include <vppinfra/types.h>
#include <arpa/inet.h>
#include <string.h>
@@ -43,6 +43,7 @@ extern int vl_api_vec_to_api_string (const u8 *vec, vl_api_string_t * str);
extern u8 * vl_api_from_api_string (vl_api_string_t * astr);
extern u32 vl_api_string_len (vl_api_string_t * astr);
extern u8 * vl_api_from_api_to_vec (vl_api_string_t *astr);
+extern u8 *vl_api_format_string (u8 *s, va_list *args);
#ifdef __cplusplus
}