From 3da7f3e5bd419f14b4a37feb39bb61337e4b1f0c Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 6 Mar 2014 01:36:24 +0000 Subject: [PATCH] - remove unneccessary reserved fields --- src/mesh/gnunet-service-mesh_connection.c | 2 - src/mesh/gnunet-service-mesh_peer.c | 3 -- src/mesh/mesh_protocol.h | 50 +++++++++-------------- 3 files changed, 20 insertions(+), 35 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 1110055b0..290d950ac 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c @@ -2818,13 +2818,11 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: dmsg = (struct GNUNET_MESH_ConnectionDestroy *) data; dmsg->cid = c->id; - dmsg->reserved = 0; break; case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: bmsg = (struct GNUNET_MESH_ConnectionBroken *) data; bmsg->cid = c->id; - bmsg->reserved = 0; break; case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index c11cec5e5..44a9f7ed5 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c @@ -500,9 +500,6 @@ send_core_connection_ack (struct MeshConnection *c, size_t size, void *buf) msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionACK)); msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK); msg->cid = *GMC_get_id (c); - msg->reserved = 0; - - /* TODO add signature */ LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n"); return sizeof (struct GNUNET_MESH_ConnectionACK); diff --git a/src/mesh/mesh_protocol.h b/src/mesh/mesh_protocol.h index ced3b36b1..5476c016d 100644 --- a/src/mesh/mesh_protocol.h +++ b/src/mesh/mesh_protocol.h @@ -82,17 +82,11 @@ struct GNUNET_MESH_ConnectionACK */ struct GNUNET_MessageHeader header; - /** - * Always 0. - */ - uint32_t reserved GNUNET_PACKED; - /** * ID of the connection. */ struct GNUNET_HashCode cid; - /* TODO: signature */ }; @@ -106,11 +100,6 @@ struct GNUNET_MESH_KX */ struct GNUNET_MessageHeader header; - /** - * Always 0. - */ - uint32_t reserved GNUNET_PACKED; - /** * ID of the connection. */ @@ -235,11 +224,6 @@ struct GNUNET_MESH_Encrypted */ struct GNUNET_MessageHeader header; - /** - * Initialization Vector for payload encryption. - */ - uint32_t iv GNUNET_PACKED; - /** * ID of the connection. */ @@ -255,11 +239,26 @@ struct GNUNET_MESH_Encrypted */ uint32_t ttl GNUNET_PACKED; + /** + * Initialization Vector for payload encryption. + */ + uint32_t iv GNUNET_PACKED; + + /** + * MAC of the encrypted message, used to verify message integrity. + * Everything after this value will be encrypted and authenticated. + */ + struct GNUNET_HashCode hmac; + /** * Encrypted content follows. */ }; + +/** + * Message to create a Channel. + */ struct GNUNET_MESH_ChannelCreate { /** @@ -283,6 +282,10 @@ struct GNUNET_MESH_ChannelCreate uint32_t opt GNUNET_PACKED; }; + +/** + * Message to manage a Channel (ACK, NACK, Destroy). + */ struct GNUNET_MESH_ChannelManage { /** @@ -296,6 +299,7 @@ struct GNUNET_MESH_ChannelManage MESH_ChannelNumber chid GNUNET_PACKED; }; + /** * Message for mesh data traffic. */ @@ -407,11 +411,6 @@ struct GNUNET_MESH_ConnectionBroken */ struct GNUNET_MessageHeader header; - /** - * Always 0. - */ - uint32_t reserved GNUNET_PACKED; - /** * ID of the connection. */ @@ -426,8 +425,6 @@ struct GNUNET_MESH_ConnectionBroken * ID of the endpoint */ struct GNUNET_PeerIdentity peer2; - - /* TODO: signature */ }; @@ -441,17 +438,10 @@ struct GNUNET_MESH_ConnectionDestroy */ struct GNUNET_MessageHeader header; - /** - * Always 0. - */ - uint32_t reserved GNUNET_PACKED; - /** * ID of the connection. */ struct GNUNET_HashCode cid; - - /* TODO: signature */ }; -- 2.25.1