gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11059 - in gnunet: . src src/datacache src/datastore src/f


From: gnunet
Subject: [GNUnet-SVN] r11059 - in gnunet: . src src/datacache src/datastore src/fs src/include src/migration src/topology src/util
Date: Sat, 24 Apr 2010 15:08:05 +0200

Author: grothoff
Date: 2010-04-24 15:08:05 +0200 (Sat, 24 Apr 2010)
New Revision: 11059

Added:
   gnunet/src/migration/
   gnunet/src/migration/Makefile.am
   gnunet/src/migration/gnunet-daemon-migration
   gnunet/src/migration/gnunet-daemon-migration.c
   gnunet/src/migration/test_gnunet_daemon_migration.c
   gnunet/src/migration/test_gnunet_daemon_migration_data.conf
   gnunet/src/topology/test_gnunet_daemon_topology.c
   gnunet/src/topology/test_gnunet_daemon_topology_data.conf
Removed:
   gnunet/src/topology/test_gnunet_service_topology.c
   gnunet/src/topology/test_gnunet_service_topology_data.conf
Modified:
   gnunet/TODO
   gnunet/configure.ac
   gnunet/src/Makefile.am
   gnunet/src/datacache/datacache.c
   gnunet/src/datacache/perf_datacache.c
   gnunet/src/datacache/plugin_datacache.h
   gnunet/src/datacache/plugin_datacache_sqlite.c
   gnunet/src/datacache/plugin_datacache_template.c
   gnunet/src/datacache/test_datacache.c
   gnunet/src/datastore/datastore_api.c
   gnunet/src/datastore/gnunet-service-datastore.c
   gnunet/src/datastore/perf_datastore_api.c
   gnunet/src/datastore/perf_plugin_datastore.c
   gnunet/src/datastore/plugin_datastore.h
   gnunet/src/datastore/plugin_datastore_sqlite.c
   gnunet/src/datastore/plugin_datastore_template.c
   gnunet/src/datastore/test_datastore_api.c
   gnunet/src/datastore/test_datastore_api_management.c
   gnunet/src/fs/Makefile.am
   gnunet/src/fs/fs.h
   gnunet/src/fs/fs_download.c
   gnunet/src/fs/fs_namespace.c
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/fs_search.c
   gnunet/src/fs/fs_tree.c
   gnunet/src/fs/fs_tree.h
   gnunet/src/fs/fs_unindex.c
   gnunet/src/fs/gnunet-service-fs.c
   gnunet/src/fs/gnunet-service-fs_drq.c
   gnunet/src/fs/gnunet-service-fs_drq.h
   gnunet/src/fs/gnunet-service-fs_indexing.c
   gnunet/src/fs/gnunet-service-fs_indexing.h
   gnunet/src/include/gnunet_datacache_lib.h
   gnunet/src/include/gnunet_datastore_service.h
   gnunet/src/include/gnunet_dht_service.h
   gnunet/src/topology/Makefile.am
   gnunet/src/util/test_resolver_api.c
Log:
off-line hack fest

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/TODO 2010-04-24 13:08:05 UTC (rev 11059)
@@ -1,11 +1,17 @@
 0.9.0pre1:
+* MIGRATION [CG]
+  - on-demand encoding => move logic to block-library!?
+  - peer selection => how to consider latency/bw/etc?
+  - content transmission => how often the same block?
+  - how to select delay before next migration? 
+  - testing
 * FS: [CG]
+  - migration (inbound)
+  - support for in-line files in directories (FIXME in fs_download)
   - bound parallelism (# fs downloads)
   - distinguish in performance tracking and event signalling between
     downloads that are actually running and those that are merely in the queue
   - persistence support (publish, unindex, search, download)
-  - active migration support (in fs or in datastore or new daemon?)
-  - support for in-line files in directories (FIXME in fs_download)
   - gnunet-service-fs (hot-path routing, load-based routing, nitpicks)  
   - [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is 
never used
   - [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is 
never used
@@ -76,6 +82,8 @@
     + download
     + search
     + unindex
+* MIGRATION:
+  - improved content selection (not just 'get_random')
 
 0.9.0pre3:
 * Determine RC bugs and fix those!
@@ -183,4 +191,5 @@
   - add stats (# bytes available, # bytes used, # PUTs, # GETs, # GETs 
satisfied)
 * FS:
   - support inline data in directories for recursive file downloads 
(fs_download)
-
+* BLOCKS:
+  - testcase would be nice...

Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/configure.ac 2010-04-24 13:08:05 UTC (rev 11059)
@@ -645,6 +645,7 @@
 po/Makefile.in 
 src/Makefile
 src/arm/Makefile
+src/block/Makefile
 src/core/Makefile
 src/datacache/Makefile
 src/datastore/Makefile
@@ -656,6 +657,7 @@
 src/include/Makefile
 src/include/gnunet_directories.h
 src/hostlist/Makefile
+src/migration/Makefile
 src/nat/Makefile
 src/nat/libnatpmp/Makefile
 src/nat/miniupnp/Makefile

Modified: gnunet/src/Makefile.am
===================================================================
--- gnunet/src/Makefile.am      2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/Makefile.am      2010-04-24 13:08:05 UTC (rev 11059)
@@ -9,6 +9,7 @@
 SUBDIRS = \
   include $(INTLEMU_SUBDIRS) \
   util \
+  block \
   statistics \
   arm \
   hello \
@@ -23,4 +24,5 @@
   hostlist \
   topology \
   $(NAT_DIR) \
-  fs
+  fs \
+  migration

Modified: gnunet/src/datacache/datacache.c
===================================================================
--- gnunet/src/datacache/datacache.c    2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/datacache/datacache.c    2010-04-24 13:08:05 UTC (rev 11059)
@@ -224,7 +224,7 @@
                      const GNUNET_HashCode * key,
                      uint32_t size,
                      const char *data,
-                     unsigned int type,
+                     enum GNUNET_BLOCK_Type type,
                      struct GNUNET_TIME_Absolute discard_time)
 {
   uint32_t used;
@@ -259,7 +259,7 @@
 unsigned int 
 GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
                      const GNUNET_HashCode * key,
-                     unsigned int type, 
+                     enum GNUNET_BLOCK_Type type, 
                      GNUNET_DATACACHE_Iterator iter,
                      void *iter_cls)
 {

Modified: gnunet/src/datacache/perf_datacache.c
===================================================================
--- gnunet/src/datacache/perf_datacache.c       2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datacache/perf_datacache.c       2010-04-24 13:08:05 UTC (rev 
11059)
@@ -42,7 +42,7 @@
         const GNUNET_HashCode * key,
          uint32_t size, 
         const char *data, 
-        uint32_t type)
+        enum GNUNET_BLOCK_Type type)
 {
   if ( (size == sizeof (GNUNET_HashCode)) &&
        (0 == memcmp (data, cls, size)) )

Modified: gnunet/src/datacache/plugin_datacache.h
===================================================================
--- gnunet/src/datacache/plugin_datacache.h     2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datacache/plugin_datacache.h     2010-04-24 13:08:05 UTC (rev 
11059)
@@ -116,7 +116,7 @@
                   const GNUNET_HashCode * key,
                   uint32_t size,
                   const char *data,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   struct GNUNET_TIME_Absolute discard_time);
 
 
@@ -133,7 +133,7 @@
    */
   unsigned int (*get) (void *cls,
                       const GNUNET_HashCode * key,
-                      uint32_t type,
+                      enum GNUNET_BLOCK_Type type,
                       GNUNET_DATACACHE_Iterator iter,
                       void *iter_cls);
 

Modified: gnunet/src/datacache/plugin_datacache_sqlite.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_sqlite.c      2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/datacache/plugin_datacache_sqlite.c      2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -99,7 +99,7 @@
                   const GNUNET_HashCode * key,
                   uint32_t size,
                   const char *data,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   struct GNUNET_TIME_Absolute discard_time)
 {
   struct Plugin *plugin = cls;
@@ -166,7 +166,7 @@
 static unsigned int 
 sqlite_plugin_get (void *cls,
                   const GNUNET_HashCode * key,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   GNUNET_DATACACHE_Iterator iter,
                   void *iter_cls)
 {

Modified: gnunet/src/datacache/plugin_datacache_template.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_template.c    2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/datacache/plugin_datacache_template.c    2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -56,7 +56,7 @@
                     const GNUNET_HashCode * key,
                     uint32_t size,
                     const char *data,
-                    uint32_t type,
+                    enum GNUNET_BLOCK_Type type,
                     struct GNUNET_TIME_Absolute discard_time)
 {
   GNUNET_break (0);
@@ -78,7 +78,7 @@
 static unsigned int 
 template_plugin_get (void *cls,
                     const GNUNET_HashCode * key,
-                    uint32_t type,
+                    enum GNUNET_BLOCK_Type type,
                     GNUNET_DATACACHE_Iterator iter,
                     void *iter_cls)
 {

Modified: gnunet/src/datacache/test_datacache.c
===================================================================
--- gnunet/src/datacache/test_datacache.c       2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datacache/test_datacache.c       2010-04-24 13:08:05 UTC (rev 
11059)
@@ -39,7 +39,7 @@
         const GNUNET_HashCode * key,
          uint32_t size, 
         const char *data, 
-        uint32_t type)
+        enum GNUNET_BLOCK_Type type)
 {
   if (size != sizeof (GNUNET_HashCode))
     {

Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c        2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datastore/datastore_api.c        2010-04-24 13:08:05 UTC (rev 
11059)
@@ -319,7 +319,7 @@
                       const GNUNET_HashCode * key,
                       uint32_t size,
                       const void *data,
-                      uint32_t type,
+                      enum GNUNET_BLOCK_Type type,
                       uint32_t priority,
                       uint32_t anonymity,
                       struct GNUNET_TIME_Absolute expiration,
@@ -668,7 +668,7 @@
 void
 GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h,
                       const GNUNET_HashCode * key,
-                      uint32_t type,
+                      enum GNUNET_BLOCK_Type type,
                       GNUNET_DATASTORE_Iterator iter, void *iter_cls,
                      struct GNUNET_TIME_Relative timeout)
 {

Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c     2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/datastore/gnunet-service-datastore.c     2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -288,7 +288,7 @@
                   const GNUNET_HashCode * key,
                   uint32_t size,
                   const void *data,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   uint32_t priority,
                   uint32_t anonymity,
                   struct GNUNET_TIME_Absolute
@@ -375,7 +375,7 @@
        const GNUNET_HashCode * key,
        uint32_t size,
        const void *data,
-       uint32_t type,
+       enum GNUNET_BLOCK_Type type,
        uint32_t priority,
        uint32_t anonymity,
        struct GNUNET_TIME_Absolute
@@ -644,7 +644,7 @@
               const GNUNET_HashCode * key,
               uint32_t size,
               const void *data,
-              uint32_t type,
+              enum GNUNET_BLOCK_Type type,
               uint32_t priority,
               uint32_t anonymity,
               struct GNUNET_TIME_Absolute
@@ -1094,7 +1094,7 @@
                 const GNUNET_HashCode * key,
                 uint32_t size,
                 const void *data,
-                uint32_t type,
+                enum GNUNET_BLOCK_Type type,
                 uint32_t priority,
                 uint32_t anonymity,
                 struct GNUNET_TIME_Absolute

Modified: gnunet/src/datastore/perf_datastore_api.c
===================================================================
--- gnunet/src/datastore/perf_datastore_api.c   2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datastore/perf_datastore_api.c   2010-04-24 13:08:05 UTC (rev 
11059)
@@ -198,7 +198,7 @@
              const GNUNET_HashCode * key,
              uint32_t size,
              const void *data,
-             uint32_t type,
+             enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
              struct GNUNET_TIME_Absolute

Modified: gnunet/src/datastore/perf_plugin_datastore.c
===================================================================
--- gnunet/src/datastore/perf_plugin_datastore.c        2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/datastore/perf_plugin_datastore.c        2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -140,7 +140,7 @@
              const GNUNET_HashCode * key,
              uint32_t size,
              const void *data,
-             uint32_t type,
+             enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
              struct GNUNET_TIME_Absolute

Modified: gnunet/src/datastore/plugin_datastore.h
===================================================================
--- gnunet/src/datastore/plugin_datastore.h     2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datastore/plugin_datastore.h     2010-04-24 13:08:05 UTC (rev 
11059)
@@ -30,6 +30,7 @@
 #ifndef PLUGIN_DATASTORE_H
 #define PLUGIN_DATASTORE_H
 
+#include "gnunet_block_lib.h"
 #include "gnunet_configuration_lib.h"
 #include "gnunet_datastore_service.h"
 #include "gnunet_statistics_service.h"
@@ -103,7 +104,7 @@
                               const GNUNET_HashCode * key,
                               uint32_t size,
                               const void *data,
-                              uint32_t type,
+                              enum GNUNET_BLOCK_Type type,
                               uint32_t priority,
                               uint32_t anonymity,
                               struct GNUNET_TIME_Absolute
@@ -142,7 +143,7 @@
                          const GNUNET_HashCode * key,
                          uint32_t size,
                          const void *data,
-                         uint32_t type,
+                         enum GNUNET_BLOCK_Type type,
                          uint32_t priority,
                          uint32_t anonymity,
                          struct GNUNET_TIME_Absolute expiration,
@@ -173,7 +174,7 @@
 typedef void (*PluginGet) (void *cls,
                           const GNUNET_HashCode * key,
                           const GNUNET_HashCode * vhash,
-                          uint32_t type,
+                          enum GNUNET_BLOCK_Type type,
                           PluginIterator iter, void *iter_cls);
 
 
@@ -222,7 +223,7 @@
  * @param iter_cls closure for iter
  */
 typedef void (*PluginSelector) (void *cls,
-                                uint32_t type,
+                                enum GNUNET_BLOCK_Type type,
                                 PluginIterator iter,
                                 void *iter_cls);
 

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -719,7 +719,7 @@
                   const GNUNET_HashCode * key,
                   uint32_t size,
                   const void *data,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   uint32_t priority,
                   uint32_t anonymity,
                   struct GNUNET_TIME_Absolute expiration,
@@ -892,7 +892,7 @@
   /**
    * Desired type for blocks returned by this iterator.
    */
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 };
 
 
@@ -1026,7 +1026,7 @@
  */
 static void
 basic_iter (struct Plugin *plugin,
-           uint32_t type,
+           enum GNUNET_BLOCK_Type type,
            int is_asc,
            int is_prio,
            int is_migr,
@@ -1110,7 +1110,7 @@
  */
 static void
 sqlite_plugin_iter_low_priority (void *cls,
-                                uint32_t type,
+                                enum GNUNET_BLOCK_Type type,
                                 PluginIterator iter,
                                 void *iter_cls)
 {
@@ -1137,7 +1137,7 @@
  */
 static void
 sqlite_plugin_iter_zero_anonymity (void *cls,
-                                  uint32_t type,
+                                  enum GNUNET_BLOCK_Type type,
                                   PluginIterator iter,
                                   void *iter_cls)
 {
@@ -1176,7 +1176,7 @@
  */
 static void
 sqlite_plugin_iter_ascending_expiration (void *cls,
-                                        uint32_t type,
+                                        enum GNUNET_BLOCK_Type type,
                                         PluginIterator iter,
                                         void *iter_cls)
 {
@@ -1213,7 +1213,7 @@
  */
 static void
 sqlite_plugin_iter_migration_order (void *cls,
-                                   uint32_t type,
+                                   enum GNUNET_BLOCK_Type type,
                                    PluginIterator iter,
                                    void *iter_cls)
 {
@@ -1288,7 +1288,7 @@
  */
 static void
 sqlite_plugin_iter_all_now (void *cls,
-                           uint32_t type,
+                           enum GNUNET_BLOCK_Type type,
                            PluginIterator iter,
                            void *iter_cls)
 {
@@ -1439,7 +1439,7 @@
 sqlite_plugin_get (void *cls,
                   const GNUNET_HashCode * key,
                   const GNUNET_HashCode * vhash,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   PluginIterator iter, void *iter_cls)
 {
   struct Plugin *plugin = cls;

Modified: gnunet/src/datastore/plugin_datastore_template.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_template.c    2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/datastore/plugin_datastore_template.c    2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -70,12 +70,12 @@
  */
 static int
 template_plugin_put (void *cls,
-                  const GNUNET_HashCode * key,
-                  uint32_t size,
-                  const void *data,
-                  uint32_t type,
-                  uint32_t priority,
-                  uint32_t anonymity,
+                    const GNUNET_HashCode * key,
+                    uint32_t size,
+                    const void *data,
+                    enum GNUNET_BLOCK_Type type,
+                    uint32_t priority,
+                    uint32_t anonymity,
                     struct GNUNET_TIME_Absolute expiration,
                     char **msg)
 {
@@ -126,7 +126,7 @@
 template_plugin_get (void *cls,
                     const GNUNET_HashCode * key,
                     const GNUNET_HashCode * vhash,
-                    uint32_t type,
+                    enum GNUNET_BLOCK_Type type,
                     PluginIterator iter, void *iter_cls)
 {
   GNUNET_break (0);
@@ -181,7 +181,7 @@
  */
 static void
 template_plugin_iter_low_priority (void *cls,
-                                  uint32_t type,
+                                  enum GNUNET_BLOCK_Type type,
                                   PluginIterator iter,
                                   void *iter_cls)
 {
@@ -203,9 +203,9 @@
  */
 static void
 template_plugin_iter_zero_anonymity (void *cls,
-                       uint32_t type,
-                       PluginIterator iter,
-                       void *iter_cls)
+                                    enum GNUNET_BLOCK_Type type,
+                                    PluginIterator iter,
+                                    void *iter_cls)
 {
   GNUNET_break (0);
 }
@@ -225,9 +225,9 @@
  */
 static void
 template_plugin_iter_ascending_expiration (void *cls,
-                       uint32_t type,
-                       PluginIterator iter,
-                       void *iter_cls)
+                                          enum GNUNET_BLOCK_Type type,
+                                          PluginIterator iter,
+                                          void *iter_cls)
 {
   GNUNET_break (0);
 }
@@ -247,9 +247,9 @@
  */
 static void
 template_plugin_iter_migration_order (void *cls,
-                       uint32_t type,
-                       PluginIterator iter,
-                       void *iter_cls)
+                                     enum GNUNET_BLOCK_Type type,
+                                     PluginIterator iter,
+                                     void *iter_cls)
 {
   GNUNET_break (0);
 }
@@ -269,9 +269,9 @@
  */
 static void
 template_plugin_iter_all_now (void *cls,
-                       uint32_t type,
-                       PluginIterator iter,
-                       void *iter_cls)
+                             enum GNUNET_BLOCK_Type type,
+                             PluginIterator iter,
+                             void *iter_cls)
 {
   GNUNET_break (0);
 }

Modified: gnunet/src/datastore/test_datastore_api.c
===================================================================
--- gnunet/src/datastore/test_datastore_api.c   2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/datastore/test_datastore_api.c   2010-04-24 13:08:05 UTC (rev 
11059)
@@ -174,7 +174,7 @@
             const GNUNET_HashCode * key,
             uint32_t size,
             const void *data,
-            uint32_t type,
+            enum GNUNET_BLOCK_Type type,
             uint32_t priority,
             uint32_t anonymity,
             struct GNUNET_TIME_Absolute
@@ -209,14 +209,14 @@
 
 static void 
 delete_value (void *cls,
-            const GNUNET_HashCode * key,
-            uint32_t size,
-            const void *data,
-            uint32_t type,
-            uint32_t priority,
-            uint32_t anonymity,
-            struct GNUNET_TIME_Absolute
-            expiration, uint64_t uid)
+             const GNUNET_HashCode * key,
+             uint32_t size,
+             const void *data,
+             enum GNUNET_BLOCK_Type type,
+             uint32_t priority,
+             uint32_t anonymity,
+             struct GNUNET_TIME_Absolute
+             expiration, uint64_t uid)
 {
   struct CpsRunContext *crc = cls;
   if (key == NULL)
@@ -239,14 +239,14 @@
 
 static void 
 check_nothing (void *cls,
-            const GNUNET_HashCode * key,
-            uint32_t size,
-            const void *data,
-            uint32_t type,
-            uint32_t priority,
-            uint32_t anonymity,
-            struct GNUNET_TIME_Absolute
-            expiration, uint64_t uid)
+              const GNUNET_HashCode * key,
+              uint32_t size,
+              const void *data,
+              enum GNUNET_BLOCK_Type type,
+              uint32_t priority,
+              uint32_t anonymity,
+              struct GNUNET_TIME_Absolute
+              expiration, uint64_t uid)
 {
   struct CpsRunContext *crc = cls;
   GNUNET_assert (key == NULL);
@@ -266,7 +266,7 @@
                const GNUNET_HashCode * key,
                uint32_t size,
                const void *data,
-               uint32_t type,
+               enum GNUNET_BLOCK_Type type,
                uint32_t priority,
                uint32_t anonymity,
                struct GNUNET_TIME_Absolute
@@ -296,7 +296,7 @@
              const GNUNET_HashCode * key,
              uint32_t size,
              const void *data,
-             uint32_t type,
+             enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
              struct GNUNET_TIME_Absolute

Modified: gnunet/src/datastore/test_datastore_api_management.c
===================================================================
--- gnunet/src/datastore/test_datastore_api_management.c        2010-04-23 
13:19:24 UTC (rev 11058)
+++ gnunet/src/datastore/test_datastore_api_management.c        2010-04-24 
13:08:05 UTC (rev 11059)
@@ -144,7 +144,7 @@
             const GNUNET_HashCode * key,
             uint32_t size,
             const void *data,
-            uint32_t type,
+            enum GNUNET_BLOCK_Type type,
             uint32_t priority,
             uint32_t anonymity,
             struct GNUNET_TIME_Absolute
@@ -189,14 +189,14 @@
 
 static void 
 check_nothing (void *cls,
-            const GNUNET_HashCode * key,
-            uint32_t size,
-            const void *data,
-            uint32_t type,
-            uint32_t priority,
-            uint32_t anonymity,
-            struct GNUNET_TIME_Absolute
-            expiration, uint64_t uid)
+              const GNUNET_HashCode * key,
+              uint32_t size,
+              const void *data,
+              enum GNUNET_BLOCK_Type type,
+              uint32_t priority,
+              uint32_t anonymity,
+              struct GNUNET_TIME_Absolute
+              expiration, uint64_t uid)
 {
   struct CpsRunContext *crc = cls;
 

Modified: gnunet/src/fs/Makefile.am
===================================================================
--- gnunet/src/fs/Makefile.am   2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/Makefile.am   2010-04-24 13:08:05 UTC (rev 11059)
@@ -98,6 +98,7 @@
  gnunet-service-fs_indexing.c gnunet-service-fs_indexing.h 
 gnunet_service_fs_LDADD =  \
  $(top_builddir)/src/fs/libgnunetfs.la \
+ $(top_builddir)/src/block/libgnunetblock.la \
  $(top_builddir)/src/datastore/libgnunetdatastore.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
  $(top_builddir)/src/core/libgnunetcore.la \

Modified: gnunet/src/fs/fs.h
===================================================================
--- gnunet/src/fs/fs.h  2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs.h  2010-04-24 13:08:05 UTC (rev 11059)
@@ -29,6 +29,7 @@
 #include "gnunet_constants.h"
 #include "gnunet_datastore_service.h"
 #include "gnunet_fs_service.h"
+#include "gnunet_block_lib.h"
 
 /**
  * Size of the individual blocks used for file-sharing.
@@ -1124,139 +1125,6 @@
 
 
 /**
- * @brief index block (indexing a DBlock that 
- *        can be obtained directly from reading
- *        the plaintext file)
- */
-struct OnDemandBlock
-{
-  /**
-   * Hash code of the entire content of the
-   * file that was indexed (used to uniquely
-   * identify the plaintext file).
-   */
-  GNUNET_HashCode file_id;
-
-  /**
-   * At which offset should we be able to find
-   * this on-demand encoded block? (in NBO)
-   */
-  uint64_t offset GNUNET_PACKED;
-
-};
-
-
-/**
- * @brief keyword block (advertising data under a keyword)
- */
-struct KBlock
-{
-
-  /**
-   * GNUNET_RSA_Signature using RSA-key generated from search keyword.
-   */
-  struct GNUNET_CRYPTO_RsaSignature signature;
-
-  /**
-   * What is being signed and why?
-   */
-  struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
-
-  /**
-   * Key generated (!) from the H(keyword) as the seed!
-   */
-  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
-
-  /* 0-terminated URI here */
-
-  /* variable-size Meta-Data follows here */
-
-};
-
-/**
- * @brief namespace content block (advertising data under an identifier in a 
namespace)
- */
-struct SBlock
-{
-
-  /**
-   * GNUNET_RSA_Signature using RSA-key of the namespace
-   */
-  struct GNUNET_CRYPTO_RsaSignature signature;
-
-  /**
-   * What is being signed and why?
-   */
-  struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
-
-  /**
-   * Hash of the hash of the human-readable identifier used for
-   * this entry (the hash of the human-readable identifier is
-   * used as the key for decryption; the xor of this identifier
-   * and the hash of the "keyspace" is the datastore-query hash).
-   */
-  GNUNET_HashCode identifier;
-
-  /**
-   * Public key of the namespace.
-   */
-  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
-
-  /* 0-terminated update-identifier here */
-
-  /* 0-terminated URI here (except for NBlocks) */
-
-  /* variable-size Meta-Data follows here */
-
-};
-
-
-/**
- * @brief namespace advertisement block (advertising root of a namespace)
- */
-struct NBlock
-{
-
-  /**
-   * GNUNET_RSA_Signature using RSA-key generated from search keyword.
-   */
-  struct GNUNET_CRYPTO_RsaSignature ksk_signature;
-
-  /**
-   * What is being signed and why?
-   */
-  struct GNUNET_CRYPTO_RsaSignaturePurpose ksk_purpose;
-
-  /**
-   * Key generated (!) from the H(keyword) as the seed!
-   */
-  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
-
-  /**
-   * GNUNET_RSA_Signature using RSA-key of the namespace
-   */
-  struct GNUNET_CRYPTO_RsaSignature ns_signature;
-
-  /**
-   * What is being signed and why?
-   */
-  struct GNUNET_CRYPTO_RsaSignaturePurpose ns_purpose;
-
-  /**
-   * Public key of the namespace.
-   */
-  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
-
-  /* from here on, data is encrypted with H(keyword) */
-
-  /* 0-terminated root identifier here */
-
-  /* variable-size Meta-Data follows here */
-
-};
-
-
-/**
  * Message sent from a GNUnet (fs) publishing activity to the
  * gnunet-fs-service to initiate indexing of a file.  The service is
  * supposed to check if the specified file is available and has the

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_download.c 2010-04-24 13:08:05 UTC (rev 11059)
@@ -219,7 +219,7 @@
   /**
    * Type of data.
    */
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 
   /**
    * Flag to indicate if this block should be stored on disk.
@@ -333,8 +333,8 @@
              prc.data = enc;
              prc.size = len;
              prc.type = (dc->treedepth == depth) 
-               ? GNUNET_DATASTORE_BLOCKTYPE_DBLOCK 
-               : GNUNET_DATASTORE_BLOCKTYPE_IBLOCK;
+               ? GNUNET_BLOCK_TYPE_DBLOCK 
+               : GNUNET_BLOCK_TYPE_IBLOCK;
              prc.query = chk->query;
              prc.do_store = GNUNET_NO; /* useless */
              process_result_with_request (&prc,
@@ -1021,7 +1021,7 @@
  */
 static void
 process_result (struct GNUNET_FS_DownloadContext *dc,
-               uint32_t type,
+               enum GNUNET_BLOCK_Type type,
                const void *data,
                size_t size)
 {
@@ -1128,9 +1128,9 @@
       sm->header.size = htons (sizeof (struct SearchMessage));
       sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
       if (dc->pending->depth == dc->treedepth)
-       sm->type = htonl (GNUNET_DATASTORE_BLOCKTYPE_DBLOCK);
+       sm->type = htonl (GNUNET_BLOCK_TYPE_DBLOCK);
       else
-       sm->type = htonl (GNUNET_DATASTORE_BLOCKTYPE_IBLOCK);
+       sm->type = htonl (GNUNET_BLOCK_TYPE_IBLOCK);
       sm->anonymity_level = htonl (dc->anonymity);
       sm->target = dc->target.hashPubKey;
       sm->query = dc->pending->chk.query;

Modified: gnunet/src/fs/fs_namespace.c
===================================================================
--- gnunet/src/fs/fs_namespace.c        2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_namespace.c        2010-04-24 13:08:05 UTC (rev 11059)
@@ -199,7 +199,7 @@
                        &query,
                        ac->pt_size + sizeof (struct NBlock),
                        ac->nb,
-                       GNUNET_DATASTORE_BLOCKTYPE_NBLOCK,
+                       GNUNET_BLOCK_TYPE_NBLOCK,
                        ac->priority,
                        ac->anonymity,
                        ac->expiration,

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_publish.c  2010-04-24 13:08:05 UTC (rev 11059)
@@ -451,7 +451,7 @@
 block_proc (void *cls,
            const GNUNET_HashCode *query,
            uint64_t offset,
-           uint32_t type,
+           enum GNUNET_BLOCK_Type type,
            const void *block,
            uint16_t block_size)
 {
@@ -480,7 +480,7 @@
   dpc_cls->p = p;
   if ( (! p->is_directory) &&
        (GNUNET_YES == p->data.file.do_index) &&
-       (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK) )
+       (type == GNUNET_BLOCK_TYPE_DBLOCK) )
     {
 #if DEBUG_PUBLISH
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -496,7 +496,7 @@
                            query,
                            sizeof(struct OnDemandBlock),
                            &odb,
-                           GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND,
+                           GNUNET_BLOCK_TYPE_ONDEMAND,
                            p->priority,
                            p->anonymity,
                            p->expirationTime,
@@ -1281,7 +1281,7 @@
                        sizeof (struct KBlock) + 
                        pkc->slen,
                        pkc->cpy,
-                       GNUNET_DATASTORE_BLOCKTYPE_KBLOCK, 
+                       GNUNET_BLOCK_TYPE_KBLOCK, 
                        pkc->priority,
                        pkc->anonymity,
                        pkc->expirationTime,
@@ -1594,7 +1594,7 @@
                        &sb_enc->identifier,
                        size,
                        sb_enc,
-                       GNUNET_DATASTORE_BLOCKTYPE_SBLOCK, 
+                       GNUNET_BLOCK_TYPE_SBLOCK, 
                        priority,
                        anonymity,
                        expirationTime,

Modified: gnunet/src/fs/fs_search.c
===================================================================
--- gnunet/src/fs/fs_search.c   2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_search.c   2010-04-24 13:08:05 UTC (rev 11059)
@@ -574,7 +574,7 @@
  */
 static void
 process_result (struct GNUNET_FS_SearchContext *sc,
-               uint32_t type,
+               enum GNUNET_BLOCK_Type type,
                struct GNUNET_TIME_Absolute expiration,
                const void *data,
                size_t size)
@@ -587,7 +587,7 @@
     }
   switch (type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
+    case GNUNET_BLOCK_TYPE_KBLOCK:
       if (! GNUNET_FS_uri_test_ksk (sc->uri))
        {
          GNUNET_break (0);
@@ -600,7 +600,7 @@
        }
       process_kblock (sc, data, size);
       break;
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+    case GNUNET_BLOCK_TYPE_SBLOCK:
       if (! GNUNET_FS_uri_test_sks (sc->uri))
        {
          GNUNET_break (0);
@@ -613,7 +613,7 @@
        }
       process_sblock (sc, data, size);
       break;
-    case GNUNET_DATASTORE_BLOCKTYPE_NBLOCK:
+    case GNUNET_BLOCK_TYPE_NBLOCK:
       if (! GNUNET_FS_uri_test_ksk (sc->uri))
        {
          GNUNET_break (0);
@@ -626,10 +626,10 @@
        }
       process_nblock (sc, data, size);
       break;
-    case GNUNET_DATASTORE_BLOCKTYPE_ANY:
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_ANY:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_ONDEMAND:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
       GNUNET_break (0);
       break;
     default:
@@ -729,7 +729,7 @@
        {
          sm[i].header.size = htons (sizeof (struct SearchMessage));
          sm[i].header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
-         sm[i].type = htonl (GNUNET_DATASTORE_BLOCKTYPE_ANY);
+         sm[i].type = htonl (GNUNET_BLOCK_TYPE_ANY);
          sm[i].anonymity_level = htonl (sc->anonymity);
          sm[i].query = sc->requests[i].query;
        }
@@ -743,7 +743,7 @@
       memset (sm, 0, msize);
       sm->header.size = htons (sizeof (struct SearchMessage));
       sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
-      sm->type = htonl (GNUNET_DATASTORE_BLOCKTYPE_SBLOCK);
+      sm->type = htonl (GNUNET_BLOCK_TYPE_SBLOCK);
       sm->anonymity_level = htonl (sc->anonymity);
       sm->target = sc->uri->data.sks.namespace;
       identifier = sc->uri->data.sks.identifier;

Modified: gnunet/src/fs/fs_tree.c
===================================================================
--- gnunet/src/fs/fs_tree.c     2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_tree.c     2010-04-24 13:08:05 UTC (rev 11059)
@@ -389,8 +389,8 @@
              &mychk->query,
              te->publish_offset,
              (te->current_depth == te->chk_tree_depth) 
-             ? GNUNET_DATASTORE_BLOCKTYPE_DBLOCK 
-             : GNUNET_DATASTORE_BLOCKTYPE_IBLOCK,
+             ? GNUNET_BLOCK_TYPE_DBLOCK 
+             : GNUNET_BLOCK_TYPE_IBLOCK,
              enc,
              pt_size);
   if (NULL != te->progress)

Modified: gnunet/src/fs/fs_tree.h
===================================================================
--- gnunet/src/fs/fs_tree.h     2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_tree.h     2010-04-24 13:08:05 UTC (rev 11059)
@@ -67,7 +67,7 @@
 typedef void (*GNUNET_FS_TreeBlockProcessor)(void *cls,
                                             const GNUNET_HashCode *query,
                                             uint64_t offset,
-                                            uint32_t type,
+                                            enum GNUNET_BLOCK_Type type,
                                             const void *block,
                                             uint16_t block_size);
                                             

Modified: gnunet/src/fs/fs_unindex.c
===================================================================
--- gnunet/src/fs/fs_unindex.c  2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/fs_unindex.c  2010-04-24 13:08:05 UTC (rev 11059)
@@ -198,7 +198,7 @@
 unindex_process (void *cls,
                 const GNUNET_HashCode *query,
                 uint64_t offset,
-                uint32_t type,
+                enum GNUNET_BLOCK_Type type,
                 const void *block,
                 uint16_t block_size)
 {
@@ -207,7 +207,7 @@
   const void *data;
   struct OnDemandBlock odb;
 
-  if (type != GNUNET_DATASTORE_BLOCKTYPE_DBLOCK)
+  if (type != GNUNET_BLOCK_TYPE_DBLOCK)
     {
       size = block_size;
       data = block;

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/fs/gnunet-service-fs.c   2010-04-24 13:08:05 UTC (rev 11059)
@@ -540,7 +540,7 @@
   /**
    * Type of the content that this request is for.
    */
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 
   /**
    * Remove this request after transmission of the current response.
@@ -1680,14 +1680,14 @@
   
   switch (pr->type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
       /* only one reply expected, done with the request! */
       destroy_pending_request (pr);
       break;
-    case GNUNET_DATASTORE_BLOCKTYPE_ANY:
-    case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+    case GNUNET_BLOCK_TYPE_ANY:
+    case GNUNET_BLOCK_TYPE_KBLOCK:
+    case GNUNET_BLOCK_TYPE_SBLOCK:
       break;
     default:
       GNUNET_break (0);
@@ -1697,152 +1697,6 @@
 
 
 /**
- * Check if the given KBlock is well-formed.
- *
- * @param kb the kblock data (or at least "dsize" bytes claiming to be one)
- * @param dsize size of "kb" in bytes; check for < sizeof(struct KBlock)!
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed KBlock
- */
-static int
-check_kblock (const struct KBlock *kb,
-             size_t dsize,
-             GNUNET_HashCode *query)
-{
-  if (dsize < sizeof (struct KBlock))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (dsize - sizeof (struct KBlock) !=
-      ntohl (kb->purpose.size) 
-      - sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) 
-      - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) ) 
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_KBLOCK,
-                               &kb->purpose,
-                               &kb->signature,
-                               &kb->keyspace)) 
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (query != NULL)
-    GNUNET_CRYPTO_hash (&kb->keyspace,
-                       sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
-                       query);
-  return GNUNET_OK;
-}
-
-
-/**
- * Check if the given NBlock is well-formed.
- *
- * @param nb the nblock data (or at least "dsize" bytes claiming to be one)
- * @param dsize size of "nb" in bytes; check for < sizeof(struct NBlock)!
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed NBlock
- */
-static int
-check_nblock (const struct NBlock *nb,
-             size_t dsize,
-             GNUNET_HashCode *query)
-{
-  if (dsize < sizeof (struct NBlock))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (dsize - sizeof (struct NBlock) !=
-      ntohl (nb->ns_purpose.size) 
-      - sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) 
-      - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) ) 
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (dsize !=
-      ntohl (nb->ksk_purpose.size) + sizeof (struct 
GNUNET_CRYPTO_RsaSignature))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK_KSIG,
-                               &nb->ksk_purpose,
-                               &nb->ksk_signature,
-                               &nb->keyspace)) 
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK,
-                               &nb->ns_purpose,
-                               &nb->ns_signature,
-                               &nb->subspace)) 
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (query != NULL)
-    GNUNET_CRYPTO_hash (&nb->keyspace,
-                       sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
-                       query);
-  return GNUNET_OK;
-}
-
-
-/**
- * Check if the given SBlock is well-formed.
- *
- * @param sb the sblock data (or at least "dsize" bytes claiming to be one)
- * @param dsize size of "kb" in bytes; check for < sizeof(struct SBlock)!
- * @param query where to store the query that this block answers
- * @param namespace where to store the namespace that this block belongs to
- * @return GNUNET_OK if this is actually a well-formed SBlock
- */
-static int
-check_sblock (const struct SBlock *sb,
-             size_t dsize,
-             GNUNET_HashCode *query,   
-             GNUNET_HashCode *namespace)
-{
-  if (dsize < sizeof (struct SBlock))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (dsize !=
-      ntohl (sb->purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK,
-                               &sb->purpose,
-                               &sb->signature,
-                               &sb->subspace)) 
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  if (query != NULL)
-    *query = sb->identifier;
-  if (namespace != NULL)
-    GNUNET_CRYPTO_hash (&sb->subspace,
-                       sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
-                       namespace);
-  return GNUNET_OK;
-}
-
-
-/**
  * Transmit the given message by copying it to the target buffer
  * "buf".  "buf" will be NULL and "size" zero if the socket was closed
  * for writing in the meantime.  In that case, do nothing
@@ -1931,7 +1785,7 @@
   /**
    * Type of the block.
    */
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 
   /**
    * How much was this reply worth to us?
@@ -1979,8 +1833,8 @@
                      &chash);
   switch (prq->type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
       /* only possible reply, stop requesting! */
       while (NULL != pr->pending_head)
        destroy_pending_message_list_entry (pr->pending_head);
@@ -2004,7 +1858,7 @@
                                                          key,
                                                          pr));
       break;
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+    case GNUNET_BLOCK_TYPE_SBLOCK:
       if (pr->namespace == NULL)
        {
          GNUNET_break (0);
@@ -2019,8 +1873,8 @@
          return GNUNET_YES; /* wrong namespace */      
        }
       /* then: fall-through! */
-    case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_NBLOCK:
+    case GNUNET_BLOCK_TYPE_KBLOCK:
+    case GNUNET_BLOCK_TYPE_NBLOCK:
       if (pr->bf != NULL) 
        {
          mingle_hash (&chash, pr->mingle, &mhash);
@@ -2156,10 +2010,11 @@
   const struct PutMessage *put;
   uint16_t msize;
   size_t dsize;
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
   struct GNUNET_TIME_Absolute expiration;
   GNUNET_HashCode query;
   struct ProcessReplyClosure prq;
+  const struct SBlock *sb;
 
   msize = ntohs (message->size);
   if (msize < sizeof (struct PutMessage))
@@ -2172,40 +2027,24 @@
   type = ntohl (put->type);
   expiration = GNUNET_TIME_absolute_ntoh (put->expiration);
 
-  /* first, validate! */
-  switch (type)
+  if (GNUNET_OK !=
+      GNUNET_BLOCK_check_block (type,
+                               &put[1],
+                               dsize,
+                               &query))
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
-      GNUNET_CRYPTO_hash (&put[1], dsize, &query);
-      break;
-    case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
-      if (GNUNET_OK !=
-         check_kblock ((const struct KBlock*) &put[1],
-                       dsize,
-                       &query))
-       return GNUNET_SYSERR;
-      break;
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
-      if (GNUNET_OK !=
-         check_sblock ((const struct SBlock*) &put[1],
-                       dsize,
-                       &query,
-                       &prq.namespace))
-       return GNUNET_SYSERR;
-      break;
-    case GNUNET_DATASTORE_BLOCKTYPE_NBLOCK:
-      if (GNUNET_OK !=
-         check_nblock ((const struct NBlock*) &put[1],
-                       dsize,
-                       &query))
-       return GNUNET_SYSERR;
-      return GNUNET_OK;
-    default:
-      /* unknown block type */
       GNUNET_break_op (0);
       return GNUNET_SYSERR;
     }
+  if (type == GNUNET_BLOCK_TYPE_ONDEMAND)
+    return GNUNET_SYSERR;
+  if (GNUNET_BLOCK_TYPE_SBLOCK == type)
+    { 
+      sb = (const struct SBlock*) &put[1];
+      GNUNET_CRYPTO_hash (&sb->subspace,
+                         sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+                         &prq.namespace);
+    }
 
 #if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2309,7 +2148,7 @@
                     const GNUNET_HashCode * key,
                     uint32_t size,
                     const void *data,
-                    uint32_t type,
+                    enum GNUNET_BLOCK_Type type,
                     uint32_t priority,
                     uint32_t anonymity,
                     struct GNUNET_TIME_Absolute
@@ -2319,6 +2158,7 @@
   struct PendingRequest *pr = cls;
   struct ProcessReplyClosure prq;
   struct CheckDuplicateRequestClosure cdrc;
+  const struct SBlock *sb;
   GNUNET_HashCode dhash;
   GNUNET_HashCode mhash;
   GNUNET_HashCode query;
@@ -2368,7 +2208,7 @@
              GNUNET_h2s (key),
              type);
 #endif
-  if (type == GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND)
+  if (type == GNUNET_BLOCK_TYPE_ONDEMAND)
     {
 #if DEBUG_FS
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2421,11 +2261,17 @@
   prq.data = data;
   prq.expiration = expiration;
   prq.size = size;  
-  if ( (type == GNUNET_DATASTORE_BLOCKTYPE_SBLOCK) &&
-       (GNUNET_OK != check_sblock ((const struct SBlock*) data,
-                                  size,
-                                  &query,
-                                  &prq.namespace)) )
+  if (GNUNET_BLOCK_TYPE_SBLOCK == type)
+    { 
+      sb = (const struct SBlock*) data;
+      GNUNET_CRYPTO_hash (&sb->subspace,
+                         sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+                         &prq.namespace);
+    }
+  if (GNUNET_OK != GNUNET_BLOCK_check_block (type,
+                                            data,
+                                            size,
+                                            &query))
     {
       GNUNET_break (0);
       /* FIXME: consider removing the block? */
@@ -2436,8 +2282,8 @@
   prq.priority = priority;  
   process_reply (&prq, key, pr);
 
-  if ( (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK) ||
-       (type == GNUNET_DATASTORE_BLOCKTYPE_IBLOCK) ) 
+  if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) ||
+       (type == GNUNET_BLOCK_TYPE_IBLOCK) ) 
     {
       GNUNET_FS_drq_get_next (GNUNET_NO);
       return;
@@ -2538,7 +2384,7 @@
   uint32_t bm;
   size_t bfsize;
   uint32_t ttl_decrement;
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
   double preference;
   int have_ns;
 
@@ -2552,11 +2398,11 @@
   type = ntohl (gm->type);
   switch (type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_ANY:
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+    case GNUNET_BLOCK_TYPE_ANY:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_KBLOCK:
+    case GNUNET_BLOCK_TYPE_SBLOCK:
       break;
     default:
       GNUNET_break_op (0);
@@ -2579,7 +2425,7 @@
   bfsize = msize - sizeof (struct GetMessage) + bits * sizeof 
(GNUNET_HashCode);
   bm = ntohl (gm->hash_bitmap);
   if ( (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) &&
-       (type != GNUNET_DATASTORE_BLOCKTYPE_SBLOCK) )
+       (type != GNUNET_BLOCK_TYPE_SBLOCK) )
     {
       GNUNET_break_op (0);
       return GNUNET_SYSERR;      
@@ -2764,8 +2610,8 @@
   cps->inc_preference += preference;
 
   /* process locally */
-  if (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK)
-    type = GNUNET_DATASTORE_BLOCKTYPE_ANY; /* to get on-demand as well */
+  if (type == GNUNET_BLOCK_TYPE_DBLOCK)
+    type = GNUNET_BLOCK_TYPE_ANY; /* to get on-demand as well */
   timeout = GNUNET_TIME_relative_multiply (BASIC_DATASTORE_REQUEST_DELAY,
                                           (pr->priority + 1)); 
   pr->drq = GNUNET_FS_drq_get (&gm->query,
@@ -2778,8 +2624,8 @@
   /* Are multiple results possible?  If so, start processing remotely now! */
   switch (pr->type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
       /* only one result, wait for datastore */
       break;
     default:
@@ -2821,7 +2667,7 @@
   struct PendingRequest *pr;
   uint16_t msize;
   unsigned int sc;
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 
   msize = ntohs (message->size);
   if ( (msize < sizeof (struct SearchMessage)) ||
@@ -2847,12 +2693,12 @@
 #endif
   switch (type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_ANY:
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_NBLOCK:
+    case GNUNET_BLOCK_TYPE_ANY:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_KBLOCK:
+    case GNUNET_BLOCK_TYPE_SBLOCK:
+    case GNUNET_BLOCK_TYPE_NBLOCK:
       break;
     default:
       GNUNET_break (0);
@@ -2874,9 +2720,9 @@
       client_list = cl;
     }
   /* detect duplicate KBLOCK requests */
-  if ( (type == GNUNET_DATASTORE_BLOCKTYPE_KBLOCK) ||
-       (type == GNUNET_DATASTORE_BLOCKTYPE_NBLOCK) ||
-       (type == GNUNET_DATASTORE_BLOCKTYPE_ANY) )
+  if ( (type == GNUNET_BLOCK_TYPE_KBLOCK) ||
+       (type == GNUNET_BLOCK_TYPE_NBLOCK) ||
+       (type == GNUNET_BLOCK_TYPE_ANY) )
     {
       crl = cl->rl_head;
       while ( (crl != NULL) &&
@@ -2917,7 +2763,7 @@
                            1,
                            GNUNET_NO);
   pr = GNUNET_malloc (sizeof (struct PendingRequest) + 
-                     ((type == GNUNET_DATASTORE_BLOCKTYPE_SBLOCK) ? 
sizeof(GNUNET_HashCode) : 0));
+                     ((type == GNUNET_BLOCK_TYPE_SBLOCK) ? 
sizeof(GNUNET_HashCode) : 0));
   crl = GNUNET_malloc (sizeof (struct ClientRequestList));
   memset (crl, 0, sizeof (struct ClientRequestList));
   crl->client_list = cl;
@@ -2939,14 +2785,14 @@
   pr->query = sm->query;
   switch (type)
     {
-    case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
-    case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+    case GNUNET_BLOCK_TYPE_DBLOCK:
+    case GNUNET_BLOCK_TYPE_IBLOCK:
       if (0 != memcmp (&sm->target,
                       &all_zeros,
                       sizeof (GNUNET_HashCode)))
        pr->target_pid = GNUNET_PEER_intern ((const struct 
GNUNET_PeerIdentity*) &sm->target);
       break;
-    case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+    case GNUNET_BLOCK_TYPE_SBLOCK:
       pr->namespace = (GNUNET_HashCode*) &pr[1];
       memcpy (&pr[1], &sm->target, sizeof (GNUNET_HashCode));
       break;
@@ -2957,8 +2803,8 @@
                                     &sm->query,
                                     pr,
                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  if (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK)
-    type = GNUNET_DATASTORE_BLOCKTYPE_ANY; /* get on-demand blocks too! */
+  if (type == GNUNET_BLOCK_TYPE_DBLOCK)
+    type = GNUNET_BLOCK_TYPE_ANY; /* get on-demand blocks too! */
   pr->drq = GNUNET_FS_drq_get (&sm->query,
                               type,                           
                               &process_local_reply,

Modified: gnunet/src/fs/gnunet-service-fs_drq.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_drq.c       2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/fs/gnunet-service-fs_drq.c       2010-04-24 13:08:05 UTC (rev 
11059)
@@ -83,7 +83,7 @@
   /**
    * Datastore entry type we are doing the 'get' for.
    */
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 
   /**
    * Is this request at the head of the queue irrespective of its
@@ -154,7 +154,7 @@
              const GNUNET_HashCode * key,
              uint32_t size,
              const void *data,
-             uint32_t type,
+             enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
              struct GNUNET_TIME_Absolute
@@ -345,7 +345,7 @@
  */
 struct DatastoreRequestQueue *
 GNUNET_FS_drq_get (const GNUNET_HashCode * key,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   GNUNET_DATASTORE_Iterator iter, 
                   void *iter_cls,
                   struct GNUNET_TIME_Relative timeout,

Modified: gnunet/src/fs/gnunet-service-fs_drq.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_drq.h       2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/fs/gnunet-service-fs_drq.h       2010-04-24 13:08:05 UTC (rev 
11059)
@@ -54,7 +54,7 @@
  */
 struct DatastoreRequestQueue *
 GNUNET_FS_drq_get (const GNUNET_HashCode * key,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   GNUNET_DATASTORE_Iterator iter, 
                   void *iter_cls,
                   struct GNUNET_TIME_Relative timeout,

Modified: gnunet/src/fs/gnunet-service-fs_indexing.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_indexing.c  2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/fs/gnunet-service-fs_indexing.c  2010-04-24 13:08:05 UTC (rev 
11059)
@@ -539,7 +539,7 @@
 GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
                                  uint32_t size,
                                  const void *data,
-                                 uint32_t type,
+                                 enum GNUNET_BLOCK_Type type,
                                  uint32_t priority,
                                  uint32_t anonymity,
                                  struct GNUNET_TIME_Absolute
@@ -641,7 +641,7 @@
        key,
        nsize,
        edata,
-       GNUNET_DATASTORE_BLOCKTYPE_DBLOCK,
+       GNUNET_BLOCK_TYPE_DBLOCK,
        priority,
        anonymity,
        expiration,

Modified: gnunet/src/fs/gnunet-service-fs_indexing.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_indexing.h  2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/fs/gnunet-service-fs_indexing.h  2010-04-24 13:08:05 UTC (rev 
11059)
@@ -26,6 +26,7 @@
 #ifndef GNUNET_SERVICE_FS_INDEXING_H
 #define GNUNET_SERVICE_FS_INDEXING_H
 
+#include "gnunet_block_lib.h"
 #include "gnunet_core_service.h"
 #include "gnunet_datastore_service.h"
 #include "gnunet_peer_lib.h"
@@ -57,7 +58,7 @@
 GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
                                  uint32_t size,
                                  const void *data,
-                                 uint32_t type,
+                                 enum GNUNET_BLOCK_Type type,
                                  uint32_t priority,
                                  uint32_t anonymity,
                                  struct GNUNET_TIME_Absolute

Modified: gnunet/src/include/gnunet_datacache_lib.h
===================================================================
--- gnunet/src/include/gnunet_datacache_lib.h   2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/include/gnunet_datacache_lib.h   2010-04-24 13:08:05 UTC (rev 
11059)
@@ -32,6 +32,7 @@
 #define GNUNET_DATACACHE_LIB_H
 
 #include "gnunet_util_lib.h"
+#include "gnunet_block_lib.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -86,7 +87,7 @@
                                          const GNUNET_HashCode * key,
                                          uint32_t size,
                                          const char *data,
-                                         uint32_t type);
+                                         enum GNUNET_BLOCK_Type type);
 
 
 /**
@@ -105,7 +106,7 @@
                      const GNUNET_HashCode * key,
                      uint32_t size,
                      const char *data,
-                     unsigned int type,
+                     enum GNUNET_BLOCK_Type type,
                      struct GNUNET_TIME_Absolute discard_time);
 
 
@@ -123,7 +124,7 @@
 unsigned int 
 GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
                      const GNUNET_HashCode * key,
-                     unsigned int type, 
+                     enum GNUNET_BLOCK_Type type, 
                      GNUNET_DATACACHE_Iterator iter,
                      void *iter_cls);
 

Modified: gnunet/src/include/gnunet_datastore_service.h
===================================================================
--- gnunet/src/include/gnunet_datastore_service.h       2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/include/gnunet_datastore_service.h       2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -32,6 +32,7 @@
 #define GNUNET_DATASTORE_SERVICE_H
 
 #include "gnunet_util_lib.h"
+#include "gnunet_block_lib.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -41,45 +42,8 @@
 #endif
 #endif
 
-/**
- * Any type of block, used as a wildcard when searching.  Should
- * never be attached to a specific block.
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_ANY 0
 
 /**
- * Data block (leaf) in the CHK tree.
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_DBLOCK 1
-
-/**
- * Inner block in the CHK tree.
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_IBLOCK 2
-
-/**
- * Type of a block representing a keyword search result.
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_KBLOCK 3
-
-/**
- * Type of a block that is used to advertise content in a namespace.
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_SBLOCK 4
-
-/**
- * Type of a block representing a block to be encoded on demand from disk.
- * Should never appear on the network directly.
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND 5
-
-/**
- * Type of a block that is used to advertise a namespace.  
- */
-#define GNUNET_DATASTORE_BLOCKTYPE_NBLOCK 6
-
-
-/**
  * Handle to the datastore service.
  */
 struct GNUNET_DATASTORE_Handle;
@@ -171,7 +135,7 @@
                       const GNUNET_HashCode * key,
                       uint32_t size,
                       const void *data,
-                      uint32_t type,
+                      enum GNUNET_BLOCK_Type type,
                       uint32_t priority,
                       uint32_t anonymity,
                       struct GNUNET_TIME_Absolute expiration,
@@ -239,7 +203,7 @@
                                           const GNUNET_HashCode * key,
                                           uint32_t size,
                                           const void *data,
-                                          uint32_t type,
+                                          enum GNUNET_BLOCK_Type type,
                                           uint32_t priority,
                                           uint32_t anonymity,
                                           struct GNUNET_TIME_Absolute
@@ -264,7 +228,7 @@
 void
 GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h,
                       const GNUNET_HashCode * key,
-                     uint32_t type,
+                     enum GNUNET_BLOCK_Type type,
                       GNUNET_DATASTORE_Iterator iter, 
                      void *iter_cls,
                      struct GNUNET_TIME_Relative timeout);

Modified: gnunet/src/include/gnunet_dht_service.h
===================================================================
--- gnunet/src/include/gnunet_dht_service.h     2010-04-23 13:19:24 UTC (rev 
11058)
+++ gnunet/src/include/gnunet_dht_service.h     2010-04-24 13:08:05 UTC (rev 
11059)
@@ -147,7 +147,7 @@
  * @param handle handle to the DHT service
  * @param timeout timeout for this request to be sent to the
  *        service (this is NOT a timeout for receiving responses)
- * @param type expected type of the response object 
(GNUNET_DATASTORE_BLOCKTYPE_*)
+ * @param type expected type of the response object (GNUNET_BLOCK_TYPE_*)
  * @param key the key to look up
  * @param iter function to call on each result
  * @param iter_cls closure for iter

Added: gnunet/src/migration/Makefile.am
===================================================================
--- gnunet/src/migration/Makefile.am                            (rev 0)
+++ gnunet/src/migration/Makefile.am    2010-04-24 13:08:05 UTC (rev 11059)
@@ -0,0 +1,34 @@
+INCLUDES = -I$(top_srcdir)/src/include
+
+if MINGW
+  WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
+endif
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage -O0
+  XLIBS = -lgcov
+endif
+
+bin_PROGRAMS = \
+ gnunet-daemon-migration
+
+gnunet_daemon_migration_SOURCES = \
+ gnunet-daemon-migration.c 
+gnunet_daemon_migration_LDADD = \
+  $(top_builddir)/src/datastore/libgnunetdatastore.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(top_builddir)/src/core/libgnunetcore.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+check_PROGRAMS = test_gnunet_daemon_migration 
+#TESTS = $(check_PROGRAMS)
+
+test_gnunet_daemon_migration_SOURCES = \
+ test_gnunet_daemon_migration.c
+test_gnunet_daemon_migration_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la  
+
+EXTRA_DIST = \
+ test_gnunet_daemon_migration_data.conf 

Added: gnunet/src/migration/gnunet-daemon-migration
===================================================================
--- gnunet/src/migration/gnunet-daemon-migration                                
(rev 0)
+++ gnunet/src/migration/gnunet-daemon-migration        2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -0,0 +1,148 @@
+#! /bin/sh
+
+# gnunet-daemon-migration - temporary wrapper script for 
.libs/gnunet-daemon-migration
+# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2
+#
+# The gnunet-daemon-migration program cannot be directly executed until all 
the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='/bin/sed -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command="(cd /home/grothoff/svn/gnunet/src/migration; { test -z 
\"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export 
LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH 
|| { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z 
\"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; 
export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset 
LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z 
\"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; 
export LD_LIBRARY_PATH; }; }; 
PATH=/home/grothoff/bin:/home/grothoff/private/software/prevent-linux-4.3.0/bin/:/home/grothoff/bin:/usr/local/bin:/usr/bin:/bin:/usr/games;
 export PATH; gcc -fno-strict-aliasing -Wall -g -O0 -o \$progdir/\$file 
gnunet-daemon-migration.o  -L/home/grothoff//lib 
../../src/datastore/.libs/libgnunetdatastore.so 
../../src/statistics/.libs/libgnunetstatistics.so ../../src/core/.libs/libg
 nunetcore.so ../../src/util/.libs/libgnunetutil.so -lm -ldl -Wl,-rpath 
-Wl,/home/grothoff/svn/gnunet/src/datastore/.libs -Wl,-rpath 
-Wl,/home/grothoff/svn/gnunet/src/statistics/.libs -Wl,-rpath 
-Wl,/home/grothoff/svn/gnunet/src/core/.libs -Wl,-rpath 
-Wl,/home/grothoff/svn/gnunet/src/util/.libs -Wl,-rpath -Wl,/home/grothoff/lib)"
+
+# This environment variable determines our operation mode.
+if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='2.2.6b'
+  notinst_deplibs=' ../../src/datastore/libgnunetdatastore.la 
../../src/statistics/libgnunetstatistics.la ../../src/core/libgnunetcore.la 
../../src/util/libgnunetutil.la'
+else
+  # When we are sourced in execute mode, $file and $ECHO are already set.
+  if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+    ECHO="echo"
+    file="$0"
+    # Make sure echo works.
+    if test "X$1" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+      # Yippee, $ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe $ECHO will work.
+      exec /bin/sh "$0" --no-reexec ${1+"$@"}
+    fi
+  fi
+
+  # Find the directory that this script lives in.
+  thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+  test "x$thisdir" = "x$file" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
+  while test -n "$file"; do
+    destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+
+    # If there was a directory component, then change thisdir.
+    if test "x$destdir" != "x$file"; then
+      case "$destdir" in
+      [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
+      *) thisdir="$thisdir/$destdir" ;;
+      esac
+    fi
+
+    file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
+    file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
+  done
+
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
+  if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
+    # special case for '.'
+    if test "$thisdir" = "."; then
+      thisdir=`pwd`
+    fi
+    # remove .libs from thisdir
+    case "$thisdir" in
+    *[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;;
+    .libs )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=`cd "$thisdir" && pwd`
+  test -n "$absdir" && thisdir="$absdir"
+
+  program=lt-'gnunet-daemon-migration'
+  progdir="$thisdir/.libs"
+
+  if test ! -f "$progdir/$program" ||
+     { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | 
/bin/sed 1q`; \
+       test "X$file" != "X$progdir/$program"; }; then
+
+    file="$$-$program"
+
+    if test ! -d "$progdir"; then
+      mkdir "$progdir"
+    else
+      rm -f "$progdir/$file"
+    fi
+
+    # relink executable if necessary
+    if test -n "$relink_command"; then
+      if relink_command_output=`eval $relink_command 2>&1`; then :
+      else
+       echo "$relink_command_output" >&2
+       rm -f "$progdir/$file"
+       exit 1
+      fi
+    fi
+
+    mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
+    { rm -f "$progdir/$program";
+      mv -f "$progdir/$file" "$progdir/$program"; }
+    rm -f "$progdir/$file"
+  fi
+
+  if test -f "$progdir/$program"; then
+    if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+      # Run the actual program with our arguments.
+
+      exec "$progdir/$program" ${1+"$@"}
+
+      $ECHO "$0: cannot exec $program $*" 1>&2
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
+    $ECHO "This script is just a wrapper for $program." 1>&2
+    echo "See the libtool documentation for more information." 1>&2
+    exit 1
+  fi
+fi


Property changes on: gnunet/src/migration/gnunet-daemon-migration
___________________________________________________________________
Added: svn:executable
   + *

Added: gnunet/src/migration/gnunet-daemon-migration.c
===================================================================
--- gnunet/src/migration/gnunet-daemon-migration.c                              
(rev 0)
+++ gnunet/src/migration/gnunet-daemon-migration.c      2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -0,0 +1,377 @@
+/*
+     This file is part of GNUnet.
+     (C) 2010 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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file migration/gnunet-daemon-migration.c
+ * @brief migrating (file-sharing) content through the network; this 
+ *        daemon is only responsible for pushing content out (not for
+ *        processing inbound messages)
+ * @author Christian Grothoff
+ */
+#include <stdlib.h>
+#include "platform.h"
+#include "../fs/fs.h"
+#include "gnunet_constants.h"
+#include "gnunet_core_service.h"
+#include "gnunet_datastore_service.h"
+#include "gnunet_protocols.h"
+#include "gnunet_statistics_service.h"
+#include "gnunet_util_lib.h"
+
+
+#define DEBUG_MIGRATION GNUNET_YES
+
+/**
+ * Information we keep per peer.
+ */
+struct Peer
+{
+  /**
+   * Last time we migrated data to this peer.
+   */
+  struct GNUNET_TIME_Absolute last_migration;
+
+};
+
+
+/**
+ * Our scheduler.
+ */
+static struct GNUNET_SCHEDULER_Handle *sched;
+
+/**
+ * Our configuration.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
+
+/**
+ * Handle to the core API.
+ */
+static struct GNUNET_CORE_Handle *handle;
+
+/**
+ * Handle for reporting statistics.
+ */
+static struct GNUNET_STATISTICS_Handle *stats;
+
+/**
+ * Handle for the core service.
+*/
+static struct GNUNET_CORE_Handle *handle;
+
+/**
+ * Handle to the datastore.
+ */
+static struct GNUNET_DATASTORE_Handle *datastore;
+
+/**
+ * Anonymity level for the current block.
+ */
+static unsigned int current_anonymity;
+
+/**
+ * Type of the current block.
+ */
+static enum GNUNET_BLOCK_Type current_type;
+
+/**
+ * Data of the current block (already encrypted).
+ */
+static char current_block[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+
+/**
+ * Size of the current block.
+ */
+static size_t current_block_size;
+
+/**
+ * Key of the current block.
+ */
+static GNUNET_HashCode current_key;
+
+/**
+ * Task scheduled to receive content from the datastore (with some delay).
+ */
+static GNUNET_SCHEDULER_TaskIdentifier get_task;
+
+
+/**
+ * Select a peer for transmitting the current block to.
+ */
+static void
+select_peer ()
+{
+  /* FIXME: select a peer for transmission... */
+}
+
+
+/**
+ * Method called whenever a peer connects.
+ *
+ * @param cls closure
+ * @param peer peer identity this notification is about
+ * @param latency reported latency of the connection with 'other'
+ * @param distance reported distance (DV) to 'other' 
+ */
+static void 
+connect_notify (void *cls,
+               const struct
+               GNUNET_PeerIdentity * peer,
+               struct GNUNET_TIME_Relative latency,
+               uint32_t distance)
+{
+  /* FIXME: track peer */
+}
+
+
+/**
+ * Method called whenever a peer disconnects.
+ *
+ * @param cls closure
+ * @param peer peer identity this notification is about
+ */
+static void 
+disconnect_notify (void *cls,
+                  const struct
+                  GNUNET_PeerIdentity * peer)
+{
+  /* FIXME: untrack peer */
+}
+
+
+/**
+ * Ask datastore for more content.
+ * @param cls closure
+ * @param tc scheduler context 
+ */
+static void
+get_content (void *cls,
+            const struct GNUNET_SCHEDULER_TaskContext *tc);
+
+
+/**
+ * An iterator over a set of items stored in the datastore.
+ *
+ * @param cls closure
+ * @param key key for the content
+ * @param size number of bytes in data
+ * @param data content stored
+ * @param type type of the content
+ * @param priority priority of the content
+ * @param anonymity anonymity-level for the content
+ * @param expiration expiration time for the content
+ * @param uid unique identifier for the datum;
+ *        maybe 0 if no unique identifier is available
+ */
+static void 
+content_processor (void *cls,
+                  const GNUNET_HashCode * key,
+                  uint32_t size,
+                  const void *data,
+                  enum GNUNET_BLOCK_Type type,
+                  uint32_t priority,
+                  uint32_t anonymity,
+                  struct GNUNET_TIME_Absolute
+                  expiration, uint64_t uid)
+{
+  if (key != NULL)
+    {
+      memcpy (current_block, data, size);
+      current_block_size = size;
+      current_type = type;
+      current_anonymity = anonymity;
+      current_key = *key;
+      return;
+    }
+  if (current_block_size == 0)
+    {
+      get_task = GNUNET_SCHEDULER_add_delayed (sched,
+                                              GNUNET_TIME_UNIT_MINUTES,
+                                              &get_content,
+                                              NULL);
+      return;
+    }
+  if (current_type == GNUNET_BLOCK_TYPE_ONDEMAND)
+    {    
+      /* FIXME: do on-demand encoding... */
+      return;
+    }
+  select_peer ();
+}
+
+
+/**
+ * Ask datastore for more content.
+ * @param cls closure
+ * @param tc scheduler context 
+ */
+static void
+get_content (void *cls,
+            const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  get_task = GNUNET_SCHEDULER_NO_TASK;
+  GNUNET_DATASTORE_get_random (datastore,
+                              &content_processor,
+                              NULL,
+                              GNUNET_CONSTANTS_SERVICE_TIMEOUT);
+}
+
+
+/**
+ * Function called after GNUNET_CORE_connect has succeeded
+ * (or failed for good).
+ *
+ * @param cls closure
+ * @param server handle to the server, NULL if we failed
+ * @param my_id ID of this peer, NULL if we failed
+ * @param publicKey public key of this peer, NULL if we failed
+ */
+static void
+core_init (void *cls,
+          struct GNUNET_CORE_Handle * server,
+          const struct GNUNET_PeerIdentity *
+          my_id,
+          const struct
+          GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *
+          publicKey)
+{
+  handle = server;
+  if (datastore != NULL)
+    get_task = GNUNET_SCHEDULER_add_now (sched,
+                                        &get_content,
+                                        NULL);
+}
+
+
+/**
+ * Last task run during shutdown.  Disconnects us from
+ * the core.
+ *
+ * @param cls unused, NULL
+ * @param tc scheduler context
+ */
+static void
+cleaning_task (void *cls, 
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  if (get_task != GNUNET_SCHEDULER_NO_TASK)
+    {
+      GNUNET_SCHEDULER_cancel (sched,
+                              get_task);
+      get_task = GNUNET_SCHEDULER_NO_TASK;
+    }
+  if (handle != NULL)
+    {
+      GNUNET_CORE_disconnect (handle);
+      handle = NULL;
+    }
+  if (datastore != NULL)
+    {
+      GNUNET_DATASTORE_disconnect (datastore, GNUNET_NO);
+      datastore = NULL;
+    }
+  if (stats != NULL)
+    {
+      GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
+      stats = NULL;
+    }
+}
+
+
+/**
+ * Main function that will be run.
+ *
+ * @param cls closure
+ * @param s the scheduler to use
+ * @param args remaining command-line arguments
+ * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
+ * @param c configuration
+ */
+static void
+run (void *cls,
+     struct GNUNET_SCHEDULER_Handle * s,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle * c)
+{
+  struct GNUNET_CORE_MessageHandler handlers[] =
+    {
+      { NULL, 0, 0 }
+    };
+  sched = s;
+  cfg = c;
+  stats = GNUNET_STATISTICS_create (sched, "topology", cfg);
+  handle = GNUNET_CORE_connect (sched,
+                               cfg,
+                               GNUNET_TIME_UNIT_FOREVER_REL,
+                               NULL,
+                               &core_init,
+                               &connect_notify,
+                               &disconnect_notify,
+                               NULL, GNUNET_NO,
+                               NULL, GNUNET_NO,
+                               handlers);
+  datastore = GNUNET_DATASTORE_connect (cfg, sched);
+  GNUNET_SCHEDULER_add_delayed (sched,
+                                GNUNET_TIME_UNIT_FOREVER_REL,
+                                &cleaning_task, NULL);
+  if ( (NULL == handle) ||
+       (NULL == datastore) )
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                 _("Failed to connect to `%s' service.\n"),
+                 (NULL == handle) ? "core" : "datastore");
+      GNUNET_SCHEDULER_shutdown (sched);
+      return;
+    }
+}
+
+
+/**
+ * gnunet-daemon-topology command line options.
+ */
+static struct GNUNET_GETOPT_CommandLineOption options[] = {
+  GNUNET_GETOPT_OPTION_END
+};
+
+
+/**
+ * The main function for the topology daemon.
+ *
+ * @param argc number of arguments from the command line
+ * @param argv command line arguments
+ * @return 0 ok, 1 on error
+ */
+int
+main (int argc, char *const *argv)
+{
+  int ret;
+
+  ret = (GNUNET_OK ==
+         GNUNET_PROGRAM_run (argc,
+                             argv,
+                             "migration",
+                            _("Content migration for anonymous file-sharing"),
+                            options,
+                            &run, NULL)) ? 0 : 1;
+  return ret;
+}
+
+/* end of gnunet-daemon-migration.c */

Added: gnunet/src/migration/test_gnunet_daemon_migration.c
===================================================================
--- gnunet/src/migration/test_gnunet_daemon_migration.c                         
(rev 0)
+++ gnunet/src/migration/test_gnunet_daemon_migration.c 2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -0,0 +1,182 @@
+/*
+     This file is part of GNUnet.
+     (C) 2010 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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+/**
+ * @file topology/test_gnunet_daemon_migration.c
+ * @brief testcase for content migration code
+ */
+#include "platform.h"
+#include "gnunet_testing_lib.h"
+
+#define VERBOSE GNUNET_YES
+
+#define NUM_PEERS 2
+
+/**
+ * How long until we give up on connecting the peers?
+ */
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+
+#define CONNECT_ATTEMPTS 3
+
+
+static int ok;
+
+static int peers_left;
+
+static int connect_left;
+
+static struct GNUNET_TESTING_PeerGroup *pg;
+
+static struct GNUNET_TESTING_Daemon *first;
+
+static struct GNUNET_TESTING_Daemon *last;
+
+static struct GNUNET_SCHEDULER_Handle *sched;
+
+
+static void
+clean_up_task (void *cls,
+                const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_TESTING_daemons_stop (pg);
+  ok = 0;     
+}
+
+
+static void 
+notify_connect_complete(void *cls,
+                        const struct GNUNET_PeerIdentity *first,
+                        const struct GNUNET_PeerIdentity *second,
+                        const struct GNUNET_CONFIGURATION_Handle *first_cfg,
+                        const struct GNUNET_CONFIGURATION_Handle *second_cfg,
+                        struct GNUNET_TESTING_Daemon *first_daemon,
+                        struct GNUNET_TESTING_Daemon *second_daemon,
+                        const char *emsg)
+{
+  if (NULL != emsg)
+    {
+      fprintf (stderr,
+              "Failed to connect two peers: %s\n",
+              emsg);
+      GNUNET_TESTING_daemons_stop (pg);
+      GNUNET_assert (0);
+      return;
+    }
+  connect_left--;
+  if (connect_left == 0)
+    {
+      /* FIXME: check that topology adds a few more links
+        in addition to those that were seeded */
+      /* For now, sleep so we can have the daemon do some work */
+      GNUNET_SCHEDULER_add_delayed (sched,
+                                   GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 5),
+                                   &clean_up_task,
+                                   NULL);
+    }
+}
+
+
+static void my_cb(void *cls,
+                  const struct GNUNET_PeerIdentity *id,
+                  const struct GNUNET_CONFIGURATION_Handle *cfg,
+                  struct GNUNET_TESTING_Daemon *d,
+                  const char *emsg)
+{
+  GNUNET_assert (id != NULL);
+  peers_left--;  
+  if (first == NULL)
+    {
+      connect_left = NUM_PEERS;
+      first = d;
+      last = d;
+      return;
+    }
+  GNUNET_TESTING_daemons_connect (last, d, TIMEOUT, CONNECT_ATTEMPTS,
+                                 &notify_connect_complete,
+                                 NULL);
+  if (peers_left == 0)
+    {
+      /* close circle */
+      GNUNET_TESTING_daemons_connect (d, first, TIMEOUT, CONNECT_ATTEMPTS,
+                                     &notify_connect_complete,
+                                     NULL);
+    }
+}
+
+
+static void
+run (void *cls,
+     struct GNUNET_SCHEDULER_Handle *s,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  sched = s;
+  ok = 1;
+#if VERBOSE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting daemons.\n");
+#endif
+  peers_left = NUM_PEERS;
+  pg = GNUNET_TESTING_daemons_start (sched, cfg, 
+                                    peers_left,
+                                    &my_cb, NULL, NULL, NULL, NULL);
+  GNUNET_assert (pg != NULL);
+}
+
+static int
+check ()
+{
+  char *const argv[] = { "test-testing",
+    "-c",
+    "test_gnunet_service_topology_data.conf",
+#if VERBOSE
+    "-L", "DEBUG",
+#endif
+    NULL
+  };
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_OPTION_END
+  };
+  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
+                      argv, "test-gnunet-service-topology", "nohelp",
+                      options, &run, &ok);
+  return ok;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int ret;
+
+  GNUNET_log_setup ("test-gnunet-daemon-migration",
+#if VERBOSE
+                    "DEBUG",
+#else
+                    "WARNING",
+#endif
+                    NULL);
+  ret = check ();
+  sleep (1); /* FIXME: needed? */
+  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
+  return ret;
+}
+
+/* end of test_gnunet_daemon_migration.c */

Added: gnunet/src/migration/test_gnunet_daemon_migration_data.conf
===================================================================
--- gnunet/src/migration/test_gnunet_daemon_migration_data.conf                 
        (rev 0)
+++ gnunet/src/migration/test_gnunet_daemon_migration_data.conf 2010-04-24 
13:08:05 UTC (rev 11059)
@@ -0,0 +1,37 @@
+[PATHS]
+SERVICEHOME = /tmp/test-gnunet-topology/
+# DEFAULTCONFIG = test_gnunet_service_topology_data.conf
+
+[resolver]
+PORT = 2664
+
+[transport]
+PORT = 2665
+PLUGINS = tcp
+# DEBUG = YES
+#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
+#PREFIX = valgrind --tool=memcheck --log-file=logs%p
+
+[arm]
+PORT = 2666
+DEFAULTSERVICES = peerinfo transport core topology
+
+[statistics]
+PORT = 2667
+
+[transport-tcp]
+PORT = 2668
+
+[peerinfo]
+PORT = 2669
+
+[core]
+PORT = 2670
+# DEBUG = YES
+
+[topology]
+# DEBUG = YES
+#PREFIX = valgrind --tool=memcheck
+
+[testing]
+WEAKRANDOM = YES

Modified: gnunet/src/topology/Makefile.am
===================================================================
--- gnunet/src/topology/Makefile.am     2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/topology/Makefile.am     2010-04-24 13:08:05 UTC (rev 11059)
@@ -21,15 +21,15 @@
 
 
 check_PROGRAMS = \
- test_gnunet_service_topology
+ test_gnunet_daemon_topology
 
 TESTS = $(check_PROGRAMS)
 
-test_gnunet_service_topology_SOURCES = \
- test_gnunet_service_topology.c
-test_gnunet_service_topology_LDADD = \
+test_gnunet_daemon_topology_SOURCES = \
+ test_gnunet_daemon_topology.c
+test_gnunet_daemon_topology_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 EXTRA_DIST = \
- test_gnunet_service_topology_data.conf 
+ test_gnunet_daemon_topology_data.conf 

Copied: gnunet/src/topology/test_gnunet_daemon_topology.c (from rev 11055, 
gnunet/src/topology/test_gnunet_service_topology.c)
===================================================================
--- gnunet/src/topology/test_gnunet_daemon_topology.c                           
(rev 0)
+++ gnunet/src/topology/test_gnunet_daemon_topology.c   2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -0,0 +1,182 @@
+/*
+     This file is part of GNUnet.
+     (C) 2009 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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+/**
+ * @file topology/test_gnunet_daemon_topology.c
+ * @brief testcase for topology maintenance code
+ */
+#include "platform.h"
+#include "gnunet_testing_lib.h"
+
+#define VERBOSE GNUNET_YES
+
+#define NUM_PEERS 2
+
+/**
+ * How long until we give up on connecting the peers?
+ */
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+
+#define CONNECT_ATTEMPTS 3
+
+
+static int ok;
+
+static int peers_left;
+
+static int connect_left;
+
+static struct GNUNET_TESTING_PeerGroup *pg;
+
+static struct GNUNET_TESTING_Daemon *first;
+
+static struct GNUNET_TESTING_Daemon *last;
+
+static struct GNUNET_SCHEDULER_Handle *sched;
+
+
+static void
+clean_up_task (void *cls,
+                const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_TESTING_daemons_stop (pg);
+  ok = 0;     
+}
+
+
+static void 
+notify_connect_complete(void *cls,
+                        const struct GNUNET_PeerIdentity *first,
+                        const struct GNUNET_PeerIdentity *second,
+                        const struct GNUNET_CONFIGURATION_Handle *first_cfg,
+                        const struct GNUNET_CONFIGURATION_Handle *second_cfg,
+                        struct GNUNET_TESTING_Daemon *first_daemon,
+                        struct GNUNET_TESTING_Daemon *second_daemon,
+                        const char *emsg)
+{
+  if (NULL != emsg)
+    {
+      fprintf (stderr,
+              "Failed to connect two peers: %s\n",
+              emsg);
+      GNUNET_TESTING_daemons_stop (pg);
+      GNUNET_assert (0);
+      return;
+    }
+  connect_left--;
+  if (connect_left == 0)
+    {
+      /* FIXME: check that topology adds a few more links
+        in addition to those that were seeded */
+      /* For now, sleep so we can have the daemon do some work */
+      GNUNET_SCHEDULER_add_delayed (sched,
+                                   GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 5),
+                                   &clean_up_task,
+                                   NULL);
+    }
+}
+
+
+static void my_cb(void *cls,
+                  const struct GNUNET_PeerIdentity *id,
+                  const struct GNUNET_CONFIGURATION_Handle *cfg,
+                  struct GNUNET_TESTING_Daemon *d,
+                  const char *emsg)
+{
+  GNUNET_assert (id != NULL);
+  peers_left--;  
+  if (first == NULL)
+    {
+      connect_left = NUM_PEERS;
+      first = d;
+      last = d;
+      return;
+    }
+  GNUNET_TESTING_daemons_connect (last, d, TIMEOUT, CONNECT_ATTEMPTS,
+                                 &notify_connect_complete,
+                                 NULL);
+  if (peers_left == 0)
+    {
+      /* close circle */
+      GNUNET_TESTING_daemons_connect (d, first, TIMEOUT, CONNECT_ATTEMPTS,
+                                     &notify_connect_complete,
+                                     NULL);
+    }
+}
+
+
+static void
+run (void *cls,
+     struct GNUNET_SCHEDULER_Handle *s,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  sched = s;
+  ok = 1;
+#if VERBOSE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting daemons.\n");
+#endif
+  peers_left = NUM_PEERS;
+  pg = GNUNET_TESTING_daemons_start (sched, cfg, 
+                                    peers_left,
+                                    &my_cb, NULL, NULL, NULL, NULL);
+  GNUNET_assert (pg != NULL);
+}
+
+static int
+check ()
+{
+  char *const argv[] = { "test-testing",
+    "-c",
+    "test_gnunet_daemon_topology_data.conf",
+#if VERBOSE
+    "-L", "DEBUG",
+#endif
+    NULL
+  };
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_OPTION_END
+  };
+  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
+                      argv, "test-gnunet-daemon-topology", "nohelp",
+                      options, &run, &ok);
+  return ok;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int ret;
+
+  GNUNET_log_setup ("test-gnunet-daemon-topology",
+#if VERBOSE
+                    "DEBUG",
+#else
+                    "WARNING",
+#endif
+                    NULL);
+  ret = check ();
+  sleep (1); /* FIXME: needed? */
+  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
+  return ret;
+}
+
+/* end of test_gnunet_daemon_topology.c */

Copied: gnunet/src/topology/test_gnunet_daemon_topology_data.conf (from rev 
11055, gnunet/src/topology/test_gnunet_service_topology_data.conf)
===================================================================
--- gnunet/src/topology/test_gnunet_daemon_topology_data.conf                   
        (rev 0)
+++ gnunet/src/topology/test_gnunet_daemon_topology_data.conf   2010-04-24 
13:08:05 UTC (rev 11059)
@@ -0,0 +1,37 @@
+[PATHS]
+SERVICEHOME = /tmp/test-gnunet-topology/
+# DEFAULTCONFIG = test_gnunet_service_topology_data.conf
+
+[resolver]
+PORT = 2664
+
+[transport]
+PORT = 2665
+PLUGINS = tcp
+# DEBUG = YES
+#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
+#PREFIX = valgrind --tool=memcheck --log-file=logs%p
+
+[arm]
+PORT = 2666
+DEFAULTSERVICES = peerinfo transport core topology
+
+[statistics]
+PORT = 2667
+
+[transport-tcp]
+PORT = 2668
+
+[peerinfo]
+PORT = 2669
+
+[core]
+PORT = 2670
+# DEBUG = YES
+
+[topology]
+# DEBUG = YES
+#PREFIX = valgrind --tool=memcheck
+
+[testing]
+WEAKRANDOM = YES

Deleted: gnunet/src/topology/test_gnunet_service_topology.c
===================================================================
--- gnunet/src/topology/test_gnunet_service_topology.c  2010-04-23 13:19:24 UTC 
(rev 11058)
+++ gnunet/src/topology/test_gnunet_service_topology.c  2010-04-24 13:08:05 UTC 
(rev 11059)
@@ -1,182 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 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
-     by the Free Software Foundation; either version 2, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file topology/test_gnunet_service_topology.c
- * @brief testcase for topology maintenance code
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-
-#define VERBOSE GNUNET_YES
-
-#define NUM_PEERS 2
-
-/**
- * How long until we give up on connecting the peers?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
-
-#define CONNECT_ATTEMPTS 3
-
-
-static int ok;
-
-static int peers_left;
-
-static int connect_left;
-
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-static struct GNUNET_TESTING_Daemon *first;
-
-static struct GNUNET_TESTING_Daemon *last;
-
-static struct GNUNET_SCHEDULER_Handle *sched;
-
-
-static void
-clean_up_task (void *cls,
-                const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_TESTING_daemons_stop (pg);
-  ok = 0;     
-}
-
-
-static void 
-notify_connect_complete(void *cls,
-                        const struct GNUNET_PeerIdentity *first,
-                        const struct GNUNET_PeerIdentity *second,
-                        const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-                        const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-                        struct GNUNET_TESTING_Daemon *first_daemon,
-                        struct GNUNET_TESTING_Daemon *second_daemon,
-                        const char *emsg)
-{
-  if (NULL != emsg)
-    {
-      fprintf (stderr,
-              "Failed to connect two peers: %s\n",
-              emsg);
-      GNUNET_TESTING_daemons_stop (pg);
-      GNUNET_assert (0);
-      return;
-    }
-  connect_left--;
-  if (connect_left == 0)
-    {
-      /* FIXME: check that topology adds a few more links
-        in addition to those that were seeded */
-      /* For now, sleep so we can have the daemon do some work */
-      GNUNET_SCHEDULER_add_delayed (sched,
-                                   GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 5),
-                                   &clean_up_task,
-                                   NULL);
-    }
-}
-
-
-static void my_cb(void *cls,
-                  const struct GNUNET_PeerIdentity *id,
-                  const struct GNUNET_CONFIGURATION_Handle *cfg,
-                  struct GNUNET_TESTING_Daemon *d,
-                  const char *emsg)
-{
-  GNUNET_assert (id != NULL);
-  peers_left--;  
-  if (first == NULL)
-    {
-      connect_left = NUM_PEERS;
-      first = d;
-      last = d;
-      return;
-    }
-  GNUNET_TESTING_daemons_connect (last, d, TIMEOUT, CONNECT_ATTEMPTS,
-                                 &notify_connect_complete,
-                                 NULL);
-  if (peers_left == 0)
-    {
-      /* close circle */
-      GNUNET_TESTING_daemons_connect (d, first, TIMEOUT, CONNECT_ATTEMPTS,
-                                     &notify_connect_complete,
-                                     NULL);
-    }
-}
-
-
-static void
-run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *s,
-     char *const *args,
-     const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  sched = s;
-  ok = 1;
-#if VERBOSE
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Starting daemons.\n");
-#endif
-  peers_left = NUM_PEERS;
-  pg = GNUNET_TESTING_daemons_start (sched, cfg, 
-                                    peers_left,
-                                    &my_cb, NULL, NULL, NULL, NULL);
-  GNUNET_assert (pg != NULL);
-}
-
-static int
-check ()
-{
-  char *const argv[] = { "test-testing",
-    "-c",
-    "test_gnunet_service_topology_data.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
-    NULL
-  };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
-                      argv, "test-gnunet-service-topology", "nohelp",
-                      options, &run, &ok);
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-gnunet-service-topology",
-#if VERBOSE
-                    "DEBUG",
-#else
-                    "WARNING",
-#endif
-                    NULL);
-  ret = check ();
-  sleep (1); /* FIXME: needed? */
-  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
-  return ret;
-}
-
-/* end of test_gnunet_service_topology.c */

Deleted: gnunet/src/topology/test_gnunet_service_topology_data.conf
===================================================================
--- gnunet/src/topology/test_gnunet_service_topology_data.conf  2010-04-23 
13:19:24 UTC (rev 11058)
+++ gnunet/src/topology/test_gnunet_service_topology_data.conf  2010-04-24 
13:08:05 UTC (rev 11059)
@@ -1,37 +0,0 @@
-[PATHS]
-SERVICEHOME = /tmp/test-gnunet-topology/
-# DEFAULTCONFIG = test_gnunet_service_topology_data.conf
-
-[resolver]
-PORT = 2664
-
-[transport]
-PORT = 2665
-PLUGINS = tcp
-# DEBUG = YES
-#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
-#PREFIX = valgrind --tool=memcheck --log-file=logs%p
-
-[arm]
-PORT = 2666
-DEFAULTSERVICES = peerinfo transport core topology
-
-[statistics]
-PORT = 2667
-
-[transport-tcp]
-PORT = 2668
-
-[peerinfo]
-PORT = 2669
-
-[core]
-PORT = 2670
-# DEBUG = YES
-
-[topology]
-# DEBUG = YES
-#PREFIX = valgrind --tool=memcheck
-
-[testing]
-WEAKRANDOM = YES

Modified: gnunet/src/util/test_resolver_api.c
===================================================================
--- gnunet/src/util/test_resolver_api.c 2010-04-23 13:19:24 UTC (rev 11058)
+++ gnunet/src/util/test_resolver_api.c 2010-04-24 13:08:05 UTC (rev 11059)
@@ -265,7 +265,8 @@
           _("gethostbyname() could not lookup IP address: %s\n"),
           hstrerror (h_errno));
 #endif
-      GNUNET_break(0);
+      fprintf (stderr,
+              "System seems to be off-line, will not run all DNS tests\n");
       return;
     }
 





reply via email to

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