gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8825 - in gnunet/src: datastore fs include util


From: gnunet
Subject: [GNUnet-SVN] r8825 - in gnunet/src: datastore fs include util
Date: Tue, 11 Aug 2009 16:24:07 -0600

Author: grothoff
Date: 2009-08-11 16:24:07 -0600 (Tue, 11 Aug 2009)
New Revision: 8825

Modified:
   gnunet/src/datastore/datastore_api.c
   gnunet/src/datastore/gnunet-service-datastore.c
   gnunet/src/datastore/plugin_datastore_sqlite.c
   gnunet/src/fs/fs_uri.c
   gnunet/src/fs/test_fs_getopt.c
   gnunet/src/fs/test_fs_uri.c
   gnunet/src/include/gnunet_signatures.h
   gnunet/src/include/gnunet_time_lib.h
   gnunet/src/util/pseudonym.c
   gnunet/src/util/time.c
Log:
more work on FS URIs

Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c        2009-08-11 21:42:00 UTC (rev 
8824)
+++ gnunet/src/datastore/datastore_api.c        2009-08-11 22:24:07 UTC (rev 
8825)
@@ -494,7 +494,6 @@
                              const struct
                              GNUNET_MessageHeader * msg)
 {
-  static struct GNUNET_TIME_Absolute zero;
   struct GNUNET_DATASTORE_Handle *h = cls;
   GNUNET_DATASTORE_Iterator cont = h->response_proc;
   const struct DataMessage *dm;
@@ -506,7 +505,8 @@
       GNUNET_CLIENT_disconnect (h->client);
       h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg);
       cont (h->response_proc_cls, 
-           NULL, 0, NULL, 0, 0, 0, zero, 0);
+           NULL, 0, NULL, 0, 0, 0, 
+           GNUNET_TIME_UNIT_ZERO_ABS, 0);
       return;
     }
   if (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END) 
@@ -518,7 +518,8 @@
                  "Received end of result set\n");
 #endif
       cont (h->response_proc_cls, 
-           NULL, 0, NULL, 0, 0, 0, zero, 0);
+           NULL, 0, NULL, 0, 0, 0, 
+           GNUNET_TIME_UNIT_ZERO_ABS, 0);
       return;
     }
   if ( (ntohs(msg->size) < sizeof(struct DataMessage)) ||
@@ -529,7 +530,8 @@
       h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg);
       h->response_proc = NULL;
       cont (h->response_proc_cls, 
-           NULL, 0, NULL, 0, 0, 0, zero, 0);
+           NULL, 0, NULL, 0, 0, 0, 
+           GNUNET_TIME_UNIT_ZERO_ABS, 0);
       return;
     }
   dm = (const struct DataMessage*) msg;
@@ -541,7 +543,8 @@
       h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg);
       h->response_proc = NULL;
       cont (h->response_proc_cls, 
-           NULL, 0, NULL, 0, 0, 0, zero, 0);
+           NULL, 0, NULL, 0, 0, 0, 
+           GNUNET_TIME_UNIT_ZERO_ABS, 0);
       return;
     }
 #if DEBUG_DATASTORE
@@ -632,7 +635,6 @@
                     void *cont_cls,
                     struct GNUNET_TIME_Relative timeout)
 {
-  static struct GNUNET_TIME_Absolute zero;
   const struct GNUNET_MessageHeader *hdr;
   uint16_t msize;
 
@@ -660,7 +662,8 @@
       h->response_proc = NULL;
       h->message_size = 0;
       cont (h->response_proc_cls, 
-           NULL, 0, NULL, 0, 0, 0, zero, 0);
+           NULL, 0, NULL, 0, 0, 0, 
+           GNUNET_TIME_UNIT_ZERO_ABS, 0);
     }
 }
 
@@ -759,7 +762,7 @@
   dm->priority = htonl(0);
   dm->anonymity = htonl(0);
   dm->uid = GNUNET_htonll(0);
-  dm->expiration.value = 0;
+  dm->expiration = GNUNET_TIME_absolute_hton(GNUNET_TIME_UNIT_ZERO_ABS);
   dm->key = *key;
   memcpy (&dm[1], data, size);
   transmit_for_status (h, cont, cont_cls, timeout);

Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c     2009-08-11 21:42:00 UTC 
(rev 8824)
+++ gnunet/src/datastore/gnunet-service-datastore.c     2009-08-11 22:24:07 UTC 
(rev 8825)
@@ -871,7 +871,6 @@
             struct GNUNET_SERVER_Client *client,
             const struct GNUNET_MessageHeader *message)
 {
-  static struct GNUNET_TIME_Absolute zero;
   const struct GetMessage *msg;
   uint16_t size;
 
@@ -900,7 +899,8 @@
                  "GET");
 #endif 
       transmit_item (client,
-                    NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+                    NULL, NULL, 0, NULL, 0, 0, 0, 
+                    GNUNET_TIME_UNIT_ZERO_ABS, 0);
       return;
     }
   GNUNET_SERVER_client_keep (client);

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2009-08-11 21:42:00 UTC 
(rev 8824)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2009-08-11 22:24:07 UTC 
(rev 8825)
@@ -507,7 +507,6 @@
 sqlite_next_request_cont (void *cls,
                          const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  static struct GNUNET_TIME_Absolute zero;
   struct NextContext * nc= cls;
   struct Plugin *plugin;
   unsigned long long rowid;
@@ -530,7 +529,7 @@
     END:
       nc->iter (nc->iter_cls, 
                NULL, NULL, 0, NULL, 0, 0, 0, 
-               zero, 0);
+               GNUNET_TIME_UNIT_ZERO_ABS, 0);
       nc->prep (nc->prep_cls, NULL);
       GNUNET_free (nc);
       return;
@@ -923,7 +922,6 @@
            PluginIterator iter,
            void *iter_cls)
 {
-  static struct GNUNET_TIME_Absolute zero;
   struct NextContext *nc;
   struct IterContext *ic;
   sqlite3_stmt *stmt_1;
@@ -941,7 +939,7 @@
       LOG_SQLITE (plugin, NULL,
                   GNUNET_ERROR_TYPE_ERROR |
                   GNUNET_ERROR_TYPE_BULK, "sqlite3_prepare");
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   if (sq_prepare (plugin->dbh, stmt_str_2, &stmt_2) != SQLITE_OK)
@@ -950,7 +948,7 @@
                   GNUNET_ERROR_TYPE_ERROR |
                   GNUNET_ERROR_TYPE_BULK, "sqlite3_prepare");
       sqlite3_finalize (stmt_1);
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   nc = GNUNET_malloc (sizeof(struct NextContext) + 
@@ -1166,7 +1164,6 @@
                            PluginIterator iter,
                            void *iter_cls)
 {
-  static struct GNUNET_TIME_Absolute zero;
   struct Plugin *plugin = cls;
   struct NextContext *nc;
   sqlite3_stmt *stmt;
@@ -1178,7 +1175,7 @@
       LOG_SQLITE (plugin, NULL,
                   GNUNET_ERROR_TYPE_ERROR |
                   GNUNET_ERROR_TYPE_BULK, "sqlite3_prepare");
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   nc = GNUNET_malloc (sizeof(struct NextContext));
@@ -1276,7 +1273,6 @@
                   uint32_t type,
                   PluginIterator iter, void *iter_cls)
 {
-  static struct GNUNET_TIME_Absolute zero;
   struct Plugin *plugin = cls;
   struct GetNextContext *gpc;
   struct NextContext *nc;
@@ -1301,7 +1297,7 @@
     {
       LOG_SQLITE (plugin, NULL,
                   GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 
"sqlite_prepare");
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   sqoff = 1;
@@ -1321,7 +1317,7 @@
                   GNUNET_ERROR_TYPE_ERROR, "sqlite_bind");
       sqlite3_reset (stmt);
       sqlite3_finalize (stmt);
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   ret = sqlite3_step (stmt);
@@ -1332,7 +1328,7 @@
                  "sqlite_step");
       sqlite3_reset (stmt);
       sqlite3_finalize (stmt);
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   total = sqlite3_column_int (stmt, 0);
@@ -1340,7 +1336,7 @@
   sqlite3_finalize (stmt);
   if (0 == total)
     {
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
 
@@ -1357,7 +1353,7 @@
       LOG_SQLITE (plugin, NULL,
                   GNUNET_ERROR_TYPE_ERROR |
                   GNUNET_ERROR_TYPE_BULK, "sqlite_prepare");
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0);
+      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
       return;
     }
   nc = GNUNET_malloc (sizeof(struct NextContext) + 

Modified: gnunet/src/fs/fs_uri.c
===================================================================
--- gnunet/src/fs/fs_uri.c      2009-08-11 21:42:00 UTC (rev 8824)
+++ gnunet/src/fs/fs_uri.c      2009-08-11 22:24:07 UTC (rev 8825)
@@ -80,6 +80,7 @@
  */
 #include "platform.h"
 #include "gnunet_fs_service.h"
+#include "gnunet_signatures.h"
 #include "fs.h"
 
 
@@ -422,6 +423,91 @@
 
 
 /**
+ * Convert a character back to the binary value
+ * that it represents (given base64-encoding).
+ *
+ * @param a character to convert
+ * @return offset in the "tbl" array
+ */
+static unsigned int
+c2v (unsigned char a)
+{
+  if ((a >= '0') && (a <= '9'))
+    return a - '0';
+  if ((a >= 'A') && (a <= 'Z'))
+    return (a - 'A' + 10);
+  if ((a >= 'a') && (a <= 'z'))
+    return (a - 'a' + 36);
+  if (a == '_')
+    return 62;
+  if (a == '=')
+    return 63;
+  return -1;
+}
+
+
+/**
+ * Convert string back to binary data.
+ *
+ * @param input '\0'-terminated string
+ * @param data where to write binary data
+ * @param size how much data should be converted
+ * @return number of characters processed from input,
+ *        -1 on error
+ */
+static int
+enc2bin (const char *input, void *data, size_t size)
+{
+  size_t len;
+  size_t pos;
+  unsigned int bits;
+  unsigned int hbits;
+
+  len = size * 8 / 6;
+  if (((size * 8) % 6) != 0)
+    len++;
+  if (strlen (input) < len)
+    return -1;                  /* error! */
+  bits = 0;
+  hbits = 0;
+  len = 0;
+  pos = 0;
+  for (pos = 0; pos < size; pos++)
+    {
+      while (hbits < 8)
+        {
+          bits |= (c2v (input[len++]) << hbits);
+          hbits += 6;
+        }
+      (((unsigned char *) data)[pos]) = (unsigned char) bits;
+      bits >>= 8;
+      hbits -= 8;
+    }
+  return len;
+}
+
+
+/**
+ * Structure that defines how the
+ * contents of a location URI must be
+ * assembled in memory to create or
+ * verify the signature of a location
+ * URI.
+ */
+struct LocUriAssembly 
+{
+  struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
+
+  struct GNUNET_TIME_AbsoluteNBO exptime;
+
+  struct FileIdentifier fi;
+  
+  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded peer;
+
+};
+
+
+/**
  * Parse a LOC URI.
  * Also verifies validity of the location URI.
  *
@@ -432,12 +518,15 @@
 static struct GNUNET_FS_Uri *
 uri_loc_parse (const char *s, char **emsg)
 {
-  struct GNUNET_FS_Uri *ret;
+  struct GNUNET_FS_Uri *uri;
   char h1[sizeof(struct GNUNET_CRYPTO_HashAsciiEncoded)];
   char h2[sizeof(struct GNUNET_CRYPTO_HashAsciiEncoded)];
   unsigned int pos;
   unsigned int npos;
   unsigned long long exptime;
+  struct GNUNET_TIME_Absolute et;
+  struct GNUNET_CRYPTO_RsaSignature sig;
+  struct LocUriAssembly ass;
   int ret;
   size_t slen;
   char *addr;
@@ -462,14 +551,14 @@
   h2[sizeof(struct GNUNET_CRYPTO_HashAsciiEncoded)-1] = '\0';
   
   if ((GNUNET_OK != GNUNET_CRYPTO_hash_from_string (h1,
-                                                   &fi.chk.key)) ||
+                                                   &ass.fi.chk.key)) ||
       (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (h2,
-                                                   &fi.chk.query)) 
+                                                   &ass.fi.chk.query)) ||
       (1 != SSCANF (&s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) * 
2],
                     "%llu", 
-                   &fi.file_length)) )
+                   &ass.fi.file_length)) )
     return NULL;
-  fi.file_length = GNUNET_htonll (fi.file_length);
+  ass.fi.file_length = GNUNET_htonll (ass.fi.file_length);
 
   npos = pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) * 2;
   while ((s[npos] != '\0') && (s[npos] != '.'))
@@ -477,39 +566,42 @@
   if (s[npos] == '\0')
     goto ERR;
   ret = enc2bin (&s[npos], 
-                &loc->peer,
-                sizeof (GNUNET_RSA_PublicKey));
+                &ass.peer,
+                sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
   if (ret == -1)
     goto ERR;
   npos += ret;
-  if (dup[npos++] != '.')
+  if (s[npos++] != '.')
     goto ERR;
   ret = enc2bin (&s[npos],
-                &loc->contentSignature,
+                &sig,
                 sizeof (struct GNUNET_CRYPTO_RsaSignature));
   if (ret == -1)
     goto ERR;
   npos += ret;
-  if (dup[npos++] != '.')
+  if (s[npos++] != '.')
     goto ERR;
-  if (1 != SSCANF (&dup[npos], "%llu", &exptime))
+  if (1 != SSCANF (&s[npos], "%llu", &exptime))
     goto ERR;
-  // FIXME: do something to exptime...
-  /* Finally: verify sigs! */
-  if (GNUNET_OK != GNUNET_RSA_verify (&loc->fi,
-                                      sizeof (struct FileIdentifier) +
-                                      sizeof (GNUNET_PeerIdentity) +
-                                      sizeof (GNUNET_Int32Time),
-                                      &loc->contentSignature, 
-                                     &loc->peer))
+  ass.purpose.size = htonl(sizeof(struct LocUriAssembly));
+  ass.purpose.purpose = htonl(GNUNET_SIGNATURE_PURPOSE_NAMESPACE_PLACEMENT);
+  et.value = exptime;
+  ass.exptime = GNUNET_TIME_absolute_hton (et);
+  if (GNUNET_OK != 
+      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NAMESPACE_PLACEMENT,
+                               &ass.purpose,
+                               &sig,
+                               &ass.peer))
     goto ERR;
 
-  ret = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri));
-  ret->type = loc;
-  ret->data.loc.chk = fi;
-  ret->data.loc.xx = yy;
+  uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri));
+  uri->type = loc;
+  uri->data.loc.fi = ass.fi;
+  uri->data.loc.peer = ass.peer;
+  uri->data.loc.expirationTime = et;
+  uri->data.loc.contentSignature = sig;
 
-  return ret;
+  return uri;
 ERR:
   GNUNET_free_non_null (addr);
   return NULL;
@@ -1251,71 +1343,6 @@
 
 
 /**
- * Convert a character back to the binary value
- * that it represents (given base64-encoding).
- *
- * @param a character to convert
- * @return offset in the "tbl" array
- */
-static unsigned int
-c2v (unsigned char a)
-{
-  if ((a >= '0') && (a <= '9'))
-    return a - '0';
-  if ((a >= 'A') && (a <= 'Z'))
-    return (a - 'A' + 10);
-  if ((a >= 'a') && (a <= 'z'))
-    return (a - 'a' + 36);
-  if (a == '_')
-    return 62;
-  if (a == '=')
-    return 63;
-  return -1;
-}
-
-
-/**
- * Convert string back to binary data.
- *
- * @param input '\0'-terminated string
- * @param data where to write binary data
- * @param size how much data should be converted
- * @return number of characters processed from input,
- *        -1 on error
- */
-static int
-enc2bin (const char *input, void *data, size_t size)
-{
-  size_t len;
-  size_t pos;
-  unsigned int bits;
-  unsigned int hbits;
-
-  len = size * 8 / 6;
-  if (((size * 8) % 6) != 0)
-    len++;
-  if (strlen (input) < len)
-    return -1;                  /* error! */
-  bits = 0;
-  hbits = 0;
-  len = 0;
-  pos = 0;
-  for (pos = 0; pos < size; pos++)
-    {
-      while (hbits < 8)
-        {
-          bits |= (c2v (input[len++]) << hbits);
-          hbits += 6;
-        }
-      (((unsigned char *) data)[pos]) = (unsigned char) bits;
-      bits >>= 8;
-      hbits -= 8;
-    }
-  return len;
-}
-
-
-/**
  * Convert a LOC URI to a string.
  *
  * @param uri loc uri to convert
@@ -1337,15 +1364,15 @@
   peerSig = bin2enc (&uri->data.loc.contentSignature, 
                     sizeof (struct GNUNET_CRYPTO_RsaSignature));
   GNUNET_asprintf (&ret,
-                   "%s%s%s.%s.%llu.%s.%s.%u", // FIXME: expirationTime 
64-bit???
+                   "%s%s%s.%s.%llu.%s.%s.%llu",
                    GNUNET_FS_URI_PREFIX,
                    GNUNET_FS_URI_LOC_INFIX,
                    (const char *) &keyhash,
                    (const char *) &queryhash,
-                   GNUNET_ntohll (uri->data.loc.fi.file_length),
+                   (unsigned long long) GNUNET_ntohll 
(uri->data.loc.fi.file_length),
                    peerId,
                   peerSig,
-                  uri->data.loc.expirationTime);
+                  (unsigned long long) uri->data.loc.expirationTime.value);
   GNUNET_free (peerSig);
   GNUNET_free (peerId);
   return ret;

Modified: gnunet/src/fs/test_fs_getopt.c
===================================================================
--- gnunet/src/fs/test_fs_getopt.c      2009-08-11 21:42:00 UTC (rev 8824)
+++ gnunet/src/fs/test_fs_getopt.c      2009-08-11 22:24:07 UTC (rev 8825)
@@ -23,7 +23,7 @@
  * @author Christian Grothoff
  */
 #include "platform.h"
-#include "gnunet_fs_lib.h"
+#include "gnunet_fs_service.h"
 
 int
 main (int argc, char *argv[])

Modified: gnunet/src/fs/test_fs_uri.c
===================================================================
--- gnunet/src/fs/test_fs_uri.c 2009-08-11 21:42:00 UTC (rev 8824)
+++ gnunet/src/fs/test_fs_uri.c 2009-08-11 22:24:07 UTC (rev 8825)
@@ -19,15 +19,15 @@
 */
 
 /**
- * @file applications/fs/ecrs/uritest.c
- * @brief Test for uri.c
+ * @file fs/test_fs_uri.c
+ * @brief Test for fs_uri.c
  * @author Christian Grothoff
  */
 
 #include "platform.h"
-#include "gnunet_util.h"
-#include "gnunet_ecrs_lib.h"
-#include "ecrs.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_fs_service.h"
+#include "fs.h"
 
 #define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); 
return 1; }
 

Modified: gnunet/src/include/gnunet_signatures.h
===================================================================
--- gnunet/src/include/gnunet_signatures.h      2009-08-11 21:42:00 UTC (rev 
8824)
+++ gnunet/src/include/gnunet_signatures.h      2009-08-11 22:24:07 UTC (rev 
8825)
@@ -59,10 +59,16 @@
  */
 #define GNUNET_SIGNATURE_PURPOSE_NAMESPACE_ADVERTISEMENT 3
 
+
 /**
+ * Signature of content URI placed into a namespace.
+ */
+#define GNUNET_SIGNATURE_PURPOSE_NAMESPACE_PLACEMENT 4
+
+/**
  *
  */
-#define GNUNET_SIGNATURE_PURPOSE_RESOLVER_RESPONSE 3
+#define GNUNET_SIGNATURE_PURPOSE_RESOLVER_RESPONSE 5
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */

Modified: gnunet/src/include/gnunet_time_lib.h
===================================================================
--- gnunet/src/include/gnunet_time_lib.h        2009-08-11 21:42:00 UTC (rev 
8824)
+++ gnunet/src/include/gnunet_time_lib.h        2009-08-11 22:24:07 UTC (rev 
8825)
@@ -61,7 +61,7 @@
  */
 struct GNUNET_TIME_RelativeNBO
 {
-  uint64_t value GNUNET_PACKED;
+  uint64_t value__ GNUNET_PACKED;
 };
 
 
@@ -70,13 +70,15 @@
  */
 struct GNUNET_TIME_AbsoluteNBO
 {
-  uint64_t value GNUNET_PACKED;
+  uint64_t value__ GNUNET_PACKED;
 };
 
+
 /**
  * @brief constants to specify time
  */
 #define GNUNET_TIME_UNIT_ZERO     GNUNET_TIME_relative_get_zero()
+#define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero()
 #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_unit()
 #define GNUNET_TIME_UNIT_SECONDS 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 1000)
 #define GNUNET_TIME_UNIT_MINUTES 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
@@ -104,6 +106,11 @@
 struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero (void);
 
 /**
+ * Return absolute time of 0ms.
+ */
+struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_zero (void);
+
+/**
  * Return relative time of 1ms.
  */
 struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_unit (void);

Modified: gnunet/src/util/pseudonym.c
===================================================================
--- gnunet/src/util/pseudonym.c 2009-08-11 21:42:00 UTC (rev 8824)
+++ gnunet/src/util/pseudonym.c 2009-08-11 22:24:07 UTC (rev 8825)
@@ -496,7 +496,9 @@
  * Insert metadata into existing MD record (passed as cls).
  */
 static int
-merge_meta_helper (EXTRACTOR_KeywordType type, const char *data, void *cls)
+merge_meta_helper (void *cls,
+                  EXTRACTOR_KeywordType type, 
+                  const char *data)
 {
   struct GNUNET_CONTAINER_MetaData *meta = cls;
   GNUNET_CONTAINER_meta_data_insert (meta, type, data);

Modified: gnunet/src/util/time.c
===================================================================
--- gnunet/src/util/time.c      2009-08-11 21:42:00 UTC (rev 8824)
+++ gnunet/src/util/time.c      2009-08-11 22:24:07 UTC (rev 8825)
@@ -55,7 +55,18 @@
   return zero;
 }
 
+
 /**
+ * Return absolute time of 0ms.
+ */
+struct GNUNET_TIME_Absolute
+GNUNET_TIME_absolute_get_zero ()
+{
+  static struct GNUNET_TIME_Absolute zero;
+  return zero;
+}
+
+/**
  * Return relative time of 1ms.
  */
 struct GNUNET_TIME_Relative
@@ -257,7 +268,7 @@
 GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a)
 {
   struct GNUNET_TIME_RelativeNBO ret;
-  ret.value = GNUNET_htonll (a.value);
+  ret.value__ = GNUNET_htonll (a.value);
   return ret;
 }
 
@@ -268,7 +279,7 @@
 GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a)
 {
   struct GNUNET_TIME_Relative ret;
-  ret.value = GNUNET_ntohll (a.value);
+  ret.value = GNUNET_ntohll (a.value__);
   return ret;
 
 }
@@ -280,7 +291,7 @@
 GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a)
 {
   struct GNUNET_TIME_AbsoluteNBO ret;
-  ret.value = GNUNET_htonll (a.value);
+  ret.value__ = GNUNET_htonll (a.value);
   return ret;
 }
 
@@ -291,7 +302,7 @@
 GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a)
 {
   struct GNUNET_TIME_Absolute ret;
-  ret.value = GNUNET_ntohll (a.value);
+  ret.value = GNUNET_ntohll (a.value__);
   return ret;
 
 }





reply via email to

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