gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6937 - in GNUnet: . src/applications/fs/collection src/app


From: gnunet
Subject: [GNUnet-SVN] r6937 - in GNUnet: . src/applications/fs/collection src/applications/fs/ecrs src/applications/fs/namespace src/applications/fs/tools src/include
Date: Fri, 30 May 2008 22:35:59 -0600 (MDT)

Author: grothoff
Date: 2008-05-30 22:35:58 -0600 (Fri, 30 May 2008)
New Revision: 6937

Modified:
   GNUnet/src/applications/fs/collection/collection.c
   GNUnet/src/applications/fs/ecrs/namespace.c
   GNUnet/src/applications/fs/namespace/info.c
   GNUnet/src/applications/fs/namespace/update_info.c
   GNUnet/src/applications/fs/tools/gnunet-insert.c
   GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
   GNUnet/src/include/gnunet_collection_lib.h
   GNUnet/src/include/gnunet_ecrs_lib.h
   GNUnet/src/include/gnunet_namespace_lib.h
   GNUnet/todo
Log:
more hacking on the namespace/pseudonym API refactoring

Modified: GNUnet/src/applications/fs/collection/collection.c
===================================================================
--- GNUnet/src/applications/fs/collection/collection.c  2008-05-31 04:34:24 UTC 
(rev 6936)
+++ GNUnet/src/applications/fs/collection/collection.c  2008-05-31 04:35:58 UTC 
(rev 6937)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
+     (C) 2004, 2005, 2006, 2008 Christian Grothoff (and other contributing 
authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -59,6 +59,11 @@
   /**
    * What is the last ID for the publication?
    */
+  GNUNET_HashCode pid;
+
+  /**
+   * What is the last ID for the publication?
+   */
   GNUNET_HashCode lastId;
 
   /**
@@ -95,11 +100,6 @@
   CollectionData data;
 
   /**
-   * Name of the collection
-   */
-  char *name;
-
-  /**
    * Metadata describing the collection
    */
   struct GNUNET_ECRS_MetaData *meta;
@@ -226,23 +226,7 @@
   pos += sizeof (int);
   mlen = ntohl (*(int *) pos);
   pos += sizeof (int);
-  len = ntohl (*(int *) pos);
-  if (len > 1024)
-    {
-      GNUNET_GE_BREAK (ectx, 0);
-      len = 1024;
-    }
-  collectionData->name = GNUNET_malloc (len + 1);
-  pos += sizeof (int);
   rsize -= 4 * sizeof (int);
-  if (len > rsize)
-    {
-      GNUNET_GE_BREAK (ectx, 0);
-      len = rsize;
-    }
-  memcpy (collectionData->name, pos, len);
-  rsize -= len;
-  pos += len;
   if (mlen > rsize)
     {
       GNUNET_GE_BREAK (ectx, 0);
@@ -364,9 +348,6 @@
   WRITEINT (fd, collectionData->file_count);
   WRITEINT (fd, collectionData->changed);
   WRITEINT (fd, mlen);
-  GNUNET_GE_BREAK (ectx, strlen (collectionData->name) < 1024);
-  WRITEINT (fd, strlen (collectionData->name));
-  WRITE (fd, collectionData->name, strlen (collectionData->name));
   WRITE (fd, buf, mlen);
   GNUNET_free (buf);
   for (i = 0; i < collectionData->file_count; i++)
@@ -425,7 +406,6 @@
 GNUNET_CO_collection_start (unsigned int anonymityLevel,
                             unsigned int prio,
                             GNUNET_Int32Time updateInterval,
-                            const char *name,
                             const struct GNUNET_ECRS_MetaData *meta)
 {
   struct GNUNET_ECRS_URI *advertisement;
@@ -435,14 +415,12 @@
 
   GNUNET_mutex_lock (lock);
   GNUNET_CO_collection_stop (); /* cancel old collection */
-  GNUNET_GE_ASSERT (ectx, name != NULL);
   advertisement = GNUNET_ECRS_keyword_string_to_uri (ectx, COLLECTION);
   GNUNET_GE_ASSERT (ectx, advertisement != NULL);
   GNUNET_get_time_int32 (&now);
   GNUNET_create_random_hash (&nextId);
   rootURI = GNUNET_ECRS_namespace_create (ectx,
                                           cfg,
-                                          name,
                                           meta,
                                           anonymityLevel,
                                           prio,
@@ -455,17 +433,18 @@
       GNUNET_mutex_unlock (lock);
       return GNUNET_SYSERR;
     }
-  GNUNET_ECRS_uri_destroy (advertisement);
-  GNUNET_ECRS_uri_destroy (rootURI);
   collectionData = GNUNET_malloc (sizeof (CollectionInfo));
   memset (collectionData, 0, sizeof (CollectionInfo));
-  GNUNET_create_random_hash (&collectionData->data.lastId);
+  GNUNET_create_random_hash (&collectionData->data.lastId);  
+  GNUNET_ECRS_uri_get_namespace_from_sks(rootURI,
+                                        &collectionData->data.pid);
   collectionData->data.nextId = nextId;
   collectionData->data.updateInterval = htonl (updateInterval);
   collectionData->data.anonymityLevel = htonl (anonymityLevel);
   collectionData->data.priority = htonl (prio);
   collectionData->meta = GNUNET_ECRS_meta_data_duplicate (meta);
-  collectionData->name = GNUNET_strdup (name);
+  GNUNET_ECRS_uri_destroy (advertisement);
+  GNUNET_ECRS_uri_destroy (rootURI);
   GNUNET_mutex_unlock (lock);
   return GNUNET_OK;
 }
@@ -486,7 +465,7 @@
       GNUNET_mutex_unlock (lock);
       return GNUNET_SYSERR;
     }
-  GNUNET_ECRS_namespace_delete (ectx, cfg, collectionData->name);
+  GNUNET_ECRS_namespace_delete (ectx, cfg, &collectionData->data.pid);
   GNUNET_ECRS_meta_data_destroy (collectionData->meta);
   for (i = 0; i < collectionData->file_count; i++)
     {
@@ -494,7 +473,6 @@
       GNUNET_ECRS_uri_destroy (collectionData->files[i].uri);
     }
   GNUNET_array_grow (collectionData->files, collectionData->file_count, 0);
-  GNUNET_free (collectionData->name);
   GNUNET_free (collectionData);
   collectionData = NULL;
   GNUNET_mutex_unlock (lock);
@@ -504,12 +482,12 @@
 /**
  * Are we using a collection?
  *
- * @return NULL if there is no collection, otherwise its name
+ * @return NULL if there is no collection, otherwise its metadata
  */
-char *
+struct GNUNET_ECRS_MetaData *
 GNUNET_CO_collection_get_name ()
 {
-  char *name;
+  struct GNUNET_ECRS_MetaData *meta;
 
   GNUNET_mutex_lock (lock);
   if (collectionData == NULL)
@@ -517,9 +495,9 @@
       GNUNET_mutex_unlock (lock);
       return NULL;
     }
-  name = GNUNET_strdup (collectionData->name);
+  meta = GNUNET_ECRS_meta_data_duplicate (collectionData->meta);
   GNUNET_mutex_unlock (lock);
-  return name;
+  return meta;
 }
 
 /**
@@ -636,7 +614,7 @@
   GNUNET_free (tmpName);
   uri = GNUNET_ECRS_namespace_add_content (ectx,
                                            cfg,
-                                           collectionData->name,
+                                           &collectionData->data.pid,
                                            ntohl (collectionData->data.
                                                   anonymityLevel),
                                            ntohl (collectionData->data.

Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2008-05-31 04:34:24 UTC (rev 
6936)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2008-05-31 04:35:58 UTC (rev 
6937)
@@ -39,11 +39,13 @@
 
 static char *
 getPseudonymFileName (struct GNUNET_GE_Context *ectx,
-                      struct GNUNET_GC_Configuration *cfg, const char *name)
+                      struct GNUNET_GC_Configuration *cfg, 
+                     const GNUNET_HashCode * pid)
 {
   char *gnHome;
   char *fileName;
-
+  GNUNET_EncName enc;
+  
   GNUNET_GC_get_configuration_value_filename (cfg,
                                               "GNUNET",
                                               "GNUNET_HOME",
@@ -52,17 +54,41 @@
   gnHome = GNUNET_expand_file_name (ectx, fileName);
   GNUNET_free (fileName);
   fileName =
-    GNUNET_malloc (strlen (gnHome) + strlen (PSEUDODIR) + strlen (name) + 2);
+    GNUNET_malloc (strlen (gnHome) + strlen (PSEUDODIR) + 
sizeof(GNUNET_EncName) + 2);
   strcpy (fileName, gnHome);
   GNUNET_free (gnHome);
   strcat (fileName, DIR_SEPARATOR_STR);
   strcat (fileName, PSEUDODIR);
   GNUNET_disk_directory_create (ectx, fileName);
-  strcat (fileName, name);
+  if (pid != NULL)
+    {
+      GNUNET_hash_to_enc(pid,
+                        &enc);     
+      strcat (fileName, (char*) &enc);
+    }
   return fileName;
 }
 
+
 /**
+ * Check if the given namespace exists (locally).
+ *
+ * @return GNUNET_OK if the namespace exists, GNUNET_SYSERR if not
+ */
+int GNUNET_ECRS_namespace_test_exists (struct GNUNET_GE_Context *ectx,
+                                       struct GNUNET_GC_Configuration *cfg,
+                                       const GNUNET_HashCode * pid)
+{
+  char *fileName;
+  int ret;
+
+  fileName = getPseudonymFileName (ectx, cfg, pid);
+  ret = GNUNET_disk_file_test (ectx, fileName);
+  GNUNET_free (fileName);
+  return ret;
+}
+
+/**
  * Delete a local namespace.
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
@@ -70,11 +96,11 @@
 int
 GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx,
                               struct GNUNET_GC_Configuration *cfg,
-                              const char *name)
+                              const GNUNET_HashCode * pid)
 {
   char *fileName;
 
-  fileName = getPseudonymFileName (ectx, cfg, name);
+  fileName = getPseudonymFileName (ectx, cfg, pid);
   if (GNUNET_YES != GNUNET_disk_file_test (ectx, fileName))
     {
       GNUNET_free (fileName);
@@ -115,7 +141,6 @@
 struct GNUNET_ECRS_URI *
 GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx,
                               struct GNUNET_GC_Configuration *cfg,
-                              const char *name,
                               const struct GNUNET_ECRS_MetaData *meta,
                               unsigned int anonymityLevel,
                               unsigned int priority,
@@ -136,6 +161,8 @@
   unsigned int size;
   unsigned int mdsize;
   struct GNUNET_RSA_PrivateKey *pk;
+  GNUNET_RSA_PublicKey pubk;
+  GNUNET_HashCode pid;
   GNUNET_EC_NBlock *nb;
   GNUNET_EC_KNBlock *knb;
   char **keywords;
@@ -150,17 +177,19 @@
       GNUNET_GE_BREAK (ectx, 0);
       return NULL;
     }
-  fileName = getPseudonymFileName (ectx, cfg, name);
+  hk = GNUNET_RSA_create_key ();
+  GNUNET_RSA_get_public_key(hk,
+                           &pubk);
+  GNUNET_hash(&pubk,
+             sizeof(GNUNET_RSA_PublicKey),
+             &pid);
+  fileName = getPseudonymFileName (ectx, cfg, &pid);
   if (GNUNET_YES == GNUNET_disk_file_test (ectx, fileName))
     {
-      GNUNET_GE_LOG (ectx,
-                     GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                     _("Cannot create pseudonym `%s', file `%s' exists.\n"),
-                     name, fileName);
+      GNUNET_GE_BREAK(NULL, 0); /* hash collision!? */
       GNUNET_free (fileName);
       return NULL;
     }
-  hk = GNUNET_RSA_create_key ();
   hke = GNUNET_RSA_encode_key (hk);
   len = ntohs (hke->len);
   dst = (char *) hke;
@@ -169,7 +198,6 @@
   GNUNET_free (dst);
 
   /* create advertisements */
-
   mdsize =
     GNUNET_ECRS_meta_data_get_serialized_size (meta,
                                                GNUNET_ECRS_SERIALIZE_PART);
@@ -189,7 +217,7 @@
       if (mdsize == -1)
         {
           GNUNET_GE_BREAK (ectx, 0);
-          GNUNET_ECRS_namespace_delete (ectx, cfg, name);
+          GNUNET_ECRS_namespace_delete (ectx, cfg, &pid);
           GNUNET_RSA_free_key (hk);
           return NULL;
         }
@@ -237,7 +265,7 @@
       GNUNET_free (value);
       GNUNET_client_connection_destroy (sock);
       GNUNET_RSA_free_key (hk);
-      GNUNET_ECRS_namespace_delete (ectx, cfg, name);
+      GNUNET_ECRS_namespace_delete (ectx, cfg, &pid);
       return NULL;
     }
 
@@ -291,7 +319,7 @@
             {
               GNUNET_GE_BREAK (ectx, 0);
               GNUNET_free (rootURI);
-              GNUNET_ECRS_namespace_delete (ectx, cfg, name);
+              GNUNET_ECRS_namespace_delete (ectx, cfg, &pid);
               GNUNET_free (cpy);
               GNUNET_free (knvalue);
               GNUNET_free (value);
@@ -314,69 +342,7 @@
   return rootURI;
 }
 
-
 /**
- * Check if the given namespace exists (locally).
- * @param hc if non-null, also check that this is the
- *   hc of the public key
- * @return GNUNET_OK if the namespace exists, GNUNET_SYSERR if not
- */
-int
-GNUNET_ECRS_namespace_test_exists (struct GNUNET_GE_Context *ectx,
-                                   struct GNUNET_GC_Configuration *cfg,
-                                   const char *name,
-                                   const GNUNET_HashCode * hc)
-{
-  struct GNUNET_RSA_PrivateKey *hk;
-  char *fileName;
-  GNUNET_RSA_PrivateKeyEncoded *hke;
-  char *dst;
-  unsigned long long len;
-  GNUNET_HashCode namespace;
-  GNUNET_RSA_PublicKey pk;
-
-  /* FIRST: read and decrypt pseudonym! */
-  fileName = getPseudonymFileName (ectx, cfg, name);
-  if (GNUNET_OK != GNUNET_disk_file_size (ectx, fileName, &len, GNUNET_YES))
-    {
-      GNUNET_free (fileName);
-      return GNUNET_SYSERR;
-    }
-  if (len < 2)
-    {
-      GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                     _("File `%s' does not contain a pseudonym.\n"),
-                     fileName);
-      GNUNET_free (fileName);
-      return GNUNET_SYSERR;
-    }
-  dst = GNUNET_malloc (len);
-  len = GNUNET_disk_file_read (ectx, fileName, len, dst);
-  GNUNET_free (fileName);
-  hke = (GNUNET_RSA_PrivateKeyEncoded *) dst;
-  if (ntohs (hke->len) != len)
-    {
-      GNUNET_GE_LOG (ectx,
-                     GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                     _("Format of pseudonym `%s' is invalid.\n"), name);
-      GNUNET_free (hke);
-      return GNUNET_SYSERR;
-    }
-  hk = GNUNET_RSA_decode_key (hke);
-  GNUNET_free (hke);
-  if (hk == NULL)
-    return GNUNET_SYSERR;
-  GNUNET_RSA_get_public_key (hk, &pk);
-  GNUNET_RSA_free_key (hk);
-  GNUNET_hash (&pk, sizeof (GNUNET_RSA_PublicKey), &namespace);
-  if ((hc == NULL)
-      || (0 == memcmp (hc, &namespace, sizeof (GNUNET_HashCode))))
-    return GNUNET_OK;
-  else
-    return GNUNET_SYSERR;
-}
-
-/**
  * Add an entry into a namespace.
  *
  * @param name in which namespace to publish, use just the
@@ -389,7 +355,7 @@
 struct GNUNET_ECRS_URI *
 GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx,
                                    struct GNUNET_GC_Configuration *cfg,
-                                   const char *name,
+                                   const GNUNET_HashCode * pid,
                                    unsigned int anonymityLevel,
                                    unsigned int priority,
                                    GNUNET_CronTime expiration,
@@ -418,7 +384,7 @@
   int ret;
 
   /* FIRST: read pseudonym! */
-  fileName = getPseudonymFileName (ectx, cfg, name);
+  fileName = getPseudonymFileName (ectx, cfg, pid);
   if (GNUNET_OK != GNUNET_disk_file_size (ectx, fileName, &len, GNUNET_YES))
     {
       GNUNET_free (fileName);
@@ -439,7 +405,7 @@
   if (ntohs (hke->len) != len)
     {
       GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                     _("Format of pseudonym `%s' is invalid.\n"), name);
+                     _("Format of pseudonym `%s' is invalid.\n"), fileName);
       GNUNET_free (hke);
       return NULL;
     }
@@ -567,8 +533,12 @@
   unsigned long long len;
   GNUNET_HashCode namespace;
   GNUNET_RSA_PublicKey pk;
+  GNUNET_HashCode pid;
 
-  fileName = getPseudonymFileName (c->ectx, c->cfg, name);
+  if (GNUNET_OK != GNUNET_enc_to_hash(name,
+                                     &pid))
+    return GNUNET_OK; /* ignore */
+  fileName = getPseudonymFileName (c->ectx, c->cfg, &pid);
   if (GNUNET_OK !=
       GNUNET_disk_file_size (c->ectx, fileName, &len, GNUNET_YES))
     {
@@ -579,8 +549,9 @@
     {
       GNUNET_GE_LOG (c->ectx,
                      GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                     _("File `%s' does not contain a pseudonym.\n"),
+                     _("File `%s' does not contain a pseudonym, trying to 
remove.\n"),
                      fileName);
+      UNLINK(fileName);
       GNUNET_free (fileName);
       return GNUNET_OK;
     }
@@ -602,7 +573,8 @@
     {
       GNUNET_GE_LOG (c->ectx,
                      GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                     _("Format of file `%s' is invalid.\n"), fileName);
+                     _("Format of file `%s' is invalid, trying to remove.\n"), 
fileName);
+      UNLINK(fileName);
       GNUNET_free (fileName);
       GNUNET_GE_BREAK (c->ectx, 0);
       return GNUNET_SYSERR;
@@ -642,7 +614,7 @@
   myCLS.cnt = 0;
   myCLS.ectx = ectx;
   myCLS.cfg = cfg;
-  dirName = getPseudonymFileName (ectx, cfg, "");
+  dirName = getPseudonymFileName (ectx, cfg, NULL);
   GNUNET_disk_directory_scan (ectx, dirName, &processFile_, &myCLS);
   GNUNET_free (dirName);
   return myCLS.cnt;

Modified: GNUnet/src/applications/fs/namespace/info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/info.c 2008-05-31 04:34:24 UTC (rev 
6936)
+++ GNUnet/src/applications/fs/namespace/info.c 2008-05-31 04:35:58 UTC (rev 
6937)
@@ -45,7 +45,6 @@
                             unsigned int anonymityLevel,
                             unsigned int insertPriority,
                             GNUNET_CronTime insertExpiration,
-                            const char *namespaceName,
                             const struct GNUNET_ECRS_MetaData *meta,
                             const struct GNUNET_ECRS_URI *advertisementURI,
                             const GNUNET_HashCode * rootEntry)
@@ -55,7 +54,6 @@
 
   ret = GNUNET_ECRS_namespace_create (ectx,
                                       cfg,
-                                      namespaceName,
                                       meta,
                                       anonymityLevel,
                                       insertPriority,
@@ -82,10 +80,8 @@
 {
   int ret;
   char *fn;
-  char *ns_name;
 
-  ns_name = "FIXME";
-  ret = GNUNET_ECRS_namespace_delete (ectx, cfg, ns_name);
+  ret = GNUNET_ECRS_namespace_delete (ectx, cfg, nsid);
   fn = GNUNET_NS_internal_get_data_filename_ (ectx,
                                               cfg, NS_UPDATE_DIR, nsid, NULL);
   GNUNET_disk_directory_remove (ectx, fn);

Modified: GNUnet/src/applications/fs/namespace/update_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/update_info.c  2008-05-31 04:34:24 UTC 
(rev 6936)
+++ GNUnet/src/applications/fs/namespace/update_info.c  2008-05-31 04:35:58 UTC 
(rev 6937)
@@ -260,10 +260,7 @@
   GNUNET_ECRS_FileInfo fi;
   char *old;
   struct GNUNET_ECRS_URI *uri;
-  char *name;
 
-  name = "FIXME";
-
   /* computation of IDs of update(s).  Not as terrible as
      it looks, just enumerating all of the possible cases
      of periodic/sporadic updates and how IDs are computed. */
@@ -367,7 +364,7 @@
     }
   uri = GNUNET_ECRS_namespace_add_content (ectx,
                                            cfg,
-                                           name,
+                                           nsid,
                                            anonymityLevel,
                                            insertPriority,
                                            insertExpiration,

Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c    2008-05-31 04:34:24 UTC 
(rev 6936)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c    2008-05-31 04:35:58 UTC 
(rev 6937)
@@ -373,6 +373,7 @@
   int i;
   char *tmp;
   unsigned long long verbose;
+  GNUNET_HashCode pid;
 
   meta = GNUNET_ECRS_meta_data_create ();
   i = GNUNET_init (argc,
@@ -449,8 +450,11 @@
   /* check arguments */
   if (pseudonym != NULL)
     {
-      if (GNUNET_OK !=
-          GNUNET_ECRS_namespace_test_exists (ectx, cfg, pseudonym, NULL))
+      if ( (GNUNET_OK !=
+           GNUNET_PSEUDO_name_to_id(ectx, cfg,
+                                    pseudonym, &pid)) ||
+          (GNUNET_OK !=
+           GNUNET_ECRS_namespace_test_exists (ectx, cfg, &pid)) )
         {
           printf (_("Could not access namespace `%s' (does not exist?).\n"),
                   pseudonym);

Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-05-31 04:34:24 UTC 
(rev 6936)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-05-31 04:35:58 UTC 
(rev 6937)
@@ -244,21 +244,22 @@
   /* create collections / namespace */
   if (create_name != NULL)
     {
+      GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, create_name);
       if (start_collection)
         {
-          GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_OWNER, create_name);
-          if (GNUNET_OK == GNUNET_CO_collection_start (anonymity, priority, 
GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC, /* FIXME: allow other update policies */
-                                                       create_name, meta))
+         /* FIXME: allow other update policies */
+          if (GNUNET_OK == GNUNET_CO_collection_start (anonymity,
+                                                      priority, 
+                                                      
GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC, 
+                                                       meta))
             {
-              printf (_("Started collection `%s'.\n"), create_name);
+              printf ("%s", _("Started collection.\n"));
             }
           else
             {
-              printf (_("Failed to start collection.\n"));
+              printf ("%s", _("Failed to start collection.\n"));
               success++;
             }
-
-          GNUNET_ECRS_meta_data_delete (meta, EXTRACTOR_OWNER, create_name);
         }
       else
         {                       /* no collection */
@@ -293,12 +294,11 @@
                                                 priority,
                                                 expiration +
                                                 GNUNET_get_time (),
-                                                create_name, meta,
+                                                meta,
                                                 advertisement, &rootEntry);
           if (rootURI == NULL)
             {
-              printf (_("Could not create namespace `%s' (exists?).\n"),
-                      create_name);
+              printf ("%s", _("Could not create namespace.\n"));
               success += 1;
             }
           else
@@ -312,6 +312,7 @@
           if (NULL != advertisement)
             GNUNET_ECRS_uri_destroy (advertisement);
         }
+      GNUNET_ECRS_meta_data_delete (meta, EXTRACTOR_TITLE, create_name);
       GNUNET_free (create_name);
       create_name = NULL;
     }

Modified: GNUnet/src/include/gnunet_collection_lib.h
===================================================================
--- GNUnet/src/include/gnunet_collection_lib.h  2008-05-31 04:34:24 UTC (rev 
6936)
+++ GNUnet/src/include/gnunet_collection_lib.h  2008-05-31 04:35:58 UTC (rev 
6937)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
+     (C) 2004, 2005, 2006, 2008 Christian Grothoff (and other contributing 
authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -56,7 +56,6 @@
 int GNUNET_CO_collection_start (unsigned int anonymityLevel,
                                 unsigned int priority,
                                 GNUNET_Int32Time updateInterval,
-                                const char *name,
                                 const struct GNUNET_ECRS_MetaData *meta);
 
 /**
@@ -66,12 +65,14 @@
  */
 int GNUNET_CO_collection_stop (void);
 
+
 /**
  * Are we using a collection?
  *
- * @return NULL if there is no collection, otherwise its name
+ * @return NULL if there is no collection, otherwise its metadata
  */
-char *GNUNET_CO_collection_get_name (void);
+struct GNUNET_ECRS_MetaData *
+GNUNET_CO_collection_get_name (void);
 
 /**
  * GNUNET_ND_UPLOAD an update of the current collection information to the

Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h        2008-05-31 04:34:24 UTC (rev 
6936)
+++ GNUnet/src/include/gnunet_ecrs_lib.h        2008-05-31 04:35:58 UTC (rev 
6937)
@@ -40,7 +40,7 @@
 #endif
 
 /**
- * Just the version number of the AFS/ESED/ESED2/ECRS implementation.
+ * Version number of the implementation.
  * History:
  *
  * 1.x.x: initial version with triple GNUNET_hash and merkle tree
@@ -392,11 +392,9 @@
  * @return an ECRS URI for the given keywords, NULL
  *  if keywords is not legal (i.e. empty).
  */
-struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_string_to_uri (struct
-                                                           GNUNET_GE_Context
-                                                           *ectx,
-                                                           const char
-                                                           *keywords);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_string_to_uri (struct GNUNET_GE_Context *ectx,
+                                  const char *keywords);
 
 /**
  * Create an ECRS URI from a user-supplied command line of keywords.
@@ -415,13 +413,10 @@
  * @return an ECRS URI for the given keywords, NULL
  *  if keywords is not legal (i.e. empty).
  */
-struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_command_line_to_uri (struct
-                                                                 
GNUNET_GE_Context
-                                                                 *ectx,
-                                                                 unsigned int
-                                                                 argc,
-                                                                 const char
-                                                                 **argv);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_command_line_to_uri (struct GNUNET_GE_Context *ectx,
+                                        unsigned int argc,
+                                        const char**argv);
 
 /**
  * Test if two URIs are equal.
@@ -549,8 +544,18 @@
  * @return GNUNET_SYSERR if the upload failed (i.e. not enough space
  *  or gnunetd not running)
  */
-int GNUNET_ECRS_file_upload (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const char *filename, int doIndex, unsigned int 
anonymityLevel, unsigned int priority, GNUNET_CronTime expirationTime,        
/* absolute time */
-                             GNUNET_ECRS_UploadProgressCallback upcb, void 
*upcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure, struct 
GNUNET_ECRS_URI **uri);  /* upload.c */
+int GNUNET_ECRS_file_upload (struct GNUNET_GE_Context *ectx, 
+                            struct GNUNET_GC_Configuration *cfg,
+                            const char *filename, 
+                            int doIndex, 
+                            unsigned int anonymityLevel, 
+                            unsigned int priority, 
+                            GNUNET_CronTime expirationTime,
+                             GNUNET_ECRS_UploadProgressCallback upcb,
+                            void *upcbClosure, 
+                            GNUNET_ECRS_TestTerminate tt, 
+                            void *ttClosure, 
+                            struct GNUNET_ECRS_URI **uri);
 
 /**
  * Test if a file is indexed.
@@ -592,7 +597,13 @@
  *
  * @return GNUNET_SYSERR if the unindexing failed (i.e. not indexed)
  */
-int GNUNET_ECRS_file_unindex (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const char *filename, 
GNUNET_ECRS_UploadProgressCallback upcb, void *upcbClosure, 
GNUNET_ECRS_TestTerminate tt, void *ttClosure);    /* unindex.c */
+int GNUNET_ECRS_file_unindex (struct GNUNET_GE_Context *ectx,
+                             struct GNUNET_GC_Configuration *cfg,
+                             const char *filename, 
+                             GNUNET_ECRS_UploadProgressCallback upcb, 
+                             void *upcbClosure, 
+                             GNUNET_ECRS_TestTerminate tt,
+                             void *ttClosure);
 
 
 /**
@@ -615,35 +626,23 @@
  *
  * @return URI on success, NULL on error (namespace already exists)
  */
-struct GNUNET_ECRS_URI *GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context
-                                                      *ectx,
-                                                      struct
-                                                      GNUNET_GC_Configuration
-                                                      *cfg, const char *name,
-                                                      const struct
-                                                      GNUNET_ECRS_MetaData
-                                                      *meta,
-                                                      unsigned int
-                                                      anonymityLevel,
-                                                      unsigned int priority,
-                                                      GNUNET_CronTime
-                                                      expiration,
-                                                      const struct
-                                                      GNUNET_ECRS_URI
-                                                      *advertisementURI,
-                                                      const GNUNET_HashCode *
-                                                      rootEntry);
-                              /* namespace.c */
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context*ectx,
+                             struct GNUNET_GC_Configuration*cfg,
+                             const struct GNUNET_ECRS_MetaData *meta,
+                             unsigned int anonymityLevel,
+                             unsigned int priority,
+                             GNUNET_CronTime expiration,
+                             const struct GNUNET_ECRS_URI *advertisementURI,
+                             const GNUNET_HashCode *rootEntry);
 
 /**
  * Check if the given namespace exists (locally).
- * @param hc if non-null, also check that this is the
- *   hc of the public key
+ *
  * @return GNUNET_OK if the namespace exists, GNUNET_SYSERR if not
  */
 int GNUNET_ECRS_namespace_test_exists (struct GNUNET_GE_Context *ectx,
                                        struct GNUNET_GC_Configuration *cfg,
-                                       const char *name,
                                        const GNUNET_HashCode * hc);
 
 /**
@@ -653,7 +652,9 @@
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
-int GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const char *namespaceName);      /* namespace.c */
+int GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx, 
+                                 struct GNUNET_GC_Configuration *cfg, 
+                                 const GNUNET_HashCode * pid);
 
 /**
  * Callback with information about local (!) namespaces.
@@ -672,48 +673,33 @@
  * @param list where to store the names (is allocated, caller frees)
  * @return GNUNET_SYSERR on error, otherwise the number of pseudonyms in list
  */
-int GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, GNUNET_ECRS_NamespaceInfoProcessor cb, void 
*cls); /* namespace.c */
+int GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx,
+                               struct GNUNET_GC_Configuration *cfg, 
+                               GNUNET_ECRS_NamespaceInfoProcessor cb, 
+                               void *cls);
 
 /**
  * Add an entry into a namespace.
  *
- * @param name in which namespace to publish, use just the
- *        nickname of the namespace
+ * @param pid in which namespace to publish
  * @param dst to which URI should the namespace entry refer?
  * @param md what meta-data should be associated with the
  *        entry?
  * @return URI on success, NULL on error
  */
-struct GNUNET_ECRS_URI *GNUNET_ECRS_namespace_add_content (struct
-                                                           GNUNET_GE_Context
-                                                           *ectx,
-                                                           struct
-                                                           
GNUNET_GC_Configuration
-                                                           *cfg,
-                                                           const char *name,
-                                                           unsigned int
-                                                           anonymityLevel,
-                                                           unsigned int
-                                                           priority,
-                                                           GNUNET_CronTime
-                                                           expirationTime,
-                                                           GNUNET_Int32Time
-                                                           creationTime,
-                                                           GNUNET_Int32Time
-                                                           updateInterval,
-                                                           const
-                                                           GNUNET_HashCode *
-                                                           thisId,
-                                                           const
-                                                           GNUNET_HashCode *
-                                                           nextId,
-                                                           const struct
-                                                           GNUNET_ECRS_URI
-                                                           *dst,
-                                                           const struct
-                                                           GNUNET_ECRS_MetaData
-                                                           *md);
-                                   /* namespace.c */
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx,
+                                  struct GNUNET_GC_Configuration *cfg,
+                                  const GNUNET_HashCode * pid,
+                                  unsigned int anonymityLevel,
+                                  unsigned int priority,
+                                  GNUNET_CronTime expirationTime,
+                                  GNUNET_Int32Time creationTime,
+                                  GNUNET_Int32Time updateInterval,
+                                  const GNUNET_HashCode *thisId,
+                                  const GNUNET_HashCode *nextId,
+                                  const struct GNUNET_ECRS_URI *dst,
+                                  const struct GNUNET_ECRS_MetaData *md);
 
 /**
  * Add an entry into the K-space (keyword space).
@@ -732,7 +718,6 @@
                                        GNUNET_CronTime expirationTime,
                                        const struct GNUNET_ECRS_URI *dst,
                                        const struct GNUNET_ECRS_MetaData *md);
-                                       /* keyspace.c */
 
 /**
  * The search has found another result.  Callback to notify
@@ -758,7 +743,13 @@
  *        this must be a simple URI (with a single
  *        keyword)
  */
-struct GNUNET_ECRS_SearchContext *GNUNET_ECRS_search_start (struct 
GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration *cfg, const struct 
GNUNET_ECRS_URI *uri, unsigned int anonymityLevel, 
GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure);    /* search.c */
+struct GNUNET_ECRS_SearchContext *
+GNUNET_ECRS_search_start (struct GNUNET_GE_Context *ectx,
+                         struct GNUNET_GC_Configuration *cfg,
+                         const struct GNUNET_ECRS_URI *uri, 
+                         unsigned int anonymityLevel, 
+                         GNUNET_ECRS_SearchResultProcessor spcb,
+                         void *spcbClosure);
 
 /**
  * Stop search for content.
@@ -774,7 +765,14 @@
  * @param uri specifies the search parameters
  * @param uri set to the URI of the uploaded file
  */
-int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, unsigned int 
anonymityLevel, GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure, 
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* search.c */
+int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx, 
+                       struct GNUNET_GC_Configuration *cfg,
+                       const struct GNUNET_ECRS_URI *uri, 
+                       unsigned int anonymityLevel, 
+                       GNUNET_ECRS_SearchResultProcessor spcb,
+                       void *spcbClosure, 
+                       GNUNET_ECRS_TestTerminate tt,
+                       void *ttClosure);
 
 /**
  * Notification of ECRS to a client about the progress of an insertion
@@ -848,7 +846,15 @@
  * @param uri the URI of the file (determines what to download)
  * @param filename where to store the file
  */
-int GNUNET_ECRS_file_download (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, const char 
*filename, unsigned int anonymityLevel, GNUNET_ECRS_DownloadProgressCallback 
dpcb, void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* 
download.c */
+int GNUNET_ECRS_file_download (struct GNUNET_GE_Context *ectx,
+                              struct GNUNET_GC_Configuration *cfg,
+                              const struct GNUNET_ECRS_URI *uri, 
+                              const char *filename, 
+                              unsigned int anonymityLevel,
+                              GNUNET_ECRS_DownloadProgressCallback dpcb,
+                              void *dpcbClosure,
+                              GNUNET_ECRS_TestTerminate tt, 
+                              void *ttClosure);
 
 /**
  * DOWNLOAD parts of a file.  Note that this will store
@@ -869,7 +875,18 @@
  * @param start starting offset
  * @param length length of the download (starting at offset)
  */
-int GNUNET_ECRS_file_download_partial (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, const char 
*filename, unsigned long long offset, unsigned long long length, unsigned int 
anonymityLevel, int no_temporaries, GNUNET_ECRS_DownloadProgressCallback dpcb, 
void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure);       /* 
download.c */
+int GNUNET_ECRS_file_download_partial (struct GNUNET_GE_Context *ectx, 
+                                      struct GNUNET_GC_Configuration *cfg, 
+                                      const struct GNUNET_ECRS_URI *uri, 
+                                      const char *filename, 
+                                      unsigned long long offset,
+                                      unsigned long long length,
+                                      unsigned int anonymityLevel,
+                                      int no_temporaries, 
+                                      GNUNET_ECRS_DownloadProgressCallback 
dpcb, 
+                                      void *dpcbClosure, 
+                                      GNUNET_ECRS_TestTerminate tt,
+                                      void *ttClosure);
 
 /**
  * Iterate over all entries in a directory.  Note that directories
@@ -885,7 +902,12 @@
  * @return number of entries on success, GNUNET_SYSERR if the
  *         directory is malformed
  */
-int GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx, const 
char *data, unsigned long long len, struct GNUNET_ECRS_MetaData **md, 
GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure);        /* 
directory.c */
+int GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx,
+                                        const char *data,
+                                        unsigned long long len, 
+                                        struct GNUNET_ECRS_MetaData **md, 
+                                        GNUNET_ECRS_SearchResultProcessor 
spcb, 
+                                        void *spcbClosure);
 
 /**
  * Create a directory.
@@ -906,8 +928,8 @@
                                   unsigned int count,
                                   const GNUNET_ECRS_FileInfo * fis,
                                   struct GNUNET_ECRS_MetaData *meta);
-                                  /* directory.c */
 
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif

Modified: GNUnet/src/include/gnunet_namespace_lib.h
===================================================================
--- GNUnet/src/include/gnunet_namespace_lib.h   2008-05-31 04:34:24 UTC (rev 
6936)
+++ GNUnet/src/include/gnunet_namespace_lib.h   2008-05-31 04:35:58 UTC (rev 
6937)
@@ -65,26 +65,15 @@
  * @param meta meta-data about the namespace (maybe NULL)
  * @return URI on success, NULL on error (namespace already exists)
  */
-struct GNUNET_ECRS_URI *GNUNET_NS_namespace_create (struct GNUNET_GE_Context
-                                                    *ectx,
-                                                    struct
-                                                    GNUNET_GC_Configuration
-                                                    *cfg,
-                                                    unsigned int
-                                                    anonymityLevel,
-                                                    unsigned int
-                                                    insertPriority,
-                                                    GNUNET_CronTime
-                                                    insertExpiration,
-                                                    const char *namespaceName,
-                                                    const struct
-                                                    GNUNET_ECRS_MetaData
-                                                    *meta,
-                                                    const struct
-                                                    GNUNET_ECRS_URI
-                                                    *advertisementURI,
-                                                    const GNUNET_HashCode *
-                                                    rootEntry);
+struct GNUNET_ECRS_URI *
+GNUNET_NS_namespace_create (struct GNUNET_GE_Context *ectx,
+                           struct GNUNET_GC_Configuration *cfg,
+                           unsigned int anonymityLevel,
+                           unsigned int insertPriority,
+                           GNUNET_CronTime insertExpiration,
+                           const struct GNUNET_ECRS_MetaData *meta,
+                           const struct GNUNET_ECRS_URI*advertisementURI,
+                           const GNUNET_HashCode *rootEntry);
 
 /**
  * Delete a local namespace.  Only prevents future insertions into the
@@ -148,7 +137,19 @@
  *        entry?
  * @return the resulting URI, NULL on error
  */
-struct GNUNET_ECRS_URI *GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context 
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel, 
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const 
GNUNET_HashCode * nsid, GNUNET_Int32Time updateInterval, const GNUNET_HashCode 
* lastId, const GNUNET_HashCode * thisId, const GNUNET_HashCode * nextId, const 
struct GNUNET_ECRS_URI *dst, const struct GNUNET_ECRS_MetaData *md);  /* 
update_info.c */
+struct GNUNET_ECRS_URI *
+GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context *ectx,
+                           struct GNUNET_GC_Configuration *cfg,
+                           unsigned int anonymityLevel, 
+                           unsigned int insertPriority, 
+                           GNUNET_CronTime insertExpiration, 
+                           const GNUNET_HashCode * nsid,
+                           GNUNET_Int32Time updateInterval, 
+                           const GNUNET_HashCode * lastId, 
+                           const GNUNET_HashCode * thisId, 
+                           const GNUNET_HashCode * nextId, 
+                           const struct GNUNET_ECRS_URI *dst, 
+                           const struct GNUNET_ECRS_MetaData *md);
 
 /**
  * Compute the next ID for peridodically updated content.
@@ -167,19 +168,20 @@
 /**
  * List all updateable content in a given namespace.
  */
-int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx, struct 
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid, 
GNUNET_NS_UpdateIterator iterator, void *closure);    /* namespace_info.c */
+int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx, 
+                                      struct GNUNET_GC_Configuration *cfg,
+                                      const GNUNET_HashCode * nsid, 
+                                      GNUNET_NS_UpdateIterator iterator, 
+                                      void *closure);
 
 /**
  * Convert namespace URI to a human readable format
  * (using the namespace description, if available).
  */
-char *GNUNET_NS_sks_uri_to_human_readable_string (struct GNUNET_GE_Context
-                                                  *ectx,
-                                                  struct
-                                                  GNUNET_GC_Configuration
-                                                  *cfg,
-                                                  const struct GNUNET_ECRS_URI
-                                                  *uri);
+char *
+GNUNET_NS_sks_uri_to_human_readable_string (struct GNUNET_GE_Context *ectx,
+                                           struct GNUNET_GC_Configuration*cfg,
+                                           const struct GNUNET_ECRS_URI *uri);
 
 
 

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-05-31 04:34:24 UTC (rev 6936)
+++ GNUnet/todo 2008-05-31 04:35:58 UTC (rev 6937)
@@ -10,8 +10,6 @@
     => rather: use pseudo's mapping (used already in gnunet-insert, etc!)
     => need to inform user creating pseudonym about mapped name!!!
   + need better / actual / compiling testcase!
-  + FSUI: compile errors!
-  + tools: compile errors!
 - chat:  [RC]
   + adapt gnunet-chat for new client api 
     => add support for new options (private msg, anon msg, confirmation)





reply via email to

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