octeon: add support for Marvell Octeon9 SoC
[vpp.git] / src / plugins / mactime / builtins.c
index e90ac66..c487d03 100644 (file)
@@ -1,5 +1,4 @@
 #include <vnet/vnet.h>
-#include <builtinurl/builtinurl.h>
 #include <http_static/http_static.h>
 #include <mactime/mactime.h>
 #include <vlib/unix/plugin.h>
@@ -15,9 +14,8 @@ mactime_ip_neighbor_copy (index_t ipni, void *ctx)
   return (WALK_CONTINUE);
 }
 
-static int
-handle_get_mactime (http_builtin_method_type_t reqtype,
-                   u8 * request, http_session_t * hs)
+static hss_url_handler_rc_t
+handle_get_mactime (hss_url_handler_args_t *args)
 {
   mactime_main_t *mm = &mactime_main;
   mactime_device_t *dp;
@@ -35,19 +33,17 @@ handle_get_mactime (http_builtin_method_type_t reqtype,
 
   /* Walk all ip4 neighbours on all interfaces */
   vec_reset_length (mm->arp_cache_copy);
-  ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
+  ip_neighbor_walk (AF_IP4, ~0, mactime_ip_neighbor_copy, mm);
 
   now = clib_timebase_now (&mm->timebase);
 
   if (PREDICT_FALSE ((now - mm->sunday_midnight) > 86400.0 * 7.0))
     mm->sunday_midnight = clib_timebase_find_sunday_midnight (now);
 
-    /* *INDENT-OFF* */
-    pool_foreach (dp, mm->devices,
-    ({
-        vec_add1 (pool_indices, dp - mm->devices);
-    }));
-    /* *INDENT-ON* */
+  pool_foreach (dp, mm->devices)
+    {
+      vec_add1 (pool_indices, dp - mm->devices);
+    }
 
   s = format (s, "{%smactime%s: [\n", q, q);
 
@@ -149,21 +145,20 @@ handle_get_mactime (http_builtin_method_type_t reqtype,
   vec_free (macstring);
   vec_free (pool_indices);
 
-  hs->data = s;
-  hs->data_offset = 0;
-  hs->cache_pool_index = ~0;
-  hs->free_data = 1;
-  return 0;
+  args->data = s;
+  args->data_len = vec_len (s);
+  args->free_vec_data = 1;
+  return HSS_URL_HANDLER_OK;
 }
 
 void
 mactime_url_init (vlib_main_t * vm)
 {
-  void (*fp) (void *, char *, int);
+  hss_register_url_fn fp;
 
   /* Look up the builtin URL registration handler */
   fp = vlib_get_plugin_symbol ("http_static_plugin.so",
-                              "http_static_server_register_builtin_handler");
+                              "hss_register_url_handler");
 
   if (fp == 0)
     {
@@ -171,7 +166,7 @@ mactime_url_init (vlib_main_t * vm)
       return;
     }
 
-  (*fp) (handle_get_mactime, "mactime.json", HTTP_BUILTIN_METHOD_GET);
+  (*fp) (handle_get_mactime, "mactime.json", HTTP_REQ_GET);
 }
 
 /*