refactor DHT for new service API
[oweals/gnunet.git] / src / arm / arm_monitor_api.c
index 6d4129928e131e2fdbea15a36e77d0bbfcb23438..471393c7e13274dc52be228ff137960c556a1efe 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2012, 2013 GNUnet e.V.
+     Copyright (C) 2009, 2010, 2012, 2013, 2016 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -21,7 +21,8 @@
 /**
  * @file arm/arm_monitor_api.c
  * @brief API for monitoring the ARM service
- * @author Christian Grothoff, LRN
+ * @author Christian Grothoff
+ * @author LRN
  */
 #include "platform.h"
 #include "gnunet_arm_service.h"
@@ -130,10 +131,10 @@ reconnect_arm_monitor_later (struct GNUNET_ARM_MonitorHandle *h)
  */
 static int
 check_monitor_notify (void *cls,
-                       const struct GNUNET_ARM_StatusMessage *res)
+                       const struct GNUNET_ARM_StatusMessage *msg)
 {
-  size_t sl = ntohs (res->header.size) - sizeof (struct GNUNET_ARM_StatusMessage);
-  const char *name = (const char *) &res[1];
+  size_t sl = ntohs (msg->header.size) - sizeof (struct GNUNET_ARM_StatusMessage);
+  const char *name = (const char *) &msg[1];
 
   if ( (0 == sl) ||
        ('\0' != name[sl-1]) )
@@ -149,7 +150,7 @@ check_monitor_notify (void *cls,
  * Handler for notification messages received from ARM.
  *
  * @param cls our `struct GNUNET_ARM_MonitorHandle`
- * @param msg the message received from the arm service
+ * @param res the message received from the arm service
  */
 static void
 handle_monitor_notify (void *cls,
@@ -197,11 +198,11 @@ mq_error_handler (void *cls,
 static int
 reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h)
 {
-  GNUNET_MQ_hd_var_size (monitor_notify,
-                         GNUNET_MESSAGE_TYPE_ARM_STATUS,
-                         struct GNUNET_ARM_StatusMessage);
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_monitor_notify_handler (h),
+    GNUNET_MQ_hd_var_size (monitor_notify,
+                           GNUNET_MESSAGE_TYPE_ARM_STATUS,
+                           struct GNUNET_ARM_StatusMessage,
+                           h),
     GNUNET_MQ_handler_end ()
   };
   struct GNUNET_MessageHeader *msg;
@@ -241,9 +242,9 @@ reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h)
  * @return context to use for further ARM monitor operations, NULL on error.
  */
 struct GNUNET_ARM_MonitorHandle *
-GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                    GNUNET_ARM_ServiceStatusCallback cont,
-                    void *cont_cls)
+GNUNET_ARM_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                          GNUNET_ARM_ServiceStatusCallback cont,
+                          void *cont_cls)
 {
   struct GNUNET_ARM_MonitorHandle *h;
 
@@ -266,7 +267,7 @@ GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg,
  * @param h the handle that was being used
  */
 void
-GNUNET_ARM_monitor_disconnect_and_free (struct GNUNET_ARM_MonitorHandle *h)
+GNUNET_ARM_monitor_stop (struct GNUNET_ARM_MonitorHandle *h)
 {
   if (NULL != h->mq)
   {