gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: starting with #5385 in earn


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: starting with #5385 in earnest
Date: Sat, 26 Jan 2019 20:50:07 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 7fc78674a starting with #5385 in earnest
7fc78674a is described below

commit 7fc78674a6d3f2edb41e32cea59200908d0b344b
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Jan 26 20:49:59 2019 +0100

    starting with #5385 in earnest
---
 src/cadet/Makefile.am              |   3 +-
 src/cadet/cadet_api.c              | 571 -------------------------------------
 src/cadet/cadet_api_get_channel.c  |  96 +++++++
 src/cadet/cadet_api_get_peer.c     | 219 ++++++++++++++
 src/cadet/cadet_api_helper.c       |  55 ++++
 src/cadet/cadet_api_list_peers.c   | 179 ++++++++++++
 src/cadet/cadet_api_list_tunnels.c | 187 ++++++++++++
 src/cadet/gnunet-cadet.c           |  91 +++---
 src/include/gnunet_cadet_service.h | 254 +++++++++--------
 9 files changed, 907 insertions(+), 748 deletions(-)

diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am
index b2d436061..bccaf2cd9 100644
--- a/src/cadet/Makefile.am
+++ b/src/cadet/Makefile.am
@@ -33,7 +33,8 @@ lib_LTLIBRARIES = \
   $(EXP_LIB)
 
 libgnunetcadet_la_SOURCES = \
-  cadet_api.c
+  cadet_api.c \
+  cadet_api_helper.c 
 libgnunetcadet_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(XLIB) \
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index f9b81a82b..ce2356216 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -32,39 +32,6 @@
 
 #define LOG(kind,...) GNUNET_log_from (kind, "cadet-api",__VA_ARGS__)
 
-/**
- * Ugly legacy hack.
- */
-union CadetInfoCB
-{
-
-  /**
-   * Channel callback.
-   */
-  GNUNET_CADET_ChannelCB channel_cb;
-
-  /**
-   * Monitor callback
-   */
-  GNUNET_CADET_PeersCB peers_cb;
-
-  /**
-   * Monitor callback
-   */
-  GNUNET_CADET_PeerCB peer_cb;
-
-  /**
-   * Monitor callback
-   */
-  GNUNET_CADET_TunnelsCB tunnels_cb;
-
-  /**
-   * Tunnel callback.
-   */
-  GNUNET_CADET_TunnelCB tunnel_cb;
-};
-
-
 /**
  * Opaque handle to the service.
  */
@@ -100,16 +67,6 @@ struct GNUNET_CADET_Handle
    */
   struct GNUNET_SCHEDULER_Task *reconnect_task;
 
-  /**
-   * Callback for an info task (only one active at a time).
-   */
-  union CadetInfoCB info_cb;
-
-  /**
-   * Info callback closure for @c info_cb.
-   */
-  void *info_cls;
-
   /**
    * Time to the next reconnect in case one reconnect fails
    */
@@ -853,288 +810,6 @@ handle_mq_error (void *cls,
 }
 
 
-/**
- * Check that message received from CADET service is well-formed.
- *
- * @param cls the `struct GNUNET_CADET_Handle`
- * @param message the message we got
- * @return #GNUNET_OK if the message is well-formed,
- *         #GNUNET_SYSERR otherwise
- */
-static int
-check_get_peers (void *cls,
-                 const struct GNUNET_MessageHeader *message)
-{
-  size_t esize;
-
-  (void) cls;
-  esize = ntohs (message->size);
-  if (sizeof (struct GNUNET_CADET_LocalInfoPeer) == esize)
-    return GNUNET_OK;
-  if (sizeof (struct GNUNET_MessageHeader) == esize)
-    return GNUNET_OK;
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Process a local reply about info on all tunnels, pass info to the user.
- *
- * @param cls Closure (Cadet handle).
- * @param msg Message itself.
- */
-static void
-handle_get_peers (void *cls,
-                  const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_CADET_Handle *h = cls;
-  const struct GNUNET_CADET_LocalInfoPeer *info =
-    (const struct GNUNET_CADET_LocalInfoPeer *) msg;
-
-  if (NULL == h->info_cb.peers_cb)
-    return;
-  if (sizeof (struct GNUNET_CADET_LocalInfoPeer) == ntohs (msg->size))
-    h->info_cb.peers_cb (h->info_cls,
-                         &info->destination,
-                         (int) ntohs (info->tunnel),
-                         (unsigned int) ntohs (info->paths),
-                         0);
-  else
-    h->info_cb.peers_cb (h->info_cls,
-                         NULL,
-                         0,
-                         0,
-                         0);
-}
-
-
-/**
- * Check that message received from CADET service is well-formed.
- *
- * @param cls the `struct GNUNET_CADET_Handle`
- * @param message the message we got
- * @return #GNUNET_OK if the message is well-formed,
- *         #GNUNET_SYSERR otherwise
- */
-static int
-check_get_peer (void *cls,
-                const struct GNUNET_CADET_LocalInfoPeer *message)
-{
-  size_t msize = sizeof (struct GNUNET_CADET_LocalInfoPeer);
-  size_t esize;
-
-  (void) cls;
-  esize = ntohs (message->header.size);
-  if (esize < msize)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (0 != ((esize - msize) % sizeof (struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Process a local peer info reply, pass info to the user.
- *
- * @param cls Closure (Cadet handle).
- * @param message Message itself.
- */
-static void
-handle_get_peer (void *cls,
-                 const struct GNUNET_CADET_LocalInfoPeer *message)
-{
-  struct GNUNET_CADET_Handle *h = cls;
-  const struct GNUNET_PeerIdentity *paths_array;
-  unsigned int paths;
-  unsigned int path_length;
-  int neighbor;
-  unsigned int peers;
-
-  if (NULL == h->info_cb.peer_cb)
-    return;
-  
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-    "number of paths %u\n",
-    ntohs (message->paths));
-  
-  paths = ntohs (message->paths);
-  paths_array = (const struct GNUNET_PeerIdentity *) &message[1];
-  peers = (ntohs (message->header.size) - sizeof (*message))
-          / sizeof (struct GNUNET_PeerIdentity);
-  path_length = 0;
-  neighbor = GNUNET_NO;
-
-  for (unsigned int i = 0; i < peers; i++)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                " %s\n",
-                GNUNET_i2s (&paths_array[i]));
-    path_length++;
-    if (0 == memcmp (&paths_array[i], &message->destination,
-                     sizeof (struct GNUNET_PeerIdentity)))
-    {
-      if (1 == path_length)
-        neighbor = GNUNET_YES;
-      path_length = 0;
-    }
-  }
-
-  /* Call Callback with tunnel info. */
-  paths_array = (const struct GNUNET_PeerIdentity *) &message[1];
-  h->info_cb.peer_cb (h->info_cls,
-                      &message->destination,
-                      (int) ntohs (message->tunnel),
-                      neighbor,
-                      paths,
-                      paths_array,
-                      (int) ntohs (message->offset),
-                      (int) ntohs (message->finished_with_paths));
-}
-
-
-/**
- * Check that message received from CADET service is well-formed.
- *
- * @param cls the `struct GNUNET_CADET_Handle`
- * @param message the message we got
- * @return #GNUNET_OK if the message is well-formed,
- *         #GNUNET_SYSERR otherwise
- */
-static int
-check_get_tunnels (void *cls,
-                   const struct GNUNET_MessageHeader *message)
-{
-  size_t esize;
-
-  (void) cls;
-  esize = ntohs (message->size);
-  if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == esize)
-    return GNUNET_OK;
-  if (sizeof (struct GNUNET_MessageHeader) == esize)
-    return GNUNET_OK;
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Process a local reply about info on all tunnels, pass info to the user.
- *
- * @param cls Closure (Cadet handle).
- * @param message Message itself.
- */
-static void
-handle_get_tunnels (void *cls,
-                    const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_CADET_Handle *h = cls;
-  const struct GNUNET_CADET_LocalInfoTunnel *info =
-    (const struct GNUNET_CADET_LocalInfoTunnel *) msg;
-
-  if (NULL == h->info_cb.tunnels_cb)
-    return;
-  if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == ntohs (msg->size))
-    h->info_cb.tunnels_cb (h->info_cls,
-                           &info->destination,
-                           ntohl (info->channels),
-                           ntohl (info->connections),
-                           ntohs (info->estate),
-                           ntohs (info->cstate));
-  else
-    h->info_cb.tunnels_cb (h->info_cls,
-                           NULL,
-                           0,
-                           0,
-                           0,
-                           0);
-}
-
-
-/**
- * Check that message received from CADET service is well-formed.
- *
- * @param cls the `struct GNUNET_CADET_Handle`
- * @param msg the message we got
- * @return #GNUNET_OK if the message is well-formed,
- *         #GNUNET_SYSERR otherwise
- */
-static int
-check_get_tunnel (void *cls,
-                  const struct GNUNET_CADET_LocalInfoTunnel *msg)
-{
-  unsigned int ch_n;
-  unsigned int c_n;
-  size_t esize;
-  size_t msize;
-
-  (void) cls;
-  /* Verify message sanity */
-  msize = ntohs (msg->header.size);
-  esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
-  if (esize > msize)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  ch_n = ntohl (msg->channels);
-  c_n = ntohl (msg->connections);
-  esize += ch_n * sizeof (struct GNUNET_CADET_ChannelTunnelNumber);
-  esize += c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier);
-  if (msize != esize)
-  {
-    GNUNET_break_op (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "m:%u, e: %u (%u ch, %u conn)\n",
-                (unsigned int) msize,
-                (unsigned int) esize,
-                ch_n,
-                c_n);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Process a local tunnel info reply, pass info to the user.
- *
- * @param cls Closure (Cadet handle).
- * @param msg Message itself.
- */
-static void
-handle_get_tunnel (void *cls,
-                   const struct GNUNET_CADET_LocalInfoTunnel *msg)
-{
-  struct GNUNET_CADET_Handle *h = cls;
-  unsigned int ch_n;
-  unsigned int c_n;
-  const struct GNUNET_CADET_ConnectionTunnelIdentifier *conns;
-  const struct GNUNET_CADET_ChannelTunnelNumber *chns;
-
-  if (NULL == h->info_cb.tunnel_cb)
-    return;
-  ch_n = ntohl (msg->channels);
-  c_n = ntohl (msg->connections);
-
-  /* Call Callback with tunnel info. */
-  conns = (const struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1];
-  chns = (const struct GNUNET_CADET_ChannelTunnelNumber *) &conns[c_n];
-  h->info_cb.tunnel_cb (h->info_cls,
-                        &msg->destination,
-                        ch_n,
-                        c_n,
-                        chns,
-                        conns,
-                        ntohs (msg->estate),
-                        ntohs (msg->cstate));
-}
-
-
 /**
  * Reconnect to the service, retransmit all infomation to try to restore the
  * original state.
@@ -1161,22 +836,6 @@ reconnect (struct GNUNET_CADET_Handle *h)
                              GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK,
                              struct GNUNET_CADET_LocalAck,
                              h),
-    GNUNET_MQ_hd_var_size (get_peers,
-                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS,
-                           struct GNUNET_MessageHeader,
-                           h),
-    GNUNET_MQ_hd_var_size (get_peer,
-                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER,
-                           struct GNUNET_CADET_LocalInfoPeer,
-                           h),
-    GNUNET_MQ_hd_var_size (get_tunnels,
-                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS,
-                           struct GNUNET_MessageHeader,
-                           h),
-    GNUNET_MQ_hd_var_size (get_tunnel,
-                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL,
-                           struct GNUNET_CADET_LocalInfoTunnel,
-                           h),
     GNUNET_MQ_handler_end ()
   };
 
@@ -1369,236 +1028,6 @@ GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel 
*channel)
 }
 
 
-/**
- * Send message of @a type to CADET service of @a h
- *
- * @param h handle to CADET service
- * @param type message type of trivial information request to send
- */
-static void
-send_info_request (struct GNUNET_CADET_Handle *h,
-                   uint16_t type)
-{
-  struct GNUNET_MessageHeader *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  env = GNUNET_MQ_msg (msg,
-                       type);
-  GNUNET_MQ_send (h->mq,
-                  env);
-}
-
-
-/**
- * Request a debug dump on the service's STDERR.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h cadet handle
- */
-void
-GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h)
-{
-  send_info_request (h,
-                     GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_DUMP);
-}
-
-
-/**
- * Request information about peers known to the running cadet service.
- * The callback will be called for every peer known to the service.
- * Only one info request (of any kind) can be active at once.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- * @return #GNUNET_OK / #GNUNET_SYSERR
- */
-int
-GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
-                       GNUNET_CADET_PeersCB callback,
-                       void *callback_cls)
-{
-  if (NULL != h->info_cb.peers_cb)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  send_info_request (h,
-                     GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
-  h->info_cb.peers_cb = callback;
-  h->info_cls = callback_cls;
-  return GNUNET_OK;
-}
-
-
-/**
- * Cancel a peer info request. The callback will not be called (anymore).
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Cadet handle.
- * @return Closure given to GNUNET_CADET_get_peers().
- */
-void *
-GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h)
-{
-  void *cls = h->info_cls;
-
-  h->info_cb.peers_cb = NULL;
-  h->info_cls = NULL;
-  return cls;
-}
-
-
-/**
- * Request information about a peer known to the running cadet peer.
- * The callback will be called for the tunnel once.
- * Only one info request (of any kind) can be active at once.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param id Peer whose tunnel to examine.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- * @return #GNUNET_OK / #GNUNET_SYSERR
- */
-int
-GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
-                       const struct GNUNET_PeerIdentity *id,
-                       GNUNET_CADET_PeerCB callback,
-                       void *callback_cls)
-{
-  struct GNUNET_CADET_LocalInfo *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  if (NULL != h->info_cb.peer_cb)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER);
-  msg->peer = *id;
-  GNUNET_MQ_send (h->mq,
-                  env);
-  h->info_cb.peer_cb = callback;
-  h->info_cls = callback_cls;
-  return GNUNET_OK;
-}
-
-
-/**
- * Request information about tunnels of the running cadet peer.
- * The callback will be called for every tunnel of the service.
- * Only one info request (of any kind) can be active at once.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- * @return #GNUNET_OK / #GNUNET_SYSERR
- */
-int
-GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h,
-                         GNUNET_CADET_TunnelsCB callback,
-                         void *callback_cls)
-{
-  if (NULL != h->info_cb.tunnels_cb)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  send_info_request (h,
-                     GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
-  h->info_cb.tunnels_cb = callback;
-  h->info_cls = callback_cls;
-  return GNUNET_OK;
-}
-
-
-/**
- * Cancel a monitor request. The monitor callback will not be called.
- *
- * @param h Cadet handle.
- * @return Closure given to GNUNET_CADET_get_tunnels().
- */
-void *
-GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h)
-{
-  void *cls = h->info_cls;
-
-  h->info_cb.tunnels_cb = NULL;
-  h->info_cls = NULL;
-  return cls;
-}
-
-
-/**
- * Request information about a tunnel of the running cadet peer.
- * The callback will be called for the tunnel once.
- * Only one info request (of any kind) can be active at once.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param id Peer whose tunnel to examine.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- * @return #GNUNET_OK / #GNUNET_SYSERR
- */
-int
-GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h,
-                        const struct GNUNET_PeerIdentity *id,
-                        GNUNET_CADET_TunnelCB callback,
-                        void *callback_cls)
-{
-  struct GNUNET_CADET_LocalInfo *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  if (NULL != h->info_cb.tunnel_cb)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
-  msg->peer = *id;
-  GNUNET_MQ_send (h->mq,
-                  env);
-  h->info_cb.tunnel_cb = callback;
-  h->info_cls = callback_cls;
-  return GNUNET_OK;
-}
-
-
-/**
- * Transitional function to convert an unsigned int port to a hash value.
- * WARNING: local static value returned, NOT reentrant!
- * WARNING: do not use this function for new code!
- *
- * @param port Numerical port (unsigned int format).
- *
- * @return A GNUNET_HashCode usable for the new CADET API.
- */
-const struct GNUNET_HashCode *
-GC_u2h (uint32_t port)
-{
-  static struct GNUNET_HashCode hash;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "This is a transitional function, use proper crypto hashes as 
CADET ports\n");
-  GNUNET_CRYPTO_hash (&port,
-                      sizeof (port),
-                      &hash);
-  return &hash;
-}
-
-
 /**
  * Connect to the MQ-based cadet service.
  *
diff --git a/src/cadet/cadet_api_get_channel.c 
b/src/cadet/cadet_api_get_channel.c
new file mode 100644
index 000000000..c36766a3f
--- /dev/null
+++ b/src/cadet/cadet_api_get_channel.c
@@ -0,0 +1,96 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2011, 2017 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+*/
+/**
+ * @file cadet/cadet_api_get_channel.c
+ * @brief cadet api: client implementation of cadet service
+ * @author Bartlomiej Polot
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_constants.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
+
+
+
+/**
+ * Ugly legacy hack.
+ */
+struct GNUNET_CADET_ChannelMonitor
+{
+
+  /**
+   * Channel callback.
+   */
+  GNUNET_CADET_ChannelCB channel_cb;
+
+  /**
+   * Info callback closure for @c channel_cb.
+   */
+  void *channel_cb_cls;
+
+};
+
+
+/**
+ * Send message of @a type to CADET service of @a h
+ *
+ * @param h handle to CADET service
+ * @param type message type of trivial information request to send
+ */
+static void
+send_info_request (struct GNUNET_CADET_Handle *h,
+                   uint16_t type)
+{
+  struct GNUNET_MessageHeader *msg;
+  struct GNUNET_MQ_Envelope *env;
+
+  env = GNUNET_MQ_msg (msg,
+                       type);
+  GNUNET_MQ_send (h->mq,
+                  env);
+}
+
+/**
+ * Request information about a specific channel of the running cadet peer.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param peer ID of the other end of the channel.
+ * @param channel_number Channel number.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ */
+struct GNUNET_CADET_ChannelMonitor *
+GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
+                          struct GNUNET_PeerIdentity *peer,
+                          uint32_t /* UGH */ channel_number,
+                          GNUNET_CADET_ChannelCB callback,
+                          void *callback_cls)
+{
+}
+
+
+void *
+GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm);
+
diff --git a/src/cadet/cadet_api_get_peer.c b/src/cadet/cadet_api_get_peer.c
new file mode 100644
index 000000000..b29b66e1c
--- /dev/null
+++ b/src/cadet/cadet_api_get_peer.c
@@ -0,0 +1,219 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2011, 2017 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+*/
+/**
+ * @file cadet/cadet_api_get_peer.c
+ * @brief cadet api: client implementation of cadet service
+ * @author Bartlomiej Polot
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_constants.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
+
+
+
+/**
+ * Ugly legacy hack.
+ */
+struct GNUNET_CADET_GetPeer
+{
+
+  /**
+   * Monitor callback
+   */
+  GNUNET_CADET_PeerCB peer_cb;
+
+  /**
+   * Info callback closure for @c info_cb.
+   */
+  void *peer_cb_cls;
+
+
+};
+
+
+/**
+ * Send message of @a type to CADET service of @a h
+ *
+ * @param h handle to CADET service
+ * @param type message type of trivial information request to send
+ */
+static void
+send_info_request (struct GNUNET_CADET_Handle *h,
+                   uint16_t type)
+{
+  struct GNUNET_MessageHeader *msg;
+  struct GNUNET_MQ_Envelope *env;
+
+  env = GNUNET_MQ_msg (msg,
+                       type);
+  GNUNET_MQ_send (h->mq,
+                  env);
+}
+
+
+/**
+ * Check that message received from CADET service is well-formed.
+ *
+ * @param cls the `struct GNUNET_CADET_Handle`
+ * @param message the message we got
+ * @return #GNUNET_OK if the message is well-formed,
+ *         #GNUNET_SYSERR otherwise
+ */
+static int
+check_get_peer (void *cls,
+                const struct GNUNET_CADET_LocalInfoPeer *message)
+{
+  size_t msize = sizeof (struct GNUNET_CADET_LocalInfoPeer);
+  size_t esize;
+
+  (void) cls;
+  esize = ntohs (message->header.size);
+  if (esize < msize)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  if (0 != ((esize - msize) % sizeof (struct GNUNET_PeerIdentity)))
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_OK;
+}
+
+
+/**
+ * Process a local peer info reply, pass info to the user.
+ *
+ * @param cls Closure (Cadet handle).
+ * @param message Message itself.
+ */
+static void
+handle_get_peer (void *cls,
+                 const struct GNUNET_CADET_LocalInfoPeer *message)
+{
+  struct GNUNET_CADET_Handle *h = cls;
+  const struct GNUNET_PeerIdentity *paths_array;
+  unsigned int paths;
+  unsigned int path_length;
+  int neighbor;
+  unsigned int peers;
+
+  if (NULL == h->info_cb.peer_cb)
+    return;
+  
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+    "number of paths %u\n",
+    ntohs (message->paths));
+  
+  paths = ntohs (message->paths);
+  paths_array = (const struct GNUNET_PeerIdentity *) &message[1];
+  peers = (ntohs (message->header.size) - sizeof (*message))
+          / sizeof (struct GNUNET_PeerIdentity);
+  path_length = 0;
+  neighbor = GNUNET_NO;
+
+  for (unsigned int i = 0; i < peers; i++)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                " %s\n",
+                GNUNET_i2s (&paths_array[i]));
+    path_length++;
+    if (0 == memcmp (&paths_array[i], &message->destination,
+                     sizeof (struct GNUNET_PeerIdentity)))
+    {
+      if (1 == path_length)
+        neighbor = GNUNET_YES;
+      path_length = 0;
+    }
+  }
+
+  /* Call Callback with tunnel info. */
+  paths_array = (const struct GNUNET_PeerIdentity *) &message[1];
+  h->info_cb.peer_cb (h->info_cls,
+                      &message->destination,
+                      (int) ntohs (message->tunnel),
+                      neighbor,
+                      paths,
+                      paths_array,
+                      (int) ntohs (message->offset),
+                      (int) ntohs (message->finished_with_paths));
+}
+
+
+
+
+/**
+ * Request information about a peer known to the running cadet peer.
+ * The callback will be called for the tunnel once.
+ * Only one info request (of any kind) can be active at once.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param id Peer whose tunnel to examine.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ * @return #GNUNET_OK / #GNUNET_SYSERR
+ */
+int
+GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                        const struct GNUNET_PeerIdentity *id,
+                       GNUNET_CADET_PeerCB callback,
+                       void *callback_cls)
+{
+  struct GNUNET_CADET_LocalInfo *msg;
+  struct GNUNET_MQ_Envelope *env;
+  struct GNUNET_MQ_MessageHandler handlers[] = {
+
+    GNUNET_MQ_hd_var_size (get_peers,
+                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS,
+                           struct GNUNET_MessageHeader,
+                           h),
+    GNUNET_MQ_hd_var_size (get_peer,
+                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER,
+                           struct GNUNET_CADET_LocalInfoPeer,
+                           h),
+    GNUNET_MQ_handler_end ()
+
+  
+  if (NULL != h->info_cb.peer_cb)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  env = GNUNET_MQ_msg (msg,
+                       GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER);
+  msg->peer = *id;
+  GNUNET_MQ_send (h->mq,
+                  env);
+  h->info_cb.peer_cb = callback;
+  h->info_cls = callback_cls;
+  return GNUNET_OK;
+}
+
+
+
+
+
diff --git a/src/cadet/cadet_api_helper.c b/src/cadet/cadet_api_helper.c
new file mode 100644
index 000000000..6f7634068
--- /dev/null
+++ b/src/cadet/cadet_api_helper.c
@@ -0,0 +1,55 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2011, 2017 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+*/
+/**
+ * @file cadet/cadet_api_helper.c
+ * @brief cadet api: client implementation of cadet service
+ * @author Bartlomiej Polot
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_constants.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
+
+
+/**
+ * Transitional function to convert an unsigned int port to a hash value.
+ * WARNING: local static value returned, NOT reentrant!
+ * WARNING: do not use this function for new code!
+ *
+ * @param port Numerical port (unsigned int format).
+ *
+ * @return A GNUNET_HashCode usable for the new CADET API.
+ */
+const struct GNUNET_HashCode *
+GC_u2h (uint32_t port)
+{
+  static struct GNUNET_HashCode hash;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "This is a transitional function, use proper crypto hashes as 
CADET ports\n");
+  GNUNET_CRYPTO_hash (&port,
+                      sizeof (port),
+                      &hash);
+  return &hash;
+}
+
diff --git a/src/cadet/cadet_api_list_peers.c b/src/cadet/cadet_api_list_peers.c
new file mode 100644
index 000000000..4bdc8b961
--- /dev/null
+++ b/src/cadet/cadet_api_list_peers.c
@@ -0,0 +1,179 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2011, 2017 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+*/
+/**
+ * @file cadet/cadet_api.c
+ * @brief cadet api: client implementation of cadet service
+ * @author Bartlomiej Polot
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_constants.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
+
+
+
+/**
+ * Ugly legacy hack.
+ */
+struct GNUNET_CADET_PeersLister
+{
+
+  /**
+   * Monitor callback
+   */
+  GNUNET_CADET_PeersCB peers_cb;
+
+  /**
+   * Info callback closure for @c info_cb.
+   */
+  void *peers_cb_cls;
+};
+
+
+/**
+ * Send message of @a type to CADET service of @a h
+ *
+ * @param h handle to CADET service
+ * @param type message type of trivial information request to send
+ */
+static void
+send_info_request (struct GNUNET_CADET_Handle *h,
+                   uint16_t type)
+{
+  struct GNUNET_MessageHeader *msg;
+  struct GNUNET_MQ_Envelope *env;
+
+  env = GNUNET_MQ_msg (msg,
+                       type);
+  GNUNET_MQ_send (h->mq,
+                  env);
+}
+
+
+/**
+ * Request information about peers known to the running cadet service.
+ * The callback will be called for every peer known to the service.
+ * Only one info request (of any kind) can be active at once.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ * @return #GNUNET_OK / #GNUNET_SYSERR
+ */
+int
+GNUNET_CADET_list_peers (struct GNUNET_CADET_Handle *h,
+                        GNUNET_CADET_PeersCB callback,
+                        void *callback_cls)
+{
+  if (NULL != h->info_cb.peers_cb)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  send_info_request (h,
+                     GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
+  h->info_cb.peers_cb = callback;
+  h->info_cls = callback_cls;
+  return GNUNET_OK;
+}
+
+
+/**
+ * Cancel a peer info request. The callback will not be called (anymore).
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Cadet handle.
+ * @return Closure given to GNUNET_CADET_get_peers().
+ */
+void *
+GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_Handle *h)
+{
+  void *cls = h->info_cls;
+
+  h->info_cb.peers_cb = NULL;
+  h->info_cls = NULL;
+  return cls;
+}
+
+
+/**
+ * Check that message received from CADET service is well-formed.
+ *
+ * @param cls the `struct GNUNET_CADET_Handle`
+ * @param message the message we got
+ * @return #GNUNET_OK if the message is well-formed,
+ *         #GNUNET_SYSERR otherwise
+ */
+static int
+check_get_peers (void *cls,
+                 const struct GNUNET_MessageHeader *message)
+{
+  size_t esize;
+
+  (void) cls;
+  esize = ntohs (message->size);
+  if (sizeof (struct GNUNET_CADET_LocalInfoPeer) == esize)
+    return GNUNET_OK;
+  if (sizeof (struct GNUNET_MessageHeader) == esize)
+    return GNUNET_OK;
+  return GNUNET_SYSERR;
+}
+
+
+/**
+ * Process a local reply about info on all tunnels, pass info to the user.
+ *
+ * @param cls Closure (Cadet handle).
+ * @param msg Message itself.
+ */
+static void
+handle_get_peers (void *cls,
+                  const struct GNUNET_MessageHeader *msg)
+{
+  struct GNUNET_CADET_Handle *h = cls;
+  const struct GNUNET_CADET_LocalInfoPeer *info =
+    (const struct GNUNET_CADET_LocalInfoPeer *) msg;
+
+  if (NULL == h->info_cb.peers_cb)
+    return;
+  if (sizeof (struct GNUNET_CADET_LocalInfoPeer) == ntohs (msg->size))
+    h->info_cb.peers_cb (h->info_cls,
+                         &info->destination,
+                         (int) ntohs (info->tunnel),
+                         (unsigned int) ntohs (info->paths),
+                         0);
+  else
+    h->info_cb.peers_cb (h->info_cls,
+                         NULL,
+                         0,
+                         0,
+                         0);
+}
+
+
+
+
+
diff --git a/src/cadet/cadet_api_list_tunnels.c 
b/src/cadet/cadet_api_list_tunnels.c
new file mode 100644
index 000000000..da5f85aa0
--- /dev/null
+++ b/src/cadet/cadet_api_list_tunnels.c
@@ -0,0 +1,187 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2011, 2017 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+*/
+/**
+ * @file cadet/cadet_api.c
+ * @brief cadet api: client implementation of cadet service
+ * @author Bartlomiej Polot
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_constants.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
+
+
+
+/**
+ * Ugly legacy hack.
+ */
+struct GNUNET_CADET_ListTunnels
+{
+
+  /**
+   * Monitor callback
+   */
+  GNUNET_CADET_TunnelsCB tunnels_cb;
+
+  /**
+   * Info callback closure for @c tunnels_cb.
+   */
+  void *tunnels_cb_cls;
+};
+
+
+/**
+ * Send message of @a type to CADET service of @a h
+ *
+ * @param h handle to CADET service
+ * @param type message type of trivial information request to send
+ */
+static void
+send_info_request (struct GNUNET_CADET_Handle *h,
+                   uint16_t type)
+{
+  struct GNUNET_MessageHeader *msg;
+  struct GNUNET_MQ_Envelope *env;
+
+  env = GNUNET_MQ_msg (msg,
+                       type);
+  GNUNET_MQ_send (h->mq,
+                  env);
+}
+
+
+/**
+ * Check that message received from CADET service is well-formed.
+ *
+ * @param cls the `struct GNUNET_CADET_Handle`
+ * @param message the message we got
+ * @return #GNUNET_OK if the message is well-formed,
+ *         #GNUNET_SYSERR otherwise
+ */
+static int
+check_get_tunnels (void *cls,
+                   const struct GNUNET_MessageHeader *message)
+{
+  size_t esize;
+
+  (void) cls;
+  esize = ntohs (message->size);
+  if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == esize)
+    return GNUNET_OK;
+  if (sizeof (struct GNUNET_MessageHeader) == esize)
+    return GNUNET_OK;
+  return GNUNET_SYSERR;
+}
+
+
+/**
+ * Process a local reply about info on all tunnels, pass info to the user.
+ *
+ * @param cls Closure (Cadet handle).
+ * @param message Message itself.
+ */
+static void
+handle_get_tunnels (void *cls,
+                    const struct GNUNET_MessageHeader *msg)
+{
+  struct GNUNET_CADET_Handle *h = cls;
+  const struct GNUNET_CADET_LocalInfoTunnel *info =
+    (const struct GNUNET_CADET_LocalInfoTunnel *) msg;
+
+  if (NULL == h->info_cb.tunnels_cb)
+    return;
+  if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == ntohs (msg->size))
+    h->info_cb.tunnels_cb (h->info_cls,
+                           &info->destination,
+                           ntohl (info->channels),
+                           ntohl (info->connections),
+                           ntohs (info->estate),
+                           ntohs (info->cstate));
+  else
+    h->info_cb.tunnels_cb (h->info_cls,
+                           NULL,
+                           0,
+                           0,
+                           0,
+                           0);
+}
+
+
+/**
+ * Request information about tunnels of the running cadet peer.
+ * The callback will be called for every tunnel of the service.
+ * Only one info request (of any kind) can be active at once.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ * @return #GNUNET_OK / #GNUNET_SYSERR
+ */
+int
+GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                          GNUNET_CADET_TunnelsCB callback,
+                          void *callback_cls)
+{
+
+      GNUNET_MQ_hd_var_size (get_tunnels,
+                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS,
+                           struct GNUNET_MessageHeader,
+                           h),
+    GNUNET_MQ_hd_var_size (get_tunnel,
+                           GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL,
+                           struct GNUNET_CADET_LocalInfoTunnel,
+                           h),
+    GNUNET_MQ_handler_end ()
+
+  if (NULL != h->info_cb.tunnels_cb)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  send_info_request (h,
+                     GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
+  h->info_cb.tunnels_cb = callback;
+  h->info_cls = callback_cls;
+  return GNUNET_OK;
+}
+
+
+/**
+ * Cancel a monitor request. The monitor callback will not be called.
+ *
+ * @param h Cadet handle.
+ * @return Closure given to GNUNET_CADET_list_tunnels().
+ */
+void *
+GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt)
+{
+  void *cls = h->info_cls;
+
+  h->info_cb.tunnels_cb = NULL;
+  h->info_cls = NULL;
+  return cls;
+}
+
+
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index ccc757d7e..b36113318 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -71,11 +71,6 @@ static char *listen_port;
  */
 static int echo;
 
-/**
- * Request a debug dump
- */
-static int dump;
-
 /**
  * Time of last echo request.
  */
@@ -101,6 +96,11 @@ static char *target_port = "default";
  */
 static struct GNUNET_CADET_Handle *mh;
 
+/**
+ * Our configuration.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *my_cfg;
+
 /**
  * Channel handle.
  */
@@ -395,20 +395,6 @@ send_echo (void *cls)
 }
 
 
-/**
- * Call CADET's monitor API, request debug dump on the service.
- *
- * @param cls Closure (unused).
- */
-static void
-request_dump (void *cls)
-{
-  job = NULL;
-  GNUNET_CADET_request_dump (mh);
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
 /**
  * Check data message sanity. Does nothing so far (all messages are OK).
  *
@@ -683,7 +669,11 @@ static void
 get_peers (void *cls)
 {
   job = NULL;
-  GNUNET_CADET_get_peers (mh, &peers_callback, NULL);
+#if FIXME5385
+  GNUNET_CADET_list_peers (my_cfg,
+                          &peers_callback,
+                          NULL);
+#endif
 }
 
 
@@ -709,7 +699,12 @@ show_peer (void *cls)
     GNUNET_SCHEDULER_shutdown();
     return;
   }
-  GNUNET_CADET_get_peer (mh, &pid, peer_callback, NULL);
+#if FIXME5385
+  GNUNET_CADET_get_peer (my_cfg,
+                        &pid,
+                        &peer_callback,
+                        NULL);
+#endif
 }
 
 
@@ -722,7 +717,11 @@ static void
 get_tunnels (void *cls)
 {
   job = NULL;
-  GNUNET_CADET_get_tunnels (mh, &tunnels_callback, NULL);
+#if FIXME5385
+  GNUNET_CADET_list_tunnels (my_cfg,
+                            &tunnels_callback,
+                            NULL);
+#endif
 }
 
 
@@ -748,10 +747,12 @@ show_tunnel (void *cls)
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  GNUNET_CADET_get_tunnel (mh,
+#if FIXME5385
+  GNUNET_CADET_get_tunnel (my_cfg,
                            &pid,
                            &tunnel_callback,
                            NULL);
+#endif
 }
 
 
@@ -804,7 +805,7 @@ run (void *cls,
   };
 
   /* FIXME add option to monitor apps */
-
+  my_cfg = cfg;
   target_id = args[0];
   if (target_id && args[1])
     target_port = args[1];
@@ -821,14 +822,7 @@ run (void *cls,
     return;
   }
 
-  if (GNUNET_YES == dump)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Requesting debug dump\n");
-    job = GNUNET_SCHEDULER_add_now (&request_dump,
-                                    NULL);
-  }
-  else if (NULL != peer_id)
+  if (NULL != peer_id)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Show peer\n");
@@ -971,48 +965,33 @@ main (int argc,
                                  "CONNECTION_ID",
                                  gettext_noop ("Provide information about a 
particular connection"),
                                  &conn_id),
-
     GNUNET_GETOPT_option_flag ('e',
-                                  "echo",
-                                  gettext_noop ("Activate echo mode"),
-                                  &echo), 
-
-    GNUNET_GETOPT_option_flag ('d',
-                                  "dump",
-                                  gettext_noop ("Dump debug information to 
STDERR"),
-                                  &dump),
-
+                              "echo",
+                              gettext_noop ("Activate echo mode"),
+                              &echo), 
     GNUNET_GETOPT_option_string ('o',
                                  "open-port",
                                  "SHARED_SECRET",
                                  gettext_noop ("Listen for connections using a 
shared secret among sender and recipient"),
                                  &listen_port),
-
-
     GNUNET_GETOPT_option_string ('p',
                                  "peer",
                                  "PEER_ID",
                                  gettext_noop ("Provide information about a 
patricular peer"),
                                  &peer_id),
-
-
     GNUNET_GETOPT_option_flag ('P',
-                                  "peers",
-                                  gettext_noop ("Provide information about all 
peers"),
-                                  &request_peers),
-
+                              "peers",
+                              gettext_noop ("Provide information about all 
peers"),
+                              &request_peers),
     GNUNET_GETOPT_option_string ('t',
                                  "tunnel",
                                  "TUNNEL_ID",
                                  gettext_noop ("Provide information about a 
particular tunnel"),
                                  &tunnel_id),
-
-
     GNUNET_GETOPT_option_flag ('T',
-                                  "tunnels",
-                                  gettext_noop ("Provide information about all 
tunnels"),
-                                  &request_tunnels),
-
+                              "tunnels",
+                              gettext_noop ("Provide information about all 
tunnels"),
+                              &request_tunnels),
     GNUNET_GETOPT_OPTION_END
   };
 
diff --git a/src/include/gnunet_cadet_service.h 
b/src/include/gnunet_cadet_service.h
index 00bef48f1..fb4499db0 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -310,17 +310,6 @@ void
 GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel);
 
 
-/******************************************************************************/
-/********************       MONITORING /DEBUG API     
*************************/
-/******************************************************************************/
-/* The following calls are not useful for normal CADET operation, but for      
*/
-/* debug and monitoring of the cadet state. They can be safely ignored.        
*/
-/* The API can change at any point without notice.                            
*/
-/* Please contact the developer if you consider any of this calls useful for  
*/
-/* normal cadet applications.                                                  
*/
-/******************************************************************************/
-
-
 /**
  * Transitional function to convert an unsigned int port to a hash value.
  * WARNING: local static value returned, NOT reentrant!
@@ -367,6 +356,17 @@ GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel 
*channel,
                                ...);
 
 
+/******************************************************************************/
+/********************       MONITORING /DEBUG API     
*************************/
+/******************************************************************************/
+/* The following calls are not useful for normal CADET operation, but for      
*/
+/* debug and monitoring of the cadet state. They can be safely ignored.        
*/
+/* The API can change at any point without notice.                            
*/
+/* Please contact the developer if you consider any of this calls useful for  
*/
+/* normal cadet applications.                                                  
*/
+/******************************************************************************/
+
+
 /**
  * Method called to retrieve information about a specific channel the cadet 
peer
  * is aware of, including all transit nodes.
@@ -388,6 +388,33 @@ typedef void
                            uint32_t /* ugh */ dest_channel_number,
                            uint32_t /* ugh */ public_channel_number);
 
+
+struct GNUNET_CADET_ChannelMonitor;
+
+
+/**
+ * Request information about a specific channel of the running cadet peer.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param peer ID of the other end of the channel.
+ * @param channel_number Channel number.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ */
+struct GNUNET_CADET_ChannelMonitor *
+GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                          struct GNUNET_PeerIdentity *peer,
+                          uint32_t /* UGH */ channel_number,
+                          GNUNET_CADET_ChannelCB callback,
+                          void *callback_cls);
+
+
+void *
+GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm);
+
+
 /**
  * Method called to retrieve information about all peers in CADET, called
  * once per peer.
@@ -408,6 +435,40 @@ typedef void
                          unsigned int n_paths,
                          unsigned int best_path);
 
+
+struct GNUNET_CADET_PeersLister;
+
+
+/**
+ * Request information about peers known to the running cadet service.
+ * The callback will be called for every peer known to the service.
+ * Only one info request (of any kind) can be active at once.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ *
+ * @return #GNUNET_OK / #GNUNET_SYSERR
+ */
+struct GNUNET_CADET_PeersLister *
+GNUNET_CADET_list_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                        GNUNET_CADET_PeersCB callback,
+                        void *callback_cls);
+
+
+/**
+ * Cancel a peer info request. The callback will not be called (anymore).
+ *
+ * @param h Cadet handle.
+ * @return Closure that was given to #GNUNET_CADET_list_peers().
+ */
+void *
+GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl);
+
+
+
 /**
  * Method called to retrieve information about a specific peer
  * known to the service.
@@ -432,6 +493,33 @@ typedef void
                         int finished_with_paths);
 
 
+struct GNUNET_CADET_GetPeer;
+
+/**
+ * Request information about a peer known to the running cadet peer.
+ * The callback will be called for the tunnel once.
+ * Only one info request (of any kind) can be active at once.
+ *
+ * WARNING: unstable API, likely to change in the future!
+ *
+ * @param h Handle to the cadet peer.
+ * @param id Peer whose tunnel to examine.
+ * @param callback Function to call with the requested data.
+ * @param callback_cls Closure for @c callback.
+ *
+ * @return #GNUNET_OK / #GNUNET_SYSERR
+ */
+struct GNUNET_CADET_GetPeer *
+GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                      const struct GNUNET_PeerIdentity *id,
+                      GNUNET_CADET_PeerCB callback,
+                      void *callback_cls);
+
+
+void *
+GNUNET_CADET_get_peer_cancel (struct GNUNET_CADET_GetPeer *gp);
+
+
 /**
  * Method called to retrieve information about all tunnels in CADET, called
  * once per tunnel.
@@ -454,66 +542,14 @@ typedef void
                            uint16_t cstate);
 
 
-/**
- * Method called to retrieve information about a specific tunnel the cadet peer
- * has established, o`r is trying to establish.
- *
- * @param cls Closure.
- * @param peer Peer towards whom the tunnel is directed.
- * @param n_channels Number of channels.
- * @param n_connections Number of connections.
- * @param channels Channels.
- * @param connections Connections.
- * @param estate Encryption state.
- * @param cstate Connectivity state.
- */
-typedef void
-(*GNUNET_CADET_TunnelCB) (void *cls,
-                          const struct GNUNET_PeerIdentity *peer,
-                          unsigned int n_channels,
-                          unsigned int n_connections,
-                          const struct GNUNET_CADET_ChannelTunnelNumber 
*channels,
-                          const struct GNUNET_CADET_ConnectionTunnelIdentifier 
*connections,
-                          unsigned int estate,
-                          unsigned int cstate);
+struct GNUNET_CADET_ListTunnels;
 
 
 /**
- * Request information about a specific channel of the running cadet peer.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param peer ID of the other end of the channel.
- * @param channel_number Channel number.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- */
-void
-GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
-                          struct GNUNET_PeerIdentity *peer,
-                          uint32_t /* UGH */ channel_number,
-                          GNUNET_CADET_ChannelCB callback,
-                          void *callback_cls);
-
-
-/**
- * Request a debug dump on the service's STDERR.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h cadet handle
- */
-void
-GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h);
-
-
-/**
- * Request information about peers known to the running cadet service.
- * The callback will be called for every peer known to the service.
+ * Request information about tunnels of the running cadet peer.
+ * The callback will be called for every tunnel of the service.
  * Only one info request (of any kind) can be active at once.
  *
- *
  * WARNING: unstable API, likely to change in the future!
  *
  * @param h Handle to the cadet peer.
@@ -522,74 +558,49 @@ GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h);
  *
  * @return #GNUNET_OK / #GNUNET_SYSERR
  */
-int
-GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
-                        GNUNET_CADET_PeersCB callback,
-                        void *callback_cls);
+struct GNUNET_CADET_ListTunnels *
+GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                          GNUNET_CADET_TunnelsCB callback,
+                          void *callback_cls);
 
 
 /**
- * Cancel a peer info request. The callback will not be called (anymore).
- *
- * WARNING: unstable API, likely to change in the future!
+ * Cancel a monitor request. The monitor callback will not be called.
  *
  * @param h Cadet handle.
  *
- * @return Closure that was given to #GNUNET_CADET_get_peers().
+ * @return Closure given to #GNUNET_CADET_list_tunnels(), if any.
  */
 void *
-GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h);
+GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt);
 
 
-/**
- * Request information about a peer known to the running cadet peer.
- * The callback will be called for the tunnel once.
- * Only one info request (of any kind) can be active at once.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param id Peer whose tunnel to examine.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- *
- * @return #GNUNET_OK / #GNUNET_SYSERR
- */
-int
-GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
-                      const struct GNUNET_PeerIdentity *id,
-                      GNUNET_CADET_PeerCB callback,
-                      void *callback_cls);
-
 
 /**
- * Request information about tunnels of the running cadet peer.
- * The callback will be called for every tunnel of the service.
- * Only one info request (of any kind) can be active at once.
- *
- * WARNING: unstable API, likely to change in the future!
- *
- * @param h Handle to the cadet peer.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
+ * Method called to retrieve information about a specific tunnel the cadet peer
+ * has established, o`r is trying to establish.
  *
- * @return #GNUNET_OK / #GNUNET_SYSERR
+ * @param cls Closure.
+ * @param peer Peer towards whom the tunnel is directed.
+ * @param n_channels Number of channels.
+ * @param n_connections Number of connections.
+ * @param channels Channels.
+ * @param connections Connections.
+ * @param estate Encryption state.
+ * @param cstate Connectivity state.
  */
-int
-GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h,
-                          GNUNET_CADET_TunnelsCB callback,
-                          void *callback_cls);
+typedef void
+(*GNUNET_CADET_TunnelCB) (void *cls,
+                          const struct GNUNET_PeerIdentity *peer,
+                          unsigned int n_channels,
+                          unsigned int n_connections,
+                          const struct GNUNET_CADET_ChannelTunnelNumber 
*channels,
+                          const struct GNUNET_CADET_ConnectionTunnelIdentifier 
*connections,
+                          unsigned int estate,
+                          unsigned int cstate);
 
 
-/**
- * Cancel a monitor request. The monitor callback will not be called.
- *
- * @param h Cadet handle.
- *
- * @return Closure given to #GNUNET_CADET_get_tunnels(), if any.
- */
-void *
-GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
+struct GNUNET_CADET_GetTunnel;
 
 
 /**
@@ -606,13 +617,16 @@ GNUNET_CADET_get_tunnels_cancel (struct 
GNUNET_CADET_Handle *h);
  *
  * @return #GNUNET_OK / #GNUNET_SYSERR
  */
-int
-GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h,
+struct GNUNET_CADET_GetTunnel *
+GNUNET_CADET_get_tunnel (const struct GNUNET_CONFIGURATION_Handle *cfg,
                          const struct GNUNET_PeerIdentity *id,
                          GNUNET_CADET_TunnelCB callback,
                          void *callback_cls);
 
 
+void *
+GNUNET_CADET_get_tunnel_cancel (struct GNUNET_CADET_GetTunnel *gt);
+
 
 #if 0                           /* keep Emacsens' auto-indent happy */
 {

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]