maplog headers, offline processing, doxygen tags

Change-Id: I0545018ec02f3706ad6a2da6fc13537db5c31a2d
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vppinfra/test_maplog.c b/src/vppinfra/test_maplog.c
index fb9fb0c..c49ebd6 100644
--- a/src/vppinfra/test_maplog.c
+++ b/src/vppinfra/test_maplog.c
@@ -23,15 +23,52 @@
   u64 junk[7];
 } test_entry_t;
 
+static void
+process_maplog_records (clib_maplog_header_t * h,
+			test_entry_t * e, u64 records_this_file)
+{
+  static int print_header;
+  int i = 0;
+
+  if (print_header == 0)
+    {
+      print_header = 1;
+      fformat (stdout, "%U", format_maplog_header, h, 1 /* verbose */ );
+    }
+
+  while (records_this_file--)
+    {
+      fformat (stdout, "%4lld ", e->serial_number);
+      if (++i == 8)
+	{
+	  fformat (stdout, "\n");
+	  i = 0;
+	}
+      e++;
+    }
+  fformat (stdout, "--------------\n");
+}
+
 int
 test_maplog_main (unformat_input_t * input)
 {
   clib_maplog_main_t *mm = &maplog_main;
+  clib_maplog_init_args_t _a, *a = &_a;
   int rv;
   int i;
   test_entry_t *t;
 
-  rv = clib_maplog_init (mm, "/tmp/maplog_test", 4096, sizeof (test_entry_t));
+  memset (a, 0, sizeof (*a));
+  a->mm = mm;
+  a->file_basename = "/tmp/maplog_test";
+  a->file_size_in_bytes = 4096;
+  a->record_size_in_bytes = sizeof (test_entry_t);
+  a->application_id = 1;
+  a->application_major_version = 1;
+  a->application_minor_version = 0;
+  a->application_patch_version = 0;
+
+  rv = clib_maplog_init (a);
 
   if (rv)
     {
@@ -47,6 +84,8 @@
 
   clib_maplog_close (mm);
 
+  clib_maplog_process ("/tmp/maplog_test", process_maplog_records);
+
   return 0;
 }