[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28440 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28440 - gnunet/src/mesh |
Date: |
Wed, 7 Aug 2013 16:42:35 +0200 |
Author: bartpolot
Date: 2013-08-07 16:42:35 +0200 (Wed, 07 Aug 2013)
New Revision: 28440
Modified:
gnunet/src/mesh/gnunet-service-mesh-enc.c
Log:
- demultiplex encrypted payload
Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c 2013-08-07 14:36:50 UTC (rev
28439)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c 2013-08-07 14:42:35 UTC (rev
28440)
@@ -4269,40 +4269,7 @@
return GNUNET_OK;
}
-
/**
- * Handler for mesh network traffic going from the origin to a peer
- *
- * @param t Tunnel on which we got this message.
- * @param message Data message.
- *
- * @return GNUNET_OK to keep the connection open,
- * GNUNET_SYSERR to close it (signal serious error)
- */
-static int
-handle_unicast (struct MeshTunnel2 *t, const struct GNUNET_MESH_Data *message)
-{
- return handle_data (t, message, GNUNET_YES);
-}
-
-
-/**
- * Handler for mesh network traffic towards the owner of a tunnel.
- *
- * @param t Tunnel on which we got this message.
- * @param message Data message.
- *
- * @return GNUNET_OK to keep the connection open,
- * GNUNET_SYSERR to close it (signal serious error)
- */
-static int
-handle_to_orig (struct MeshTunnel2 *t, const struct GNUNET_MESH_Data *message)
-{
- return handle_data (t, message, GNUNET_NO);
-}
-
-
-/**
* Handler for mesh network traffic end-to-end ACKs.
*
* @param t Tunnel on which we got this message.
@@ -4337,11 +4304,11 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! %s ACK %u\n",
(GNUNET_YES == fwd) ? "FWD" : "BCK", ack);
- if (GNUNET_YES == fwd && GNUNET_MESSAGE_TYPE_MESH_UNICAST_ACK == type)
+ if (GNUNET_YES == fwd)
{
rel = ch->fwd_rel;
}
- else if (GNUNET_NO == fwd && GNUNET_MESSAGE_TYPE_MESH_TO_ORIG_ACK == type)
+ else
{
rel = ch->bck_rel;
}
@@ -4768,7 +4735,7 @@
{
size_t dsize = size - sizeof (struct GNUNET_MESH_Encrypted);
char cbuf[dsize];
- struct GNUNET_MESH_Data *dmsg;
+ struct GNUNET_MessageHeader *msgh;
/* TODO signature verification */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " it's for us!\n");
@@ -4776,8 +4743,40 @@
fc->last_pid_recv = pid;
tunnel_decrypt (t, cbuf, &msg[1], dsize, msg->iv, fwd);
- dmsg = (struct GNUNET_MESH_Data *) cbuf;
- handle_data (t, dmsg, fwd);
+ msgh = (struct GNUNET_MessageHeader *) cbuf;
+ switch (htons(msgh->type))
+ {
+ case GNUNET_MESSAGE_TYPE_MESH_UNICAST_ACK:
+ if (GNUNET_YES == fwd)
+ return handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh,
+ GNUNET_YES);
+ GNUNET_break_op (0);
+ break;
+ case GNUNET_MESSAGE_TYPE_MESH_TO_ORIG_ACK:
+ if (GNUNET_NO == fwd)
+ return handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh,
+ GNUNET_YES);
+ GNUNET_break_op (0);
+ break;
+ case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
+ if (GNUNET_YES == fwd)
+ handle_data (t, (struct GNUNET_MESH_Data *) msgh, GNUNET_YES);
+ GNUNET_break_op (0);
+ break;
+ case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
+ if (GNUNET_NO == fwd)
+ handle_data (t, (struct GNUNET_MESH_Data *) msgh, GNUNET_NO);
+ GNUNET_break_op (0);
+ break;
+ case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
+ handle_channel (t, NULL, fwd);
+ break;
+ default:
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "end-to-end message not known\n");
+ }
+
connection_send_ack (c, fwd);
return GNUNET_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28440 - gnunet/src/mesh,
gnunet <=