- add separate encryption enabled mesh to avoid breakage during developement
[oweals/gnunet.git] / src / mesh / gnunet-mesh.c
index 21a3f7d601847ef41c5394ca22565b487cf3c261..77bb7317f906f0ad2baedbf9292eee6a1e1606a4 100644 (file)
  * @author Bartlomiej Polot
  */
 #include "platform.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_getopt_lib.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_mesh_service.h"
-#include "gnunet_program_lib.h"
 
 
 /**
@@ -73,25 +71,19 @@ shutdown_task (void *cls,
  * Method called to retrieve information about each tunnel the mesh peer
  * is aware of.
  *
- * @param cls Closure (unused).
- * @param initiator Peer that started the tunnel (owner).
+ * @param cls Closure.
  * @param tunnel_number Tunnel number.
- * @param peers Array of peer identities that participate in the tunnel.
- * @param npeers Number of peers in peers.
+ * @param origin that started the tunnel (owner).
+ * @param target other endpoint of the tunnel
  */
 static void
 tunnels_callback (void *cls,
-                 const struct GNUNET_PeerIdentity *initiator,
-                 unsigned int tunnel_number,
-                 const struct GNUNET_PeerIdentity *peers,
-                 unsigned int npeers)
+                  uint32_t tunnel_number,
+                  const struct GNUNET_PeerIdentity *origin,
+                  const struct GNUNET_PeerIdentity *target)
 {
-  unsigned int i;
-
-  fprintf (stdout, "Tunnel %s [%u]: %u peers\n",
-           GNUNET_i2s_full (initiator), tunnel_number, npeers);
-  for (i = 0; i < npeers; i++)
-    fprintf (stdout, " * %s\n", GNUNET_i2s_full (&peers[i]));
+  fprintf (stdout, "Tunnel %s [%u]\n",
+           GNUNET_i2s_full (origin), tunnel_number);
   fprintf (stdout, "\n");
 }
 
@@ -103,7 +95,7 @@ tunnels_callback (void *cls,
  * @param cls Closure.
  * @param peer Peer in the tunnel's tree.
  * @param parent Parent of the current peer. All 0 when peer is root.
- * 
+ *
  */
 static void
 tunnel_callback (void *cls,
@@ -133,6 +125,7 @@ get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   }
 }
 
+
 /**
  * Call MESH's monitor API, get info of one tunnel.
  *
@@ -145,8 +138,13 @@ show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct GNUNET_PeerIdentity pid;
 
   if (GNUNET_OK !=
-      GNUNET_CRYPTO_hash_from_string (tunnel_id, &pid.hashPubKey))
+      GNUNET_CRYPTO_eddsa_public_key_from_string (tunnel_id,
+                                                    strlen (tunnel_id),
+                                                    &pid.public_key))
   {
+    fprintf (stderr,
+            _("Invalid tunnel owner `%s'\n"),
+            tunnel_id);
     GNUNET_SCHEDULER_shutdown();
     return;
   }
@@ -169,7 +167,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   static const struct GNUNET_MESH_MessageHandler handlers[] = {
     {NULL, 0, 0} /* FIXME add option to monitor msg types */
   };
-  GNUNET_MESH_ApplicationType apps = 0; /* FIXME add option to monitor apps */
+  /* FIXME add option to monitor apps */
 
   if (args[0] != NULL)
   {
@@ -178,10 +176,10 @@ run (void *cls, char *const *args, const char *cfgfile,
   }
   mh = GNUNET_MESH_connect (cfg,
                             NULL, /* cls */
-                            NULL, /* nt */
+                            NULL, /* new tunnel */
                             NULL, /* cleaner */
                             handlers,
-                            &apps);
+                            NULL);
   if (NULL == mh)
     GNUNET_SCHEDULER_add_now (shutdown_task, NULL);
   else