gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20157 - gnunet/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r20157 - gnunet/src/namestore
Date: Thu, 1 Mar 2012 10:11:58 +0100

Author: grothoff
Date: 2012-03-01 10:11:58 +0100 (Thu, 01 Mar 2012)
New Revision: 20157

Modified:
   gnunet/src/namestore/namestore.h
   gnunet/src/namestore/namestore_common.c
Log:
-fixing sparc fun

Modified: gnunet/src/namestore/namestore.h
===================================================================
--- gnunet/src/namestore/namestore.h    2012-03-01 08:28:24 UTC (rev 20156)
+++ gnunet/src/namestore/namestore.h    2012-03-01 09:11:58 UTC (rev 20157)
@@ -54,6 +54,8 @@
 void
 GNUNET_NAMESTORE_records_free (unsigned int rd_count, struct 
GNUNET_NAMESTORE_RecordData *rd);
 
+
+GNUNET_NETWORK_STRUCT_BEGIN
 /**
  * A GNS record serialized for network transmission.
  * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
@@ -83,9 +85,8 @@
 
 
 
-GNUNET_NETWORK_STRUCT_BEGIN
 /**
- * Connect to namestore service
+ * Connect to namestore service.  FIXME: UNNECESSARY.
  */
 struct StartMessage
 {
@@ -96,10 +97,7 @@
   struct GNUNET_MessageHeader header;
 
 };
-GNUNET_NETWORK_STRUCT_END
 
-
-GNUNET_NETWORK_STRUCT_BEGIN
 /**
  * Generic namestore message with op id
  */
@@ -111,17 +109,15 @@
   struct GNUNET_MessageHeader header;
 
   /**
-   * Operation ID in NBO
+   * Operation ID in NBO // BETTER: request ID
    */
   uint32_t op_id;
 };
-GNUNET_NETWORK_STRUCT_END
 
 
 /**
  * Connect to namestore service
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct LookupNameMessage
 {
   /**
@@ -129,6 +125,7 @@
    */
   struct GNUNET_MessageHeader header;
 
+  // FIXME: use 'struct GenericMessage'
   /**
    * Operation ID in NBO
    */
@@ -143,7 +140,6 @@
   /* Requested record type */
   uint32_t name_len;
 };
-GNUNET_NETWORK_STRUCT_END
 
 
 /**
@@ -151,7 +147,6 @@
  * Memory layout:
  * [struct LookupNameResponseMessage][struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct 
GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct LookupNameResponseMessage
 {
   /**
@@ -168,12 +163,12 @@
 
   uint16_t name_len;
 
-  uint16_t contains_sig;
+  uint16_t rd_len;
 
+  int32_t contains_sig;
+
   /* Requested record type */
-  uint16_t rd_len;
 };
-GNUNET_NETWORK_STRUCT_END
 
 
 /**
@@ -181,7 +176,6 @@
  * Memory layout:
  * [struct RecordPutMessage][struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct 
GNUNET_NAMESTORE_RecordData]
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct RecordPutMessage
 {
   /**
@@ -209,12 +203,11 @@
 
   struct GNUNET_CRYPTO_RsaSignature signature;
 };
-GNUNET_NETWORK_STRUCT_END
 
+
 /**
  * Put a record to the namestore response
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct RecordPutResponseMessage
 {
   /**
@@ -234,7 +227,6 @@
    */
   uint16_t op_result;
 };
-GNUNET_NETWORK_STRUCT_END
 
 
 /**
@@ -242,7 +234,6 @@
  * Memory layout:
  * [struct RecordCreateMessage][char *name][rc_count * struct 
GNUNET_NAMESTORE_RecordData]
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct RecordCreateMessage
 {
   /**
@@ -266,14 +257,12 @@
   /* private key length */
   uint16_t pkey_len;
 };
-GNUNET_NETWORK_STRUCT_END
 
 
 /**
  * Create a record to the namestore response
  * Memory layout:
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct RecordCreateResponseMessage
 {
   /**
@@ -295,14 +284,12 @@
 
 
 };
-GNUNET_NETWORK_STRUCT_END
 
 /**
  * Remove a record from the namestore
  * Memory layout:
  * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
  */
-GNUNET_NETWORK_STRUCT_BEGIN
 struct RecordRemoveMessage
 {
   /**

Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c     2012-03-01 08:28:24 UTC (rev 
20156)
+++ gnunet/src/namestore/namestore_common.c     2012-03-01 09:11:58 UTC (rev 
20157)
@@ -50,7 +50,7 @@
                              const struct GNUNET_NAMESTORE_RecordData *rd)
 {
   //size_t len = 0;
-  struct GNUNET_NAMESTORE_NetworkRecord * nr;
+  struct GNUNET_NAMESTORE_NetworkRecord nr;
   char * d = (*dest);
   int c = 0;
   int offset;
@@ -79,14 +79,15 @@
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Serialized record [%i]: data_size 
%i\n", c,rd[c].data_size);
 
-    nr = (struct GNUNET_NAMESTORE_NetworkRecord *) &d[offset];
-    nr->data_size = htonl (rd[c].data_size);
-    nr->flags = htonl (rd[c].flags);
-    nr->record_type = htonl (rd[c].record_type);
-    nr->expiration = GNUNET_TIME_absolute_hton(rd[c].expiration);
+    // nr = (struct GNUNET_NAMESTORE_NetworkRecord *) &d[offset];
+    nr.data_size = htonl (rd[c].data_size);
+    nr.flags = htonl (rd[c].flags);
+    nr.record_type = htonl (rd[c].record_type);
+    nr.expiration = GNUNET_TIME_absolute_hton(rd[c].expiration);
+    memcpy (&d[offset], &nr, sizeof (nr));
+    offset += sizeof (struct GNUNET_NAMESTORE_NetworkRecord);
 
     /*put data here */
-    offset += sizeof (struct GNUNET_NAMESTORE_NetworkRecord);
     memcpy (&d[offset], rd[c].data, rd[c].data_size);
     offset += rd[c].data_size;
   }




reply via email to

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