gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34499 - gnunet/src/scalarproduct


From: gnunet
Subject: [GNUnet-SVN] r34499 - gnunet/src/scalarproduct
Date: Sun, 7 Dec 2014 22:53:44 +0100

Author: grothoff
Date: 2014-12-07 22:53:44 +0100 (Sun, 07 Dec 2014)
New Revision: 34499

Modified:
   gnunet/src/scalarproduct/gnunet-service-scalarproduct.h
   gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
   gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c
   gnunet/src/scalarproduct/scalarproduct.h
   gnunet/src/scalarproduct/scalarproduct_api.c
Log:
-sending session ID back over same CADET channel is redundant

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct.h
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct.h     2014-12-07 
21:50:13 UTC (rev 34498)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct.h     2014-12-07 
21:53:44 UTC (rev 34499)
@@ -89,10 +89,10 @@
  * Message type passed from responding service Bob to responding
  * service Alice to complete a request and allow Alice to compute the
  * result.  If Bob's reply does not fit into this one message, the
- * conversation may be continued with `struct MultipartMessage`
+ * conversation may be continued with `struct BobCryptodataMultipartMessage`
  * messages afterwards.
  */
-struct ServiceResponseMessage
+struct BobCryptodataMessage
 {
   /**
    * GNUNET message header with type
@@ -116,12 +116,6 @@
   uint32_t contained_element_count GNUNET_PACKED;
 
   /**
-   * The transaction/session key used to identify a session.
-   * FIXME: needed? CADET should already identify sessions!
-   */
-  struct GNUNET_HashCode key;
-
-  /**
    * followed by s | s' | k[i][perm]
    */
 };
@@ -130,11 +124,11 @@
 /**
  * Multipart Message type passed between to supply additional elements
  * for the peer.  Send from Bob to Alice with additional elements
- * of k[i][perm] after his `struct ServiceResponseMessage *`.
+ * of k[i][perm] after his `struct BobCryptodataMessage *`.
  * Once all k-values have been transmitted, Bob is finished and
  * Alice can transmit the final result to the client.
  */
-struct MultipartMessage
+struct BobCryptodataMultipartMessage
 {
   /**
    * GNUNET message header

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c       
2014-12-07 21:50:13 UTC (rev 34498)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c       
2014-12-07 21:53:44 UTC (rev 34499)
@@ -640,7 +640,7 @@
                                   const struct GNUNET_MessageHeader *message)
 {
   struct AliceServiceSession *s = *channel_ctx;
-  const struct MultipartMessage *msg;
+  const struct BobCryptodataMultipartMessage *msg;
   const struct GNUNET_CRYPTO_PaillierCiphertext *payload;
   size_t i;
   uint32_t contained;
@@ -653,14 +653,14 @@
     return GNUNET_SYSERR;
   }
   msg_size = ntohs (message->size);
-  if (sizeof (struct MultipartMessage) > msg_size)
+  if (sizeof (struct BobCryptodataMultipartMessage) > msg_size)
   {
     GNUNET_break_op (0);
     return GNUNET_SYSERR;
   }
-  msg = (const struct MultipartMessage *) message;
+  msg = (const struct BobCryptodataMultipartMessage *) message;
   contained = ntohl (msg->contained_element_count);
-  required_size = sizeof (struct MultipartMessage)
+  required_size = sizeof (struct BobCryptodataMultipartMessage)
     + 2 * contained * sizeof (struct GNUNET_CRYPTO_PaillierCiphertext);
   if ( (required_size != msg_size) ||
        (s->transferred_element_count + contained > s->used_element_count) )
@@ -712,7 +712,7 @@
                                 const struct GNUNET_MessageHeader *message)
 {
   struct AliceServiceSession *s = *channel_ctx;
-  const struct ServiceResponseMessage *msg;
+  const struct BobCryptodataMessage *msg;
   const struct GNUNET_CRYPTO_PaillierCiphertext *payload;
   uint32_t i;
   uint32_t contained;
@@ -725,12 +725,12 @@
     return GNUNET_SYSERR;
   }
   msg_size = ntohs (message->size);
-  if (sizeof (struct ServiceResponseMessage) > msg_size)
+  if (sizeof (struct BobCryptodataMessage) > msg_size)
   {
     GNUNET_break_op (0);
     return GNUNET_SYSERR;
   }
-  msg = (const struct ServiceResponseMessage *) message;
+  msg = (const struct BobCryptodataMessage *) message;
   GNUNET_break_op (0 == ntohl (msg->reserved));
   if (s->used_element_count != ntohl (msg->intersection_element_count))
   {
@@ -739,7 +739,7 @@
     return GNUNET_SYSERR;
   }
   contained = ntohl (msg->contained_element_count);
-  required_size = sizeof (struct ServiceResponseMessage)
+  required_size = sizeof (struct BobCryptodataMessage)
     + 2 * contained * sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)
     + 2 * sizeof (struct GNUNET_CRYPTO_PaillierCiphertext);
   if ( (msg_size != required_size) ||
@@ -1099,7 +1099,7 @@
                                            struct GNUNET_SERVER_Client *client,
                                            const struct GNUNET_MessageHeader 
*message)
 {
-  const struct ComputationMultipartMessage * msg;
+  const struct ComputationBobCryptodataMultipartMessage * msg;
   struct AliceServiceSession *s;
   uint32_t contained_count;
   const struct GNUNET_SCALARPRODUCT_Element *elements;
@@ -1119,17 +1119,17 @@
     return;
   }
   msize = ntohs (message->size);
-  if (msize < sizeof (struct ComputationMultipartMessage))
+  if (msize < sizeof (struct ComputationBobCryptodataMultipartMessage))
   {
     GNUNET_break (0);
     GNUNET_SERVER_receive_done (client,
                                 GNUNET_SYSERR);
     return;
   }
-  msg = (const struct ComputationMultipartMessage *) message;
+  msg = (const struct ComputationBobCryptodataMultipartMessage *) message;
   contained_count = ntohl (msg->element_count_contained);
 
-  if ( (msize != (sizeof (struct ComputationMultipartMessage) +
+  if ( (msize != (sizeof (struct ComputationBobCryptodataMultipartMessage) +
                   contained_count * sizeof (struct 
GNUNET_SCALARPRODUCT_Element))) ||
        (0 == contained_count) ||
        (s->total == s->transferred_element_count) ||

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c 2014-12-07 
21:50:13 UTC (rev 34498)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c 2014-12-07 
21:53:44 UTC (rev 34499)
@@ -513,7 +513,7 @@
 /**
  * Maximum count of elements we can put into a multipart message
  */
-#define ELEMENT_CAPACITY ((GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct 
MultipartMessage)) / sizeof (struct GNUNET_CRYPTO_PaillierCiphertext))
+#define ELEMENT_CAPACITY ((GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct 
BobCryptodataMultipartMessage)) / sizeof (struct 
GNUNET_CRYPTO_PaillierCiphertext))
 
 
 /**
@@ -526,7 +526,7 @@
 transmit_bobs_cryptodata_message_multipart (struct BobServiceSession *s)
 {
   struct GNUNET_CRYPTO_PaillierCiphertext *payload;
-  struct MultipartMessage *msg;
+  struct BobCryptodataMultipartMessage *msg;
   struct GNUNET_MQ_Envelope *e;
   unsigned int i;
   unsigned int j;
@@ -581,12 +581,12 @@
 static void
 transmit_bobs_cryptodata_message (struct BobServiceSession *s)
 {
-  struct ServiceResponseMessage *msg;
+  struct BobCryptodataMessage *msg;
   struct GNUNET_MQ_Envelope *e;
   struct GNUNET_CRYPTO_PaillierCiphertext *payload;
   unsigned int i;
 
-  s->cadet_transmitted_element_count = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - 
sizeof (struct ServiceResponseMessage)) /
+  s->cadet_transmitted_element_count = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - 
sizeof (struct BobCryptodataMessage)) /
     (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * 2) - 2;
   if (s->cadet_transmitted_element_count > s->used_element_count)
     s->cadet_transmitted_element_count = s->used_element_count;
@@ -598,7 +598,6 @@
   msg->reserved = htonl (0);
   msg->intersection_element_count = htonl (s->used_element_count);
   msg->contained_element_count = htonl (s->cadet_transmitted_element_count);
-  msg->key = s->session_id;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Sending %u/%u crypto values to Alice\n",
@@ -1148,7 +1147,7 @@
                                          struct GNUNET_SERVER_Client *client,
                                          const struct GNUNET_MessageHeader 
*message)
 {
-  const struct ComputationMultipartMessage * msg;
+  const struct ComputationBobCryptodataMultipartMessage * msg;
   struct BobServiceSession *s;
   uint32_t contained_count;
   const struct GNUNET_SCALARPRODUCT_Element *elements;
@@ -1168,17 +1167,17 @@
     return;
   }
   msize = ntohs (message->size);
-  if (msize < sizeof (struct ComputationMultipartMessage))
+  if (msize < sizeof (struct ComputationBobCryptodataMultipartMessage))
   {
     GNUNET_break (0);
     GNUNET_SERVER_receive_done (client,
                                 GNUNET_SYSERR);
     return;
   }
-  msg = (const struct ComputationMultipartMessage *) message;
+  msg = (const struct ComputationBobCryptodataMultipartMessage *) message;
   contained_count = ntohl (msg->element_count_contained);
 
-  if ( (msize != (sizeof (struct ComputationMultipartMessage) +
+  if ( (msize != (sizeof (struct ComputationBobCryptodataMultipartMessage) +
                   contained_count * sizeof (struct 
GNUNET_SCALARPRODUCT_Element))) ||
        (0 == contained_count) ||
        (UINT16_MAX < contained_count) ||

Modified: gnunet/src/scalarproduct/scalarproduct.h
===================================================================
--- gnunet/src/scalarproduct/scalarproduct.h    2014-12-07 21:50:13 UTC (rev 
34498)
+++ gnunet/src/scalarproduct/scalarproduct.h    2014-12-07 21:53:44 UTC (rev 
34499)
@@ -119,7 +119,7 @@
 /**
  * multipart messages following `struct ComputationMessage`
  */
-struct ComputationMultipartMessage
+struct ComputationBobCryptodataMultipartMessage
 {
   /**
    * GNUNET message header

Modified: gnunet/src/scalarproduct/scalarproduct_api.c
===================================================================
--- gnunet/src/scalarproduct/scalarproduct_api.c        2014-12-07 21:50:13 UTC 
(rev 34498)
+++ gnunet/src/scalarproduct/scalarproduct_api.c        2014-12-07 21:53:44 UTC 
(rev 34499)
@@ -270,7 +270,7 @@
                  void *buf)
 {
   struct GNUNET_SCALARPRODUCT_ComputationHandle *h = cls;
-  struct ComputationMultipartMessage *msg;
+  struct ComputationBobCryptodataMultipartMessage *msg;
   size_t ret;
   uint32_t nsize;
   uint32_t todo;
@@ -300,14 +300,14 @@
   }
 
   todo = h->element_count_total - h->element_count_transfered;
-  nsize = sizeof (struct ComputationMultipartMessage)
+  nsize = sizeof (struct ComputationBobCryptodataMultipartMessage)
     + todo * sizeof (struct GNUNET_SCALARPRODUCT_Element);
   if (GNUNET_SERVER_MAX_MESSAGE_SIZE <= size)
   {
     /* cannot do all of them, limit to what is possible in one message */
-    todo = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct 
ComputationMultipartMessage))
+    todo = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct 
ComputationBobCryptodataMultipartMessage))
       / sizeof (struct GNUNET_SCALARPRODUCT_Element);
-    nsize = sizeof (struct ComputationMultipartMessage)
+    nsize = sizeof (struct ComputationBobCryptodataMultipartMessage)
       + todo * sizeof (struct GNUNET_SCALARPRODUCT_Element);
   }
 




reply via email to

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