gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r174 - GNUnet/src/applications/dht/tools


From: grothoff
Subject: [GNUnet-SVN] r174 - GNUnet/src/applications/dht/tools
Date: Fri, 4 Feb 2005 00:40:42 -0800 (PST)

Author: grothoff
Date: 2005-02-04 00:40:41 -0800 (Fri, 04 Feb 2005)
New Revision: 174

Modified:
   GNUnet/src/applications/dht/tools/dht-join.c
   GNUnet/src/applications/dht/tools/dht-query.c
Log:
making dht-join and dht-query compile again

Modified: GNUnet/src/applications/dht/tools/dht-join.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht-join.c        2005-02-04 08:31:51 UTC 
(rev 173)
+++ GNUnet/src/applications/dht/tools/dht-join.c        2005-02-04 08:40:41 UTC 
(rev 174)
@@ -147,50 +147,47 @@
 
 #define LOGRET(ret) dump(_("Call to '%s' returns %d.\n"), __FUNCTION__, ret)
 #define LOGKEY(key) do { EncName kn; hash2enc(key, &kn); dump(_("Call to '%s' 
with key '%s'.\n"), __FUNCTION__, &kn); } while (0)
-#define LOGVAL(val) dump(_("Call to '%s' with value '%.*s' (%d bytes).\n"), 
__FUNCTION__, (val == NULL) ? 0 : val->dataLength, (val == NULL) ? NULL : 
val->data, (val == NULL) ? 0 : val->dataLength)
+#define LOGVAL(val) dump(_("Call to '%s' with value '%.*s' (%d bytes).\n"), 
__FUNCTION__, (val == NULL) ? 0 : &val[1], (val == NULL) ? NULL : &val[1], (val 
== NULL) ? 0 : (ntohl(val->size) - sizeof(DataContainer)))
 
 static int lookup(void * closure,
                  unsigned int type,
+                 unsigned int prio,
                  unsigned int keyCount,
                  const HashCode160 * keys,
                  DataProcessor processor,
-                 void * closure) {
+                 void * pclosure) {
   int ret;
   Blockstore * cls = (Blockstore*) closure;  
-  LOGKEY(key);
+  LOGKEY(&keys[0]);
   ret = cls->get(cls->closure,
                 type,
-                0, /* prio */
+                prio,
                 keyCount,
                 keys,
                 processor,
-                results);
-  if (ret >= 1)
-    LOGVAL(results);
+                pclosure);
   LOGRET(ret);  
   return ret;
 }
   
 static int store(void * closure,
                 const HashCode160 * key,
-                unsigned int type,
-                const DataContainer * value) {
+                const DataContainer * value,
+                unsigned int prio) {
   int ret;
   Blockstore * cls = (Blockstore*) closure;
   LOGKEY(key);
   LOGVAL(value);
   ret = cls->put(cls->closure,
                 key,
-                type,
                 value,
-                0 /* prio */);
+                prio);
   LOGRET(ret);
   return ret;
 }
 
 static int removeDS(void * closure,
                    const HashCode160 * key,
-                   unsigned int type,
                    const DataContainer * value) {
   int ret;
   Blockstore * cls = (Blockstore*) closure;
@@ -198,7 +195,6 @@
   LOGVAL(value);
   ret = cls->del(cls->closure,
                 key,
-                type,
                 value);
   LOGRET(ret);
   return ret;
@@ -243,17 +239,16 @@
   mem = getConfigurationInt("DHT-JOIN",
                            "MEMORY");
   if (mem == 0) mem = 65536; /* default: use 64k */
-  myStore.closure = create_blockstore_memory(em);
-  myStore.lookup = &lookup;
-  myStore.store = &store;
-  myStore.remove = &removeDS;
+  myStore.closure = create_blockstore_memory(mem);
+  myStore.get = &lookup;
+  myStore.put = &store;
+  myStore.del = &removeDS;
   myStore.iterate = &iterate;
 
   DHT_LIB_init();
   initializeShutdownHandlers();
   if (OK != DHT_LIB_join(&myStore,
-                        &table,
-                        0)) {
+                        &table)) {
     LOG(LOG_WARNING,
        _("Error joining DHT.\n"));
     destroy_blockstore_memory((Blockstore*)myStore.closure);

Modified: GNUnet/src/applications/dht/tools/dht-query.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht-query.c       2005-02-04 08:31:51 UTC 
(rev 173)
+++ GNUnet/src/applications/dht/tools/dht-query.c       2005-02-04 08:40:41 UTC 
(rev 174)
@@ -24,6 +24,7 @@
  */
 
 #include "platform.h"
+#include "gnunet_protocols.h"
 #include "gnunet_util.h"
 #include "gnunet_dht_lib.h"
 
@@ -111,8 +112,9 @@
   return OK;
 }
 
-static int printCallback(DataContainer * data,
-                        const char * key) {
+static int printCallback(const HashCode160 * hash,
+                        const DataContainer * data,
+                        char * key) {
   printf("%s(%s): '%.*s'\n",
         "get",
         key,
@@ -134,12 +136,13 @@
       "get", key);
   ret = DHT_LIB_get(&table,
                    DHT_STRING2STRING_BLOCK,
-                   1,
+                   1, /* prio */
+                   1, /* key count */
                    &hc,
                    getConfigurationInt("DHT-QUERY",
                                        "TIMEOUT"),
-                   &printCallback,
-                   key);
+                   (DataProcessor) &printCallback,
+                   (void*) key);
   if (ret == 0) 
     printf("%s(%s) operation returned no results.\n",
           "get",
@@ -161,12 +164,12 @@
   LOG(LOG_DEBUG,
       "Issuing '%s(%s,%s)' command.\n",
       "put", key, value);
-  if (OK == DHT_LIB_put(&table,
+  if (OK == DHT_LIB_put(&table,                       
                        &hc,
-                       DHT_STRING2STRING_BLOCK,
+                       1, /* prio */
                        getConfigurationInt("DHT-QUERY",
                                            "TIMEOUT"),
-                       &dc)) { 
+                       dc)) { 
     printf(_("'%s(%s,%s)' succeeded\n"),
           "put",
           key, value);
@@ -194,11 +197,10 @@
       "Issuing '%s(%s,%s)' command.\n",
       "remove", key, value);
   if (OK == DHT_LIB_remove(&table,
-                          DHT_STRING2STRING_BLOCK,
                           &hc,
                           getConfigurationInt("DHT-QUERY",
                                               "TIMEOUT"),
-                          &dc)) { 
+                          dc)) { 
     printf(_("'%s(%s,%s)' succeeded\n"),
           "remove",
           key, value);





reply via email to

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