+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.
+ * NOT nul terminated.
+ */
+u8 *
+vl_api_from_api_to_new_vec (vl_api_string_t * astr)
+{
+ u8 *v = 0;
+ vec_add (v, astr->buf, clib_net_to_host_u32 (astr->length));
+ return v;
+}
+
+/*
+ * Returns a new vector. Remember to free it after use.
+ * Nul terminated.
+ */
+char *
+vl_api_from_api_to_new_c_string (vl_api_string_t * astr)
+{
+ char *v = 0;
+ if (clib_net_to_host_u32 (astr->length) > 0)
+ {
+ vec_add (v, astr->buf, clib_net_to_host_u32 (astr->length));
+ vec_add1 (v, 0);
+ }
+ return v;
+}
+
+void
+vl_api_set_elog_main (elog_main_t * m)
+{
+ api_main_t *am = vlibapi_get_main ();
+ am->elog_main = m;
+}
+
+int
+vl_api_set_elog_trace_api_messages (int enable)
+{
+ int rv;
+ api_main_t *am = vlibapi_get_main ();
+
+ rv = am->elog_trace_api_messages;
+ am->elog_trace_api_messages = enable;
+ return rv;
+}
+
+int
+vl_api_get_elog_trace_api_messages (void)
+{
+ api_main_t *am = vlibapi_get_main ();
+
+ return am->elog_trace_api_messages;
+}