tcp: reorganize connection members
[vpp.git] / src / vppinfra / format.h
index bec1b6b..70882ad 100644 (file)
@@ -68,10 +68,10 @@ word va_fformat (FILE * f, char *fmt, va_list * va);
 word fformat (FILE * f, char *fmt, ...);
 word fdformat (int fd, char *fmt, ...);
 
-always_inline uword
+always_inline u32
 format_get_indent (u8 * s)
 {
-  uword indent = 0;
+  u32 indent = 0;
   u8 *nl;
 
   if (!s)
@@ -87,13 +87,14 @@ format_get_indent (u8 * s)
   return indent;
 }
 
-#define _(f) u8 * f (u8 * s, va_list * va)
+#define _(f) __clib_export u8 * f (u8 * s, va_list * va)
 
 /* Standard user-defined formats. */
 _(format_vec32);
 _(format_vec_uword);
 _(format_ascii_bytes);
 _(format_hex_bytes);
+_(format_hex_bytes_no_wrap);
 _(format_white_space);
 _(format_f64);
 _(format_time_interval);
@@ -101,17 +102,10 @@ _(format_time_interval);
 #ifdef CLIB_UNIX
 /* Unix specific formats. */
 _(format_address_family);
-_(format_unix_arphrd);
-_(format_unix_interface_flags);
 _(format_network_address);
 _(format_network_protocol);
 _(format_network_port);
 _(format_sockaddr);
-_(format_ip4_tos_byte);
-_(format_ip4_packet);
-_(format_icmp4_type_and_code);
-_(format_ethernet_packet);
-_(format_hostname);
 _(format_timeval);
 _(format_time_float);
 _(format_signal);
@@ -152,7 +146,7 @@ unformat_init (unformat_input_t * i,
               uword (*fill_buffer) (unformat_input_t *),
               void *fill_buffer_arg)
 {
-  memset (i, 0, sizeof (i[0]));
+  clib_memset (i, 0, sizeof (i[0]));
   i->fill_buffer = fill_buffer;
   i->fill_buffer_arg = fill_buffer_arg;
 }
@@ -162,7 +156,7 @@ unformat_free (unformat_input_t * i)
 {
   vec_free (i->buffer);
   vec_free (i->buffer_marks);
-  memset (i, 0, sizeof (i[0]));
+  clib_memset (i, 0, sizeof (i[0]));
 }
 
 always_inline uword
@@ -296,6 +290,12 @@ unformat_function_t unformat_memory_size;
 /* Unparse memory size e.g. 100, 100k, 100m, 100g. */
 u8 *format_memory_size (u8 * s, va_list * va);
 
+/* Parse memory page size e.g. 4K, 2M */
+unformat_function_t unformat_log2_page_size;
+
+/* Unparse memory page size e.g. 4K, 2M */
+u8 *format_log2_page_size (u8 * s, va_list * va);
+
 /* Format c identifier: e.g. a_name -> "a name". */
 u8 *format_c_identifier (u8 * s, va_list * va);
 
@@ -305,13 +305,18 @@ u8 *format_hexdump (u8 * s, va_list * va);
 /* Unix specific formats. */
 #ifdef CLIB_UNIX
 /* Setup input from Unix file. */
-void unformat_init_unix_file (unformat_input_t * input, int file_descriptor);
+void unformat_init_clib_file (unformat_input_t * input, int file_descriptor);
 
 /* Take input from Unix environment variable; returns
    1 if variable exists zero otherwise. */
 uword unformat_init_unix_env (unformat_input_t * input, char *var);
+
+/* Unformat unix group id (gid) specified as integer or string */
+unformat_function_t unformat_unix_gid;
 #endif /* CLIB_UNIX */
 
+uword unformat_data_size (unformat_input_t * input, va_list * args);
+
 /* Test code. */
 int test_format_main (unformat_input_t * input);
 int test_unformat_main (unformat_input_t * input);