gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29990 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r29990 - gnunet/src/mesh
Date: Tue, 8 Oct 2013 15:54:26 +0200

Author: bartpolot
Date: 2013-10-08 15:54:26 +0200 (Tue, 08 Oct 2013)
New Revision: 29990

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
   gnunet/src/mesh/gnunet-service-mesh_channel.h
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_connection.h
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- use public channel handlers


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-08 13:41:31 UTC 
(rev 29989)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-08 13:54:26 UTC 
(rev 29990)
@@ -24,6 +24,7 @@
 #include "mesh_protocol_enc.h"
 #include "gnunet-service-mesh_channel.h"
 #include "gnunet-service-mesh_local.h"
+#include "gnunet-service-mesh_tunnel.h"
 
 #define LOG(level, ...) GNUNET_log_from(level,"mesh-chn",__VA_ARGS__)
 
@@ -1171,12 +1172,28 @@
   msg->header.type = htons (type);
   msg->header.size = htons (sizeof (struct GNUNET_MESH_Encrypted) + size);
   msg->iv = GNUNET_htonll (iv);
-  tunnel_encrypt (ch->t, &msg[1], message, size, iv, fwd);
-  send_prebuilt_message_tunnel (msg, ch->t, ch, fwd);
+  GMT_encrypt (ch->t, &msg[1], message, size, iv, fwd);
+  GMT_send_prebuilt_message (msg, ch->t, ch, fwd);
 }
 
 
+/**
+ * Count channels in a DLL.
+ * 
+ * @param head Head of the DLL.
+ */
+unsigned int
+GMCH_count (const struct MeshChannel *head)
+{
+  unsigned int count;
+  struct MeshChannel *iter;
+  
+  for (count = 0, iter = head; NULL != iter; iter = iter->next, count++);
+  
+  return count;
+}
 
+
 /**
  * Notify the destination client that a new incoming channel was created.
  *
@@ -1383,7 +1400,7 @@
     return;
   }
 
-  tunnel_change_state (t, MESH_TUNNEL_READY);
+  GMT_change_state (t, MESH_TUNNEL_READY);
 
   GNUNET_STATISTICS_update (stats, "# data received", 1, GNUNET_NO);
 

Modified: gnunet/src/mesh/gnunet-service-mesh_channel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.h       2013-10-08 13:41:31 UTC 
(rev 29989)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.h       2013-10-08 13:54:26 UTC 
(rev 29990)
@@ -46,6 +46,14 @@
 struct MeshChannel;
 
 /**
+ * Count channels in a DLL.
+ * 
+ * @param head Head of the DLL.
+ */
+unsigned int
+GMCH_count (const struct MeshChannel *head);
+
+/**
  * Send an end-to-end ACK message for the most recent in-sequence payload.
  *
  * If channel is not reliable, do nothing.

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-08 13:41:31 UTC 
(rev 29989)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-08 13:54:26 UTC 
(rev 29990)
@@ -1980,6 +1980,8 @@
 
 /**
  * Count connections in a DLL.
+ * 
+ * @param head Head of the DLL.
  */
 unsigned int
 GMC_count (const struct MeshConnection *head)

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-10-08 13:41:31 UTC 
(rev 29989)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-10-08 13:54:26 UTC 
(rev 29990)
@@ -39,8 +39,10 @@
 
 #include "gnunet_util_lib.h"
 
+#include "mesh_path.h"
 #include "gnunet-service-mesh_channel.h"
 
+
 /**
  * Struct containing all information regarding a connection to a peer.
  */

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-08 13:41:31 UTC 
(rev 29989)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-08 13:54:26 UTC 
(rev 29990)
@@ -550,7 +550,7 @@
 void
 GMT_destroy_if_empty (struct MeshTunnel2 *t)
 {
-  if (1 <= GMCH_count (t->channel_head))
+  if (1 < GMCH_count (t->channel_head))
     return;
 
   GMT_destroy_empty (t);
@@ -613,35 +613,36 @@
   {
     case GNUNET_MESSAGE_TYPE_MESH_DATA:
       /* Don't send hop ACK, wait for client to ACK */
-      handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
+      GMCH_handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
       break;
 
     case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
-      handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd);
+      GMCH_handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd);
       break;
 
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
-      handle_channel_create (t,
-                             (struct GNUNET_MESH_ChannelCreate *) msgh,
-                             fwd);
+      GMCH_handle_create (t,
+                          (struct GNUNET_MESH_ChannelCreate *) msgh,
+                          fwd);
       break;
 
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
-      handle_channel_ack (t,
-                          (struct GNUNET_MESH_ChannelManage *) msgh,
-                          fwd);
+      GMCH_handle_ack (t,
+                       (struct GNUNET_MESH_ChannelManage *) msgh,
+                       fwd);
       break;
 
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
-      handle_channel_destroy (t,
-                              (struct GNUNET_MESH_ChannelManage *) msgh,
-                              fwd);
+      GMCH_handle_destroy (t,
+                           (struct GNUNET_MESH_ChannelManage *) msgh,
+                           fwd);
       break;
 
     default:
+      GNUNET_break_op (0);
       LOG (GNUNET_ERROR_TYPE_DEBUG,
-                  "end-to-end message not known (%u)\n",
-                  ntohs (msgh->type));
+           "end-to-end message not known (%u)\n",
+           ntohs (msgh->type));
   }
 }
 




reply via email to

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