gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r32085 - in gnunet/src: include mesh


From: gnunet
Subject: [GNUnet-SVN] r32085 - in gnunet/src: include mesh
Date: Thu, 30 Jan 2014 03:11:17 +0100

Author: bartpolot
Date: 2014-01-30 03:11:17 +0100 (Thu, 30 Jan 2014)
New Revision: 32085

Modified:
   gnunet/src/include/gnunet_mesh_service.h
   gnunet/src/mesh/gnunet-mesh.c
   gnunet/src/mesh/mesh_api.c
Log:
- change tunnel API to pass connection and channel payload

Modified: gnunet/src/include/gnunet_mesh_service.h
===================================================================
--- gnunet/src/include/gnunet_mesh_service.h    2014-01-30 02:11:15 UTC (rev 
32084)
+++ gnunet/src/include/gnunet_mesh_service.h    2014-01-30 02:11:17 UTC (rev 
32085)
@@ -436,15 +436,19 @@
  *
  * @param cls Closure.
  * @param peer Peer towards whom the tunnel is directed.
- * @param channels Number of channels.
- * @param connections Number of connections.
+ * @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_MESH_TunnelCB) (void *cls,
                                       const struct GNUNET_PeerIdentity *peer,
-                                      unsigned int channels,
-                                      unsigned int connections,
+                                      unsigned int n_channels,
+                                      unsigned int n_connections,
+                                      uint32_t *channels,
+                                      struct GNUNET_HashCode *connections,
                                       unsigned int estate,
                                       unsigned int cstate);
 

Modified: gnunet/src/mesh/gnunet-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-mesh.c       2014-01-30 02:11:15 UTC (rev 32084)
+++ gnunet/src/mesh/gnunet-mesh.c       2014-01-30 02:11:17 UTC (rev 32085)
@@ -496,24 +496,28 @@
  *
  * @param cls Closure.
  * @param peer Peer towards whom the tunnel is directed.
- * @param channels Number of channels.
- * @param connections Number of connections.
+ * @param n_channels Number of channels.
+ * @param n_connections Number of connections.
+ * @param channels Channels.
+ * @param connections Connections.
  * @param estate Encryption status.
  * @param cstate Connectivity status.
  */
 void
 tunnel_callback (void *cls,
                  const struct GNUNET_PeerIdentity *peer,
-                 unsigned int channels,
-                 unsigned int connections,
+                 unsigned int n_channels,
+                 unsigned int n_connections,
+                 uint32_t *channels,
+                 struct GNUNET_HashCode *connections,
                  unsigned int estate,
                  unsigned int cstate)
 {
   if (NULL != peer)
   {
     FPRINTF (stdout, "Tunnel %s\n", GNUNET_i2s_full (peer));
-    FPRINTF (stdout, "- %u channels\n", channels);
-    FPRINTF (stdout, "- %u connections\n", connections);
+    FPRINTF (stdout, "- %u channels\n", n_channels);
+    FPRINTF (stdout, "- %u connections\n", n_connections);
     FPRINTF (stdout, "- enc state: %u\n", estate);
     FPRINTF (stdout, "- con state: %u\n", cstate);
   }

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2014-01-30 02:11:15 UTC (rev 32084)
+++ gnunet/src/mesh/mesh_api.c  2014-01-30 02:11:17 UTC (rev 32085)
@@ -1091,6 +1091,8 @@
   size_t msize;
   unsigned int ch_n;
   unsigned int c_n;
+  struct GNUNET_HashCode *conns;
+  MESH_ChannelNumber *chns;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n");
   if (NULL == h->tunnel_cb)
@@ -1106,7 +1108,7 @@
   if (esize > msize)
   {
     GNUNET_break_op (0);
-    h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, 0, 0);
+    h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, NULL, NULL, 0, 0);
     goto clean_cls;
   }
   ch_n = ntohl (msg->channels);
@@ -1121,13 +1123,15 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n",
                 sizeof (struct GNUNET_MESH_LocalInfoTunnel),
                 sizeof (MESH_ChannelNumber), sizeof (struct GNUNET_HashCode));
-    h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, 0, 0);
+    h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, NULL, NULL, 0, 0);
     goto clean_cls;
   }
 
   /* Call Callback with tunnel info. */
+  conns = (struct GNUNET_HashCode *) &msg[1];
+  chns = (MESH_ChannelNumber *) &conns[c_n];
   h->tunnel_cb (h->tunnel_cls, &msg->destination,
-                ch_n, c_n,
+                ch_n, c_n, chns, conns,
                 ntohs (msg->estate), ntohs (msg->cstate));
 
 clean_cls:




reply via email to

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