gnunetutil: add 2d and 3d allocation including tests
[oweals/gnunet.git] / src / include / gnunet_dv_service.h
index 9e49baf5722b39b791544abc583d4a18b4dd0137..bc592751750124d44f4158b7ccd2557f18fbadd0 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 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
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
  * @author Christian Grothoff
- * @file include/gnunet_dv_service.h
- * @brief DV service API (should only be used by the DV plugin)
+ *
+ * @file
+ * DV service API (should only be used by the DV plugin)
+ *
+ * @defgroup dv  DV service
+ * Distance Vector routing
+ *
+ * The DV service API should only be used by the DV plugin.
+ * @{
  */
 #ifndef GNUNET_SERVICE_DV_H
 #define GNUNET_SERVICE_DV_H
 
 #include "gnunet_util_lib.h"
-
+#include "gnunet_ats_service.h"
 
 /**
  * Signature of a function to be called if DV
  * @param distance distance to the peer
  * @param network the peer is located in
  */
-typedef void (*GNUNET_DV_ConnectCallback)(void *cls,
-                                         const struct GNUNET_PeerIdentity *peer,
-                                         uint32_t distance, uint32_t network);
+typedef void
+(*GNUNET_DV_ConnectCallback)(void *cls,
+                             const struct GNUNET_PeerIdentity *peer,
+                             uint32_t distance,
+                             enum GNUNET_ATS_Network_Type network);
 
 
 /**
@@ -50,10 +59,13 @@ typedef void (*GNUNET_DV_ConnectCallback)(void *cls,
  * @param cls closure
  * @param peer connected peer
  * @param distance new distance to the peer
+ * @param network this network will be used to reach the next hop
  */
-typedef void (*GNUNET_DV_DistanceChangedCallback)(void *cls,
-                                                 const struct GNUNET_PeerIdentity *peer,
-                                                 uint32_t distance);
+typedef void
+(*GNUNET_DV_DistanceChangedCallback)(void *cls,
+                                     const struct GNUNET_PeerIdentity *peer,
+                                     uint32_t distance,
+                                     enum GNUNET_ATS_Network_Type network);
 
 
 /**
@@ -63,8 +75,9 @@ typedef void (*GNUNET_DV_DistanceChangedCallback)(void *cls,
  * @param cls closure
  * @param peer peer that disconnected
  */
-typedef void (*GNUNET_DV_DisconnectCallback)(void *cls,
-                                            const struct GNUNET_PeerIdentity *peer);
+typedef void
+(*GNUNET_DV_DisconnectCallback)(void *cls,
+                                const struct GNUNET_PeerIdentity *peer);
 
 
 /**
@@ -76,10 +89,11 @@ typedef void (*GNUNET_DV_DisconnectCallback)(void *cls,
  * @param distance how far did the message travel
  * @param msg actual message payload
  */
-typedef void (*GNUNET_DV_MessageReceivedCallback)(void *cls,
-                                                 const struct GNUNET_PeerIdentity *sender,
-                                                 uint32_t distance,
-                                                 const struct GNUNET_MessageHeader *msg);
+typedef void
+(*GNUNET_DV_MessageReceivedCallback)(void *cls,
+                                     const struct GNUNET_PeerIdentity *sender,
+                                     uint32_t distance,
+                                     const struct GNUNET_MessageHeader *msg);
 
 
 /**
@@ -87,10 +101,9 @@ typedef void (*GNUNET_DV_MessageReceivedCallback)(void *cls,
  * message has been successful.
  *
  * @param cls closure
- * @param ok GNUNET_OK on success, GNUNET_SYSERR on error
  */
-typedef void (*GNUNET_DV_MessageSentCallback)(void *cls,
-                                             int ok);
+typedef void
+(*GNUNET_DV_MessageSentCallback)(void *cls);
 
 
 /**
@@ -140,27 +153,14 @@ struct GNUNET_DV_TransmitHandle;
  * @param sh service handle
  * @param target intended recpient
  * @param msg message payload
- * @param cb function to invoke when done
- * @param cb_cls closure for 'cb'
  * @return handle to cancel the operation
  */
-struct GNUNET_DV_TransmitHandle *
+void
 GNUNET_DV_send (struct GNUNET_DV_ServiceHandle *sh,
                const struct GNUNET_PeerIdentity *target,
-               const struct GNUNET_MessageHeader *msg,
-               GNUNET_DV_MessageSentCallback cb,
-               void *cb_cls);
-
-
-/**
- * Abort send operation (naturally, the message may have
- * already been transmitted; this only stops the 'cb'
- * from being called again).
- *
- * @param th send operation to cancel
- */
-void
-GNUNET_DV_send_cancel (struct GNUNET_DV_TransmitHandle *th);
+               const struct GNUNET_MessageHeader *msg);
 
 
 #endif
+
+/** @} */  /* end of group */