[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5892 - in GNUnet/src: applications applications/advertisin
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5892 - in GNUnet/src: applications applications/advertising applications/datastore applications/dht/module applications/dht/tools applications/fs applications/fs/ecrs applications/fs/lib applications/fs/module applications/gap applications/sqstore_mysql applications/sqstore_sqlite applications/stats applications/tracekit include |
Date: |
Thu, 13 Dec 2007 00:03:58 -0700 (MST) |
Author: grothoff
Date: 2007-12-13 00:03:58 -0700 (Thu, 13 Dec 2007)
New Revision: 5892
Modified:
GNUnet/src/applications/Makefile.am
GNUnet/src/applications/advertising/advertising_test.c
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/dht/module/routing.c
GNUnet/src/applications/dht/module/routing.h
GNUnet/src/applications/dht/module/service.c
GNUnet/src/applications/dht/tools/dht-query.c
GNUnet/src/applications/dht/tools/dhttest.c
GNUnet/src/applications/dht/tools/dhttest2.c
GNUnet/src/applications/fs/ecrs/download.c
GNUnet/src/applications/fs/ecrs/keyspace.c
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/unindex.c
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/ecrs_core.c
GNUnet/src/applications/fs/ecrs_core_test.c
GNUnet/src/applications/fs/lib/fslibtest.c
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/applications/fs/module/migration.c
GNUnet/src/applications/fs/module/ondemand.c
GNUnet/src/applications/fs/module/querymanager.c
GNUnet/src/applications/gap/gap.c
GNUnet/src/applications/sqstore_mysql/mysqltest.c
GNUnet/src/applications/sqstore_sqlite/sqlite.c
GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
GNUnet/src/applications/stats/sqstats.c
GNUnet/src/applications/tracekit/tracekittest.c
GNUnet/src/include/gnunet_dht_service.h
GNUnet/src/include/gnunet_protocols.h
Log:
renaming, towards working tracekit and dht tests
Modified: GNUnet/src/applications/Makefile.am
===================================================================
--- GNUnet/src/applications/Makefile.am 2007-12-13 06:47:05 UTC (rev 5891)
+++ GNUnet/src/applications/Makefile.am 2007-12-13 07:03:58 UTC (rev 5892)
@@ -31,12 +31,12 @@
tbench \
template \
topology_default \
- tracekit \
traffic \
transport \
advertising \
gap \
dht \
+ tracekit \
$(VPN_DIR)
# $(TESTBED_DIR)
# chat
Modified: GNUnet/src/applications/advertising/advertising_test.c
===================================================================
--- GNUnet/src/applications/advertising/advertising_test.c 2007-12-13
06:47:05 UTC (rev 5891)
+++ GNUnet/src/applications/advertising/advertising_test.c 2007-12-13
07:03:58 UTC (rev 5892)
@@ -146,4 +146,4 @@
return ret;
}
-/* end of dhttest.c */
+/* end of advertising_test.c */
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/datastore/datastore.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -292,8 +292,8 @@
cls.exists = GNUNET_NO;
cls.value = value;
sq->get (key, ntohl (value->type), &checkExists, &cls);
- if (ntohl (value->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
- sq->get (key, GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &checkExists, &cls);
+ if (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_DATA)
+ sq->get (key, GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &checkExists, &cls);
if (cls.exists)
{
@@ -379,10 +379,10 @@
available = quota - sq->getSize ();
if ((available < 0) || (available < MIN_GNUNET_free))
{
- sq->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ sq->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
&freeSpaceExpired, NULL);
if ((available < 0) || (available < MIN_GNUNET_free))
- sq->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ sq->iterateLowPriority (GNUNET_ECRS_BLOCKTYPE_ANY,
&freeSpaceLow, NULL);
}
else
Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/dht/module/routing.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2006 Christian Grothoff (and other contributing authors)
+ (C) 2006, 2007 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
@@ -24,8 +24,9 @@
* @author Christian Grothoff
*
* LATER:
- * - prioritization
- * - delay selection
+ * - better selection of timeouts / htl
+ * - add code to cleanup routing/request table!
+ * - optimize memory use of routing table
* - implement extra_get_callback
* - add similar callback for discovery in table.c
*/
@@ -40,6 +41,38 @@
#define DEBUG_ROUTING GNUNET_NO
/**
+ * Larger factors will result in more aggressive routing of GET
+ * operations (each peer will either forward to GET_TRIES peers that
+ * are closer to the key).
+ */
+#define GET_TRIES 4
+
+/**
+ * Larger factors will result in more replication and
+ * more aggressive routing of PUT operations (each
+ * peer will either forward to PUT_TRIES peers that
+ * are closer to the key, or replicate the content).
+ */
+#define PUT_TRIES 2
+
+/**
+ * FIXME: replace this by an estimate of the
+ * network size (and then log of that).
+ */
+#define MAX_HOPS 10
+
+/**
+ * How long do we keep track of requests?
+ */
+#define MAX_REQUEST_LIFETIME (5 * GNUNET_CRON_MINUTES)
+
+
+/**
+ * How long do we keep track of requests?
+ */
+#define CONTENT_LIFETIME (12 * GNUNET_CRON_HOURS)
+
+/**
* @brief record used for sending response back
*/
typedef struct DHT_Source_Route
@@ -64,10 +97,19 @@
void *receiver_closure;
+ /**
+ * At what time will this record automatically
+ * expire?
+ */
+ GNUNET_CronTime expires;
+
} DHT_Source_Route;
/**
- * @brief message send for DHT lookup
+ * @brief message send for DHT get, put or result.
+ * PUT and RESULT messages are followed by
+ * the content. "header.type" distinguishes
+ * the three types of messages.
*/
typedef struct
{
@@ -80,79 +122,32 @@
unsigned int type;
/**
- * Priority of requested content (NBO)
+ * Number of hops this message has passed (NBO)
*/
- unsigned int prio;
+ unsigned int hop_count;
/**
- * Relative time to live in GNUNET_CRON_MILLISECONDS (NBO)
+ * Reserved (use 0).
*/
- int ttl;
-
+ unsigned int reserved;
+
/**
* Search key.
*/
GNUNET_HashCode key;
-} DHT_GET_MESSAGE;
+} DHT_MESSAGE;
/**
- * @brief message send for DHT put
- *
- * Message is followed by the data.
- */
-typedef struct
-{
-
- GNUNET_MessageHeader header;
-
- /**
- * Type of the content (NBO)
- */
- unsigned int type;
-
- /**
- * When to discard the content (relative time, NBO)
- */
- GNUNET_CronTime timeout;
-
- /**
- * Key for the content.
- */
- GNUNET_HashCode key;
-
-} DHT_PUT_MESSAGE;
-
-/**
- * @brief message send for DHT put
- *
- * Message is followed by the data.
- */
-typedef struct
-{
-
- GNUNET_MessageHeader header;
-
- /**
- * Type of the content (NBO)
- */
- unsigned int type;
-
- /**
- * Key for the content.
- */
- GNUNET_HashCode key;
-
-} DHT_RESULT_MESSAGE;
-
-/**
* Entry in the DHT routing table.
*/
typedef struct DHTQueryRecord
{
/**
- * When do we stop forwarding this request?
+ * When do we stop forwarding this request? (Note that
+ * this time should be before the last of the source
+ * routes expire).
*/
GNUNET_CronTime expires;
@@ -162,30 +157,24 @@
DHT_Source_Route *sources;
/**
- * GET message of this record.
+ * GET message of this record (what we are forwarding).
*/
- DHT_GET_MESSAGE *get;
+ DHT_MESSAGE * get;
/**
* Hashcodes of the results that we have send back
* so far.
*/
- GNUNET_HashCode *results;
+ GNUNET_HashCode * results;
/**
* Number of entries in results.
*/
unsigned int result_count;
+
} DHTQueryRecord;
/**
- * How far into the future can requests continue?
- * Note that this also caps the frequency of how
- * often peers will re-issue requests.
- */
-#define MAX_TTL (5 * GNUNET_CRON_MINUTES)
-
-/**
* Linked list of active records.
*/
static DHTQueryRecord **records;
@@ -228,10 +217,11 @@
int j;
int found;
GNUNET_HashCode hc;
- DHT_RESULT_MESSAGE *result;
+ DHT_MESSAGE *result;
unsigned int routed;
unsigned int tracked;
DHT_Source_Route *pos;
+ GNUNET_CronTime now;
if (cls != NULL)
{
@@ -239,10 +229,12 @@
}
else
{
- result = GNUNET_malloc (sizeof (DHT_RESULT_MESSAGE) + size);
- result->header.size = htons (sizeof (DHT_RESULT_MESSAGE) + size);
+ result = GNUNET_malloc (sizeof (DHT_MESSAGE) + size);
+ result->header.size = htons (sizeof (DHT_MESSAGE) + size);
result->header.type = htons (GNUNET_P2P_PROTO_DHT_RESULT);
result->type = htonl (type);
+ result->hop_count = htonl(0);
+ result->reserved = htonl(0);
result->key = *key;
memcpy (&result[1], data, size);
}
@@ -250,6 +242,7 @@
routed = 0;
tracked = 0;
GNUNET_mutex_lock (lock);
+ now = GNUNET_get_time();
for (i = 0; i < rt_size; i++)
{
q = records[i];
@@ -268,14 +261,15 @@
}
if (found == GNUNET_YES)
continue;
- GNUNET_array_grow (q->results, q->result_count, q->result_count + 1);
routed++;
+ GNUNET_array_grow (q->results, q->result_count, q->result_count + 1);
q->results[q->result_count - 1] = hc;
pos = q->sources;
while (pos != NULL)
{
- if (0 != memcmp (&pos->source,
- coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity)))
+ if ( (pos->expires < now) &&
+ (0 != memcmp (&pos->source,
+ coreAPI->myIdentity, sizeof
(GNUNET_PeerIdentity))) )
{
#if DEBUG_ROUTING
GNUNET_GE_LOG (coreAPI->ectx,
@@ -283,12 +277,13 @@
GNUNET_GE_DEVELOPER,
"Routing result to other peer\n");
#endif
- coreAPI->unicast (&pos->source, &result->header, 0, /*
FIXME: priority */
- 5 * GNUNET_CRON_SECONDS); /* FIXME */
+ coreAPI->unicast (&pos->source,
+ &result->header, 0,
+ pos->expires - now);
if (stats != NULL)
stats->change (stat_replies_routed, 1);
}
- else if (pos->receiver != NULL)
+ if (pos->receiver != NULL)
{
#if DEBUG_ROUTING
GNUNET_GE_LOG (coreAPI->ectx,
@@ -320,75 +315,66 @@
static int
addRoute (const GNUNET_PeerIdentity * sender,
GNUNET_ResultProcessor handler, void *cls,
- const DHT_GET_MESSAGE * get)
+ const DHT_MESSAGE * get)
{
DHTQueryRecord *q;
unsigned int i;
unsigned int rt_pos;
GNUNET_CronTime expire;
GNUNET_CronTime now;
- int ttl;
+ unsigned int hops;
struct DHT_Source_Route *pos;
- ttl = ntohl (get->ttl);
- if (ttl > MAX_TTL)
- ttl = 0; /* implausibly high */
+ hops = ntohl (get->hop_count);
+ if (hops > MAX_HOPS)
+ return GNUNET_SYSERR;
now = GNUNET_get_time ();
- expire = now + ttl;
+ expire = now + MAX_REQUEST_LIFETIME;
GNUNET_mutex_lock (lock);
rt_pos = rt_size;
for (i = 0; i < rt_size; i++)
{
- if ((sender != NULL) &&
- (records[i] != NULL) &&
- (0 == memcmp (&records[i]->get->key,
- &get->key,
- sizeof (GNUNET_HashCode))) &&
- (records[i]->get->type == get->type) &&
- (records[i]->expires > now - MAX_TTL))
+ if ( (records[i] != NULL) &&
+ (0 == memcmp (&records[i]->get->key,
+ &get->key,
+ sizeof (GNUNET_HashCode))) &&
+ (records[i]->get->type == get->type) )
{
- /* do not route, same request already (recently)
- active (possibly from other initiator) */
- /* FIXME: support sending replies back to
- multiple peers!? */
- GNUNET_mutex_unlock (lock);
- return GNUNET_SYSERR;
+ rt_pos = i;
+ break;
}
- if (records[i] == NULL)
- {
- rt_pos = i;
- expire = 0;
- }
- else if (records[i]->expires < expire)
- {
- expire = records[i]->expires;
- rt_pos = i;
- }
+ if (records[i] == NULL)
+ {
+ rt_pos = i;
+ break;
+ }
+ if (records[i]->expires < now)
+ {
+ rt_pos = i;
+ GNUNET_free(records[rt_pos]->get);
+ records[rt_pos]->get = NULL;
+ while (records[rt_pos]->sources != NULL)
+ {
+ pos = records[rt_pos]->sources;
+ records[rt_pos]->sources = pos->next;
+ GNUNET_free (pos);
+ }
+ break;
+ }
}
if (rt_pos == rt_size)
{
- /* do not route, expiration time too high */
+ /* do not route, no slot available */
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
if (records[rt_pos] == NULL)
{
records[rt_pos] = GNUNET_malloc (sizeof (DHTQueryRecord));
- records[rt_pos]->get = NULL;
+ memset (records[rt_pos], 0, sizeof (DHTQueryRecord));
}
- if (records[rt_pos]->get != NULL)
- {
- GNUNET_free (records[rt_pos]->get);
- while (records[rt_pos]->sources != NULL)
- {
- pos = records[rt_pos]->sources;
- records[rt_pos]->sources = pos->next;
- GNUNET_free (pos);
- }
- }
q = records[rt_pos];
- memset (q, 0, sizeof (DHTQueryRecord));
- q->expires = now + ttl;
+ q->expires = expire;
q->get = GNUNET_malloc (ntohs (get->header.size));
memcpy (q->get, get, ntohs (get->header.size));
pos = GNUNET_malloc (sizeof (DHT_Source_Route));
@@ -398,6 +384,7 @@
pos->source = *sender;
else
pos->source = *coreAPI->myIdentity;
+ pos->expires = expire;
pos->receiver = handler;
pos->receiver_closure = cls;
#if DEBUG_ROUTING
@@ -405,7 +392,6 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Tracking request in slot %u\n", rt_pos);
#endif
- rt_pos = (rt_pos + 1) % rt_size;
GNUNET_mutex_unlock (lock);
if (stats != NULL)
stats->change (stat_requests_routed, 1);
@@ -413,13 +399,6 @@
}
/**
- * Larger factors will result in more aggressive routing of GET
- * operations (each peer will either forward to GET_TRIES peers that
- * are closer to the key).
- */
-#define GET_TRIES 4
-
-/**
* Handle GET message.
*/
static int
@@ -427,21 +406,20 @@
const GNUNET_MessageHeader * msg)
{
GNUNET_PeerIdentity next[GET_TRIES];
- const DHT_GET_MESSAGE *get;
- DHT_GET_MESSAGE aget;
+ const DHT_MESSAGE *get;
+ DHT_MESSAGE aget;
int total;
- int ttl;
int i;
#if DEBUG_ROUTING
GNUNET_EncName enc;
#endif
- if (ntohs (msg->size) != sizeof (DHT_GET_MESSAGE))
+ if (ntohs (msg->size) != sizeof (DHT_MESSAGE))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- get = (const DHT_GET_MESSAGE *) msg;
+ get = (const DHT_MESSAGE *) msg;
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&get->key, &enc);
GNUNET_GE_LOG (coreAPI->ectx,
@@ -464,41 +442,21 @@
#endif
return GNUNET_OK;
}
- total = 0;
+ aget = *get;
+ aget.hop_count = htonl(1 + ntohl(get->hop_count));
for (i = 0; i < GET_TRIES; i++)
{
if (GNUNET_OK != select_dht_peer (&next[i], &get->key, &next[0], i))
break;
if (-1 == GNUNET_hash_xorcmp (&next[i].hashPubKey,
&coreAPI->myIdentity->hashPubKey,
- &get->key))
- {
- if (total == 0)
- {
- aget = *get;
- ttl = ntohl (get->ttl);
- if (ttl > MAX_TTL)
- ttl = MAX_TTL;
- ttl -= 5 * GNUNET_CRON_SECONDS;
- aget.ttl = htonl (ttl);
- total = 1;
- }
- coreAPI->unicast (&next[i], msg, 0, /* FIXME: priority */
- 5 * GNUNET_CRON_SECONDS); /* FIXME */
- }
+ &get->key))
+ coreAPI->unicast (&next[i], &aget.header, 0, 5 * GNUNET_CRON_SECONDS);
}
return GNUNET_OK;
}
/**
- * Larger factors will result in more replication and
- * more aggressive routing of PUT operations (each
- * peer will either forward to PUT_TRIES peers that
- * are closer to the key, or replicate the content).
- */
-#define PUT_TRIES 2
-
-/**
* Handle PUT message.
*/
static int
@@ -506,7 +464,7 @@
const GNUNET_MessageHeader * msg)
{
GNUNET_PeerIdentity next[PUT_TRIES];
- const DHT_PUT_MESSAGE *put;
+ const DHT_MESSAGE * put;
GNUNET_CronTime now;
int store;
int i;
@@ -514,14 +472,14 @@
GNUNET_EncName enc;
#endif
- if (ntohs (msg->size) < sizeof (DHT_PUT_MESSAGE))
+ if (ntohs (msg->size) < sizeof (DHT_MESSAGE))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (stats != NULL)
stats->change (stat_put_requests_received, 1);
- put = (const DHT_PUT_MESSAGE *) msg;
+ put = (const DHT_MESSAGE *) msg;
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&put->key, &enc);
GNUNET_GE_LOG (coreAPI->ectx,
@@ -529,6 +487,7 @@
"Received DHT PUT for key `%s'.\n", &enc);
#endif
store = 0;
+ /* FIXME: increase hop counter! */
for (i = 0; i < PUT_TRIES; i++)
{
if (GNUNET_OK != select_dht_peer (&next[i], &put->key, &next[0], i))
@@ -541,8 +500,7 @@
&put->key))
store = 1; /* we're closer than the selected target */
else
- coreAPI->unicast (&next[i], msg, 0, /* FIXME: priority */
- 5 * GNUNET_CRON_SECONDS); /* FIXME */
+ coreAPI->unicast (&next[i], msg, 0, 5 * GNUNET_CRON_SECONDS);
}
if (store != 0)
{
@@ -552,14 +510,14 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Decided to cache data `%.*s' locally until %llu (for
%llu ms)\n",
- ntohs (put->header.size) - sizeof (DHT_PUT_MESSAGE),
- &put[1], GNUNET_ntohll (put->timeout) + now,
+ ntohs (put->header.size) - sizeof (DHT_MESSAGE),
+ &put[1], CONTENT_LIFETIME + now,
GNUNET_ntohll (put->timeout));
#endif
dht_store_put (ntohl (put->type),
&put->key,
- GNUNET_ntohll (MAKE_UNALIGNED (put->timeout)) + now,
- ntohs (put->header.size) - sizeof (DHT_PUT_MESSAGE),
+ CONTENT_LIFETIME + now,
+ ntohs (put->header.size) - sizeof (DHT_MESSAGE),
(const char *) &put[1]);
}
else
@@ -569,7 +527,7 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Decided NOT to cache data `%.*s' locally\n",
- ntohs (put->header.size) - sizeof (DHT_PUT_MESSAGE),
+ ntohs (put->header.size) - sizeof (DHT_MESSAGE),
&put[1]);
#endif
}
@@ -583,19 +541,19 @@
handleResult (const GNUNET_PeerIdentity * sender,
const GNUNET_MessageHeader * msg)
{
- const DHT_RESULT_MESSAGE *result;
+ const DHT_MESSAGE *result;
#if DEBUG_ROUTING
GNUNET_EncName enc;
#endif
- if (ntohs (msg->size) < sizeof (DHT_RESULT_MESSAGE))
+ if (ntohs (msg->size) < sizeof (DHT_MESSAGE))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (stats != NULL)
stats->change (stat_results_received, 1);
- result = (const DHT_RESULT_MESSAGE *) msg;
+ result = (const DHT_MESSAGE *) msg;
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&result->key, &enc);
GNUNET_GE_LOG (coreAPI->ectx,
@@ -604,7 +562,7 @@
#endif
routeResult (&result->key,
ntohl (result->type),
- ntohs (result->header.size) - sizeof (DHT_RESULT_MESSAGE),
+ ntohs (result->header.size) - sizeof (DHT_MESSAGE),
(const char *) &result[1], (void *) msg);
return GNUNET_OK;
}
@@ -612,29 +570,31 @@
/**
* Start a DHT get operation.
*/
-void
-dht_get_start (const GNUNET_HashCode * key,
+int
+GNUNET_DHT_get_start (const GNUNET_HashCode * key,
unsigned int type, GNUNET_ResultProcessor handler, void *cls)
{
- DHT_GET_MESSAGE get;
+ DHT_MESSAGE get;
- get.header.size = htons (sizeof (DHT_GET_MESSAGE));
+ get.header.size = htons (sizeof (DHT_MESSAGE));
get.header.type = htons (GNUNET_P2P_PROTO_DHT_GET);
get.type = htonl (type);
- get.prio = htonl (0); /* FIXME */
- get.ttl = htonl (MAX_TTL); /* FIXME? */
+ get.hop_count = htonl(0);
+ get.reserved = htonl(0);
get.key = *key;
- if (GNUNET_OK == addRoute (NULL, handler, cls, &get))
- handleGet (NULL, &get.header);
+ if (GNUNET_OK != addRoute (NULL, handler, cls, &get))
+ return GNUNET_SYSERR;
+ handleGet (NULL, &get.header);
+ return GNUNET_OK;
}
/**
* Stop a DHT get operation (prevents calls to
* the given iterator).
*/
-void
-dht_get_stop (const GNUNET_HashCode * key,
- unsigned int type, GNUNET_ResultProcessor handler, void *cls)
+int
+GNUNET_DHT_get_stop (const GNUNET_HashCode * key,
+ unsigned int type, GNUNET_ResultProcessor handler, void
*cls)
{
int i;
struct DHT_Source_Route *pos;
@@ -677,6 +637,9 @@
break;
}
GNUNET_mutex_unlock (lock);
+ if (done != GNUNET_YES)
+ return GNUNET_SYSERR;
+ return GNUNET_OK;
}
/**
@@ -688,22 +651,24 @@
*
* @param expirationTime absolute expiration time
*/
-void
-dht_put (const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size, GNUNET_CronTime expirationTime, const char *data)
+int
+GNUNET_DHT_put (const GNUNET_HashCode * key,
+ unsigned int type,
+ unsigned int size, GNUNET_CronTime expirationTime, const char
*data)
{
- DHT_PUT_MESSAGE *put;
+ DHT_MESSAGE *put;
- put = GNUNET_malloc (sizeof (DHT_PUT_MESSAGE) + size);
- put->header.size = htons (sizeof (DHT_PUT_MESSAGE) + size);
+ put = GNUNET_malloc (sizeof (DHT_MESSAGE) + size);
+ put->header.size = htons (sizeof (DHT_MESSAGE) + size);
put->header.type = htons (GNUNET_P2P_PROTO_DHT_PUT);
put->key = *key;
put->type = htonl (type);
- put->timeout = GNUNET_htonll (expirationTime - GNUNET_get_time ()); /*
convert to relative time */
+ put->hop_count = htonl(0);
+ put->reserved = htonl(0);
memcpy (&put[1], data, size);
handlePut (NULL, &put->header);
GNUNET_free (put);
+ return GNUNET_OK;
}
/**
@@ -718,6 +683,7 @@
extra_get_callback (const GNUNET_PeerIdentity * receiver,
void *position, unsigned int padding)
{
+ /* FIXME */
return 0;
}
@@ -728,7 +694,7 @@
* @return GNUNET_OK on success
*/
int
-init_dht_routing (GNUNET_CoreAPIForPlugins * capi)
+GNUNET_DHT_init_routing (GNUNET_CoreAPIForPlugins * capi)
{
unsigned long long rts;
@@ -763,7 +729,7 @@
coreAPI->registerHandler (GNUNET_P2P_PROTO_DHT_PUT, &handlePut);
coreAPI->registerHandler (GNUNET_P2P_PROTO_DHT_RESULT, &handleResult);
coreAPI->
- GNUNET_CORE_connection_register_send_callback (sizeof (DHT_GET_MESSAGE),
+ GNUNET_CORE_connection_register_send_callback (sizeof (DHT_MESSAGE),
&extra_get_callback);
return GNUNET_OK;
}
@@ -774,12 +740,12 @@
* @return GNUNET_OK on success
*/
int
-done_dht_routing ()
+GNUNET_DHT_done_routing ()
{
unsigned int i;
coreAPI->
- GNUNET_CORE_connection_unregister_send_callback (sizeof (DHT_GET_MESSAGE),
+ GNUNET_CORE_connection_unregister_send_callback (sizeof (DHT_MESSAGE),
&extra_get_callback);
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_GET, &handleGet);
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_PUT, &handlePut);
Modified: GNUnet/src/applications/dht/module/routing.h
===================================================================
--- GNUnet/src/applications/dht/module/routing.h 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/dht/module/routing.h 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -35,17 +35,17 @@
/**
* Start a DHT get operation.
*/
-void dht_get_start (const GNUNET_HashCode * key,
- unsigned int type, GNUNET_ResultProcessor handler,
- void *cls);
+int GNUNET_DHT_get_start (const GNUNET_HashCode * key,
+ unsigned int type, GNUNET_ResultProcessor handler,
+ void *cls);
/**
* Stop a DHT get operation (prevents calls to
* the given iterator).
*/
-void dht_get_stop (const GNUNET_HashCode * key,
- unsigned int type, GNUNET_ResultProcessor handler,
- void *cls);
+int GNUNET_DHT_get_stop (const GNUNET_HashCode * key,
+ unsigned int type, GNUNET_ResultProcessor handler,
+ void *cls);
/**
* Perform a DHT put operation. Note that PUT operations always
@@ -56,10 +56,10 @@
*
* @param expirationTime absolute expiration time
*/
-void dht_put (const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size, GNUNET_CronTime expirationTime,
- const char *data);
+int GNUNET_DHT_put (const GNUNET_HashCode * key,
+ unsigned int type,
+ unsigned int size, GNUNET_CronTime expirationTime,
+ const char *data);
/**
* Initialize routing DHT component.
@@ -67,13 +67,13 @@
* @param capi the core API
* @return GNUNET_OK on success
*/
-int init_dht_routing (GNUNET_CoreAPIForPlugins * capi);
+int GNUNET_DHT_init_routing (GNUNET_CoreAPIForPlugins * capi);
/**
* Shutdown routing DHT component.
*
* @return GNUNET_OK on success
*/
-int done_dht_routing (void);
+int GNUNET_DHT_done_routing (void);
#endif
Modified: GNUnet/src/applications/dht/module/service.c
===================================================================
--- GNUnet/src/applications/dht/module/service.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/dht/module/service.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -134,8 +134,12 @@
ret->callbackComplete = callbackComplete;
ret->closure = closure;
ret->type = type;
+ if (GNUNET_OK != GNUNET_DHT_get_start (key, type, &client_result_converter,
ret))
+ {
+ GNUNET_free(ret);
+ return NULL;
+ }
GNUNET_cron_add_job (cron, &timeout_callback, timeout, 0, ret);
- dht_get_start (key, type, &client_result_converter, ret);
return ret;
}
@@ -148,7 +152,7 @@
GNUNET_cron_suspend_jobs (cron, GNUNET_YES);
GNUNET_cron_del_job (cron, &timeout_callback, 0, record);
GNUNET_cron_resume_jobs (cron, GNUNET_YES);
- dht_get_stop (&record->key, record->type, &client_result_converter, record);
+ GNUNET_DHT_get_stop (&record->key, record->type, &client_result_converter,
record);
GNUNET_free (record);
return GNUNET_OK;
}
@@ -178,7 +182,7 @@
done_dht_store ();
return NULL;
}
- if (GNUNET_OK != init_dht_routing (capi))
+ if (GNUNET_OK != GNUNET_DHT_init_routing (capi))
{
GNUNET_GE_BREAK (capi->ectx, 0);
done_dht_table ();
@@ -188,7 +192,7 @@
coreAPI = capi;
api.get_start = &dht_get_async_start;
api.get_stop = &dht_get_async_stop;
- api.put = &dht_put;
+ api.put = &GNUNET_DHT_put;
return &api;
}
@@ -199,7 +203,7 @@
release_module_dht ()
{
GNUNET_cron_stop (cron);
- done_dht_routing ();
+ GNUNET_DHT_done_routing ();
done_dht_table ();
done_dht_store ();
GNUNET_cron_destroy (cron);
Modified: GNUnet/src/applications/dht/tools/dht-query.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht-query.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/dht/tools/dht-query.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -90,7 +90,7 @@
timeout = 30 * GNUNET_CRON_SECONDS;
ret = GNUNET_DHT_get (cfg,
ectx,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&hc, timeout, &printCallback, (void *) key);
if (ret == 0)
printf (_("%s(%s) operation returned no results.\n"), "get", key);
@@ -114,7 +114,7 @@
#endif
if (timeout == 0)
timeout = 30 * GNUNET_CRON_MINUTES;
- if (GNUNET_OK == GNUNET_DHT_put (cfg, ectx, &hc,
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING, timeout + GNUNET_get_time (),
/* convert to absolute time */
+ if (GNUNET_OK == GNUNET_DHT_put (cfg, ectx, &hc,
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING, timeout + GNUNET_get_time (),
/* convert to absolute time */
dc))
{
printf (_("'%s(%s,%s)' succeeded\n"), "put", key, value);
Modified: GNUnet/src/applications/dht/tools/dhttest.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/dht/tools/dhttest.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -137,7 +137,7 @@
CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
ectx,
&key,
-
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
GNUNET_get_time () +
15 * GNUNET_CRON_MINUTES *
NUM_ROUNDS * NUM_PEERS * NUM_PEERS,
@@ -161,7 +161,7 @@
fprintf (stderr, "Peer %d gets key %d", i, j);
if (0 < GNUNET_DHT_get (cfg,
ectx,
-
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key,
(NUM_ROUNDS - k) * GNUNET_CRON_SECONDS,
NULL, NULL))
Modified: GNUnet/src/applications/dht/tools/dhttest2.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest2.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/dht/tools/dhttest2.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -160,13 +160,13 @@
CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
ectx,
&key,
-
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
GNUNET_get_time () +
5 * GNUNET_CRON_MINUTES, value));
printf ("Peer1 gets key2\n");
CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 2 * GNUNET_CRON_SECONDS, NULL, NULL));
/* switch to peer2 */
GNUNET_GC_set_configuration_value_string (cfg,
@@ -181,20 +181,20 @@
CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
ectx,
&key,
-
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
GNUNET_get_time () +
5 * GNUNET_CRON_MINUTES, value));
printf ("Peer2 gets key.\n");
CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 2 * GNUNET_CRON_SECONDS, NULL, NULL));
GNUNET_hash ("key2", 4, &key);
printf ("Peer2 gets key2.\n");
CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 30 * GNUNET_CRON_SECONDS, NULL, NULL));
/* switch to peer1 */
GNUNET_GC_set_configuration_value_string (cfg,
@@ -204,7 +204,7 @@
printf ("Peer1 gets key\n");
CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 30 * GNUNET_CRON_SECONDS, NULL, NULL));
/* end of actual test code */
Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs/download.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -1168,7 +1168,7 @@
= GNUNET_FS_start_search (rm->sctx,
rm->have_target ==
GNUNET_NO ? NULL : &rm->target,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA, 1,
+ GNUNET_ECRS_BLOCKTYPE_DATA, 1,
&entry->node->chk.query,
entry->node->ctx->anonymityLevel, priority,
timeout, &nodeReceive, entry->node);
Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -69,7 +69,7 @@
GNUNET_EC_file_block_check_and_get_query (size, (DBlock *) & value[1],
GNUNET_YES, &query))
return GNUNET_SYSERR;
- GNUNET_GE_ASSERT (ectx, type == GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
+ GNUNET_GE_ASSERT (ectx, type == GNUNET_ECRS_BLOCKTYPE_KEYWORD);
if (size < sizeof (KBlock))
return GNUNET_SYSERR;
@@ -163,7 +163,7 @@
size = MAX_KBLOCK_SIZE;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
kb = (KBlock *) & value[1];
- kb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
+ kb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
mdsize = size - sizeof (KBlock) - strlen (dstURI) - 1;
mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
@@ -184,7 +184,7 @@
{
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
kb = (KBlock *) & value[1];
- kb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
+ kb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
GNUNET_GE_ASSERT (ectx,
mdsize ==
@@ -197,7 +197,7 @@
GNUNET_ECRS_SERIALIZE_FULL));
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
- value->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
+ value->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
value->prio = htonl (priority);
value->anonymityLevel = htonl (anonymityLevel);
value->expirationTime = GNUNET_htonll (expirationTime);
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -178,7 +178,7 @@
size = MAX_NBLOCK_SIZE;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
nb = (NBlock *) & value[1];
- nb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
+ nb->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
mdsize = size - sizeof (NBlock);
mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
meta,
@@ -198,14 +198,14 @@
{
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
nb = (NBlock *) & value[1];
- nb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
+ nb->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
GNUNET_ECRS_meta_data_serialize (ectx,
meta,
(char *) &nb[1], mdsize,
GNUNET_ECRS_SERIALIZE_FULL);
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
- value->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
+ value->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
value->prio = htonl (priority);
value->anonymityLevel = htonl (anonymityLevel);
value->expirationTime = GNUNET_htonll (expiration);
@@ -245,10 +245,10 @@
size += sizeof (KNBlock) - sizeof (NBlock);
knvalue = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
*knvalue = *value;
- knvalue->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
+ knvalue->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
knvalue->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
knb = (KNBlock *) & knvalue[1];
- knb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
+ knb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
memcpy (&knb->nblock, nb, sizeof (NBlock) + mdsize);
if (advertisementURI != NULL)
@@ -449,7 +449,7 @@
size = MAX_SBLOCK_SIZE;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
sb = (SBlock *) & value[1];
- sb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED);
+ sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
mdsize = size - sizeof (SBlock) - strlen (dstURI) - 1;
@@ -471,7 +471,7 @@
{
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
sb = (SBlock *) & value[1];
- sb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED);
+ sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
GNUNET_ECRS_meta_data_serialize (ectx,
@@ -480,7 +480,7 @@
mdsize, GNUNET_ECRS_SERIALIZE_FULL);
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
- value->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED);
+ value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
value->prio = htonl (priority);
value->anonymityLevel = htonl (anonymityLevel);
value->expirationTime = GNUNET_htonll (expiration);
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs/search.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -176,7 +176,7 @@
&hk);
GNUNET_hash_xor (&hk, &uri->data.sks.namespace, &keys[0]); /*
compute routing key r = H(identifier) ^ namespace */
keys[1] = uri->data.sks.namespace;
- addPS (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED, 2, &keys[0],
&uri->data.sks.identifier, /* identifier = decryption key */
+ addPS (GNUNET_ECRS_BLOCKTYPE_SIGNED, 2, &keys[0],
&uri->data.sks.identifier, /* identifier = decryption key */
sqc);
break;
}
@@ -200,7 +200,7 @@
pk = GNUNET_RSA_create_key_from_hash (&hc);
GNUNET_RSA_get_public_key (pk, &pub);
GNUNET_hash (&pub, sizeof (GNUNET_RSA_PublicKey), &query);
- addPS (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, /*
GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD, GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE or
GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE ok */
+ addPS (GNUNET_ECRS_BLOCKTYPE_ANY, /*
GNUNET_ECRS_BLOCKTYPE_KEYWORD, GNUNET_ECRS_BLOCKTYPE_NAMESPACE or
GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE ok */
1, &query, &hc, sqc);
GNUNET_RSA_free_key (pk);
}
@@ -348,7 +348,7 @@
if ((0 == memcmp (&query,
&ps->keys[0], sizeof (GNUNET_HashCode))) &&
((ps->type == type) ||
- (ps->type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY)) &&
+ (ps->type == GNUNET_ECRS_BLOCKTYPE_ANY)) &&
(GNUNET_YES == GNUNET_EC_is_block_applicable_for_query (type,
size,
(const
@@ -361,7 +361,7 @@
{
switch (type)
{
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD:
{
KBlock *kb;
const char *dstURI;
@@ -430,7 +430,7 @@
GNUNET_free (kb);
return ret;
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
{
const NBlock *nb;
@@ -439,7 +439,7 @@
nb = (const NBlock *) &value[1];
return processNBlock (nb, NULL, size, sqc);
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
{
KNBlock *kb;
int ret;
@@ -459,7 +459,7 @@
GNUNET_free (kb);
return ret;
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
+ case GNUNET_ECRS_BLOCKTYPE_SIGNED:
{
SBlock *sb;
const char *dstURI;
Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs/unindex.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -234,10 +234,10 @@
htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof (DBlock));
dblock->anonymityLevel = htonl (0);
dblock->prio = htonl (0);
- dblock->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ dblock->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
dblock->expirationTime = GNUNET_htonll (0);
db = (DBlock *) & dblock[1];
- db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue *) * (treedepth + 1));
for (i = 0; i <= treedepth; i++)
@@ -249,10 +249,10 @@
htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock));
iblocks[i]->anonymityLevel = htonl (0);
iblocks[i]->prio = htonl (0);
- iblocks[i]->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ iblocks[i]->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks[i]->expirationTime = GNUNET_htonll (0);
((DBlock *) & iblocks[i][1])->type =
- htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
}
pos = 0;
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -237,10 +237,10 @@
htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof (DBlock));
dblock->anonymityLevel = htonl (anonymityLevel);
dblock->prio = htonl (priority);
- dblock->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ dblock->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
dblock->expirationTime = GNUNET_htonll (expirationTime);
db = (DBlock *) & dblock[1];
- db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue *) * (treedepth + 1));
for (i = 0; i <= treedepth; i++)
@@ -252,10 +252,10 @@
htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock));
iblocks[i]->anonymityLevel = htonl (anonymityLevel);
iblocks[i]->prio = htonl (priority);
- iblocks[i]->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ iblocks[i]->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks[i]->expirationTime = GNUNET_htonll (expirationTime);
((DBlock *) & iblocks[i][1])->type =
- htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
}
pos = 0;
Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs_core.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -61,12 +61,12 @@
GNUNET_hash_to_AES_key (&hc, &skey, &iv);
val = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + len);
val->size = htonl (sizeof (GNUNET_DatastoreValue) + len);
- val->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ val->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
val->prio = htonl (0);
val->anonymityLevel = htonl (0);
val->expirationTime = GNUNET_htonll (0);
db = (DBlock *) & val[1];
- db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
GNUNET_GE_ASSERT (NULL, len - sizeof (DBlock) < GNUNET_MAX_BUFFER_SIZE);
GNUNET_GE_ASSERT (NULL,
len - sizeof (DBlock)
@@ -131,7 +131,7 @@
if (size <= 4)
{
GNUNET_GE_BREAK (NULL, 0);
- return GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY; /* signal error */
+ return GNUNET_ECRS_BLOCKTYPE_ANY; /* signal error */
}
return ntohl (*((const unsigned int *) data));
}
@@ -153,18 +153,18 @@
unsigned int type;
type = GNUNET_EC_file_block_get_type (size, data);
- if (type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY)
+ if (type == GNUNET_ECRS_BLOCKTYPE_ANY)
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
switch (type)
{
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
+ case GNUNET_ECRS_BLOCKTYPE_DATA:
/* CHK: GNUNET_hash of content == query */
GNUNET_hash (&data[1], size - sizeof (DBlock), query);
return GNUNET_OK;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
+ case GNUNET_ECRS_BLOCKTYPE_SIGNED:
{
const SBlock *sb;
if (size < sizeof (SBlock))
@@ -187,7 +187,7 @@
*query = sb->identifier;
return GNUNET_OK;
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD:
{
const KBlock *kb;
if (size < sizeof (KBlock))
@@ -208,7 +208,7 @@
GNUNET_hash (&kb->keyspace, sizeof (GNUNET_RSA_PublicKey), query);
return GNUNET_OK;
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
{
const NBlock *nb;
if (size < sizeof (NBlock))
@@ -231,7 +231,7 @@
*query = nb->namespace; /* XOR with all zeros makes no difference... */
return GNUNET_OK;
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
{
const KNBlock *kb;
if (size < sizeof (KNBlock))
@@ -255,7 +255,7 @@
query);
return GNUNET_OK;
}
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
+ case GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
{
GNUNET_GE_BREAK (NULL, 0); /* should never be used here! */
return GNUNET_SYSERR;
@@ -309,7 +309,7 @@
return GNUNET_YES; /* request was to match only primary key */
switch (type)
{
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
+ case GNUNET_ECRS_BLOCKTYPE_SIGNED:
if (keyCount != 2)
return GNUNET_SYSERR; /* no match */
GNUNET_hash (&((const SBlock *) data)->subspace,
@@ -317,7 +317,7 @@
if (0 == memcmp (&keys[1], &h, sizeof (GNUNET_HashCode)))
return GNUNET_OK;
return GNUNET_SYSERR;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
if (keyCount != 2)
return GNUNET_SYSERR; /* no match */
GNUNET_hash (&((const NBlock *) data)->subspace,
@@ -325,13 +325,13 @@
if (0 != memcmp (&keys[1], &h, sizeof (GNUNET_HashCode)))
return GNUNET_SYSERR;
return GNUNET_OK;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_DATA:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
if (keyCount != 1)
GNUNET_GE_BREAK (NULL, 0); /* keyCount should be 1 */
return GNUNET_OK; /* if query matches, everything matches! */
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY:
+ case GNUNET_ECRS_BLOCKTYPE_ANY:
GNUNET_GE_BREAK (NULL, 0); /* block type should be known */
return GNUNET_SYSERR;
default:
Modified: GNUnet/src/applications/fs/ecrs_core_test.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core_test.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/ecrs_core_test.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -42,8 +42,8 @@
len = sizeof (DBlock) + 42;
data = GNUNET_malloc (len);
memset (&data[1], rand (), len - sizeof (DBlock));
- data->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
- CHECK (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA ==
+ data->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
+ CHECK (GNUNET_ECRS_BLOCKTYPE_DATA ==
GNUNET_EC_file_block_get_type (len, data), data);
GNUNET_EC_file_block_get_key (data, len, &key);
GNUNET_EC_file_block_get_query (data, len, &query);
@@ -53,7 +53,7 @@
GNUNET_free (value);
CHECK (GNUNET_YES ==
GNUNET_EC_is_block_applicable_for_query
- (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA, len, data, &query, 1, &query),
+ (GNUNET_ECRS_BLOCKTYPE_DATA, len, data, &query, 1, &query),
data);
GNUNET_free (data);
return 0;
Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/lib/fslibtest.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -46,12 +46,12 @@
block =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock) + i);
block->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock) + i);
- block->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ block->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
block->prio = htonl (0);
block->anonymityLevel = htonl (0);
block->expirationTime = GNUNET_htonll (now + 1 * GNUNET_CRON_HOURS);
db = (DBlock *) & block[1];
- db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
memset (&db[1], i + (i / 253), i);
return block;
}
@@ -67,12 +67,12 @@
block =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + sizeof (KBlock) + i);
block->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof (KBlock) + i);
- block->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
+ block->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
block->prio = htonl (0);
block->anonymityLevel = htonl (0);
block->expirationTime = GNUNET_htonll (now + 1 * GNUNET_CRON_HOURS);
db = (KBlock *) & block[1];
- db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
+ db->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memset (&db[1], i + (i / 253), i);
kkey = GNUNET_RSA_create_key_from_hash (key);
GNUNET_RSA_sign (kkey, i, &db[1], &db->signature);
@@ -178,7 +178,7 @@
now = GNUNET_get_time ();
handle = GNUNET_FS_start_search (ctx,
NULL,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA,
+ GNUNET_ECRS_BLOCKTYPE_DATA,
1,
&query,
0,
@@ -330,7 +330,7 @@
mainThread = GNUNET_thread_get_self ();
hnd = GNUNET_FS_start_search (ctx,
NULL,
- GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ GNUNET_ECRS_BLOCKTYPE_ANY,
1,
&query, 0, 0, 10 * GNUNET_CRON_SECONDS,
&countCallback, &i);
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/fs/module/fs.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -208,7 +208,7 @@
_except_ if it is pure content that one
of our clients has requested -- then we
should ignore expiration */
- if (ntohl (dv->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
+ if (ntohl (dv->type) == GNUNET_ECRS_BLOCKTYPE_DATA)
processResponse (query, dv);
else if (stats != NULL)
stats->change (stat_expired_replies_dropped, 1);
@@ -380,7 +380,7 @@
memcpy (&datum[1],
&ri[1], ntohs (req->size) - sizeof (CS_fs_request_insert_MESSAGE));
GNUNET_mutex_lock (lock);
- if ((type != GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
+ if ((type != GNUNET_ECRS_BLOCKTYPE_DATA)
|| (0 == datastore->get (&query, type, NULL, NULL)))
ret = datastore->put (&query, datum);
else
@@ -772,7 +772,7 @@
GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Converting reply for query `%s' for gap.\n", &enc);
#endif
- if (ntohl (invalue->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
+ if (ntohl (invalue->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
{
if (GNUNET_OK != ONDEMAND_getIndexed (datastore, invalue, key, &xvalue))
return GNUNET_SYSERR;
@@ -787,7 +787,7 @@
et = GNUNET_ntohll (value->expirationTime);
now = GNUNET_get_time ();
if ((et <= now)
- && (ntohl (value->type) != GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA))
+ && (ntohl (value->type) != GNUNET_ECRS_BLOCKTYPE_DATA))
{
/* content expired and not just data -- drop! */
GNUNET_free_non_null (xvalue);
@@ -913,9 +913,9 @@
myClosure.resultCallback = resultCallback;
myClosure.resCallbackClosure = resCallbackClosure;
ret = GNUNET_OK;
- if (type == GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
+ if (type == GNUNET_ECRS_BLOCKTYPE_DATA)
ret = datastore->get (&keys[0],
- GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
+ GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
&gapGetConverter, &myClosure);
if (myClosure.count == 0)
ret = datastore->get (&keys[0], type, &gapGetConverter, &myClosure);
@@ -995,7 +995,7 @@
(const DBlock *) &gw[1],
verify, &q))
&& (0 == memcmp (&q, primaryKey, sizeof (GNUNET_HashCode)))
- && ((type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY)
+ && ((type == GNUNET_ECRS_BLOCKTYPE_ANY)
|| (type ==
(t =
GNUNET_EC_file_block_get_type (size - sizeof (GapWrapper),
@@ -1003,7 +1003,7 @@
{
switch (type)
{
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
+ case GNUNET_ECRS_BLOCKTYPE_DATA:
return GNUNET_YES;
default:
return GNUNET_NO;
Modified: GNUnet/src/applications/fs/module/migration.c
===================================================================
--- GNUnet/src/applications/fs/module/migration.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/fs/module/migration.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -266,7 +266,7 @@
"Migration: random lookup in datastore returned type %d.\n",
ntohl (value->type));
#endif
- if (ntohl (value->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
+ if (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
{
if (ONDEMAND_getIndexed (datastore,
value, &content[entry].key, &enc) != GNUNET_OK)
Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/fs/module/ondemand.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -220,11 +220,11 @@
GNUNET_free (fn);
odb.header.size = htonl (sizeof (OnDemandBlock));
- odb.header.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
+ odb.header.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.header.prio = htonl (prio);
odb.header.anonymityLevel = htonl (anonymityLevel);
odb.header.expirationTime = GNUNET_htonll (expiration);
- odb.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
+ odb.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.fileOffset = GNUNET_htonll (fileOffset);
odb.blockSize = htonl (size - sizeof (DBlock));
odb.fileId = *fileId;
@@ -455,7 +455,7 @@
return GNUNET_SYSERR;
}
db = GNUNET_malloc (sizeof (DBlock) + ntohl (odb->blockSize));
- db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iobuf = (char *) &db[1];
blen = READ (fileHandle, iobuf, ntohl (odb->blockSize));
if (blen != ntohl (odb->blockSize))
@@ -595,7 +595,7 @@
return GNUNET_SYSERR;
}
block = GNUNET_malloc (sizeof (DBlock) + blocksize);
- block->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ block->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
while (pos < size)
{
delta = size - pos;
@@ -613,17 +613,17 @@
return GNUNET_SYSERR;
}
odb.header.size = htonl (sizeof (OnDemandBlock));
- odb.header.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
+ odb.header.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.header.prio = 0;
odb.header.anonymityLevel = 0;
odb.header.expirationTime = 0;
- odb.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
+ odb.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.fileOffset = GNUNET_htonll (pos);
odb.blockSize = htonl (delta);
odb.fileId = *fileId;
/* compute the primary key */
GNUNET_EC_file_block_get_query (block, delta + sizeof (DBlock), &key);
- if (GNUNET_SYSERR == datastore->get (&key,
GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &completeValue, &odb.header)) /*
aborted == found! */
+ if (GNUNET_SYSERR == datastore->get (&key,
GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &completeValue, &odb.header)) /* aborted ==
found! */
ret = datastore->del (&key, &odb.header);
else /* not found */
ret = GNUNET_SYSERR;
Modified: GNUnet/src/applications/fs/module/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/module/querymanager.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/fs/module/querymanager.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -162,7 +162,7 @@
GNUNET_GE_ASSERT (ectx,
ntohl (value->size) > sizeof (GNUNET_DatastoreValue));
if ((GNUNET_ntohll (value->expirationTime) < GNUNET_get_time ())
- && (ntohl (value->type) != GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA))
+ && (ntohl (value->type) != GNUNET_ECRS_BLOCKTYPE_DATA))
return; /* ignore expired, non-data responses! */
matchCount = 0;
@@ -175,7 +175,7 @@
{
if ((0 == memcmp (&trackers[i]->query,
key, sizeof (GNUNET_HashCode))) &&
- ((trackers[i]->type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY) ||
+ ((trackers[i]->type == GNUNET_ECRS_BLOCKTYPE_ANY) ||
(trackers[i]->type == ntohl (value->type))))
{
matchCount++;
Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c 2007-12-13 06:47:05 UTC (rev 5891)
+++ GNUnet/src/applications/gap/gap.c 2007-12-13 07:03:58 UTC (rev 5892)
@@ -871,7 +871,7 @@
#if EXTRA_CHECKS
/* verify data is valid */
- uri (data, GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, GNUNET_YES, primaryKey);
+ uri (data, GNUNET_ECRS_BLOCKTYPE_ANY, GNUNET_YES, primaryKey);
#endif
ite = &ROUTING_indTable_[computeRoutingIndex (primaryKey)];
@@ -1465,7 +1465,7 @@
#if EXTRA_CHECKS
/* verify data is valid */
- uri (value, GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, GNUNET_YES, primaryKey);
+ uri (value, GNUNET_ECRS_BLOCKTYPE_ANY, GNUNET_YES, primaryKey);
#endif
/* check seen */
if ((cls->valueCount > MAX_SEEN_VALUES) &&
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -169,10 +169,10 @@
}
ASSERT (oldSize < api->getSize ());
ASSERT (256 ==
- api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
+ api->iterateLowPriority (GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
NULL));
ASSERT (256 ==
- api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
+ api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
NULL));
for (i = 255; i >= 0; i--)
{
@@ -190,19 +190,19 @@
}
ASSERT (oldSize > api->getSize ());
i = 0;
- ASSERT (128 == api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (128 == api->iterateLowPriority (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateUp, &i));
ASSERT (256 == i);
- ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateDown, &i));
ASSERT (0 == i);
- ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateDelete, api));
ASSERT (0 ==
- api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateDown, &i));
@@ -210,7 +210,7 @@
value = initValue (i);
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
api->put (&key, value);
- ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
priorityCheck, &i));
ASSERT (1 ==
@@ -218,7 +218,7 @@
iterateAllNow ((GNUNET_DatastoreValueIterator) & iteratePriority,
api));
i += 4;
- ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
priorityCheck, &i));
GNUNET_free (value);
@@ -229,7 +229,7 @@
GNUNET_free (value);
value = NULL;
- ASSERT (2 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (2 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
multipleCheck, &value));
GNUNET_free (value);
@@ -237,7 +237,7 @@
api->iterateAllNow ((GNUNET_DatastoreValueIterator) & iterateDelete,
api));
ASSERT (0 ==
- api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
+ api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
NULL));
api->drop ();
Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -836,7 +836,7 @@
#endif
if (((GNUNET_NO == limit_nonanonymous) ||
(ntohl (datum->anonymityLevel) == 0)) &&
- ((type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY) ||
+ ((type == GNUNET_ECRS_BLOCKTYPE_ANY) ||
(type == ntohl (datum->type))))
{
count++;
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -175,10 +175,10 @@
ASSERT (1 == api->get (&key, i, &checkValue, (void *) &i));
}
ASSERT (256 ==
- api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
+ api->iterateLowPriority (GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
NULL));
ASSERT (256 ==
- api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
+ api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
NULL));
for (i = 255; i >= 0; i--)
{
@@ -196,30 +196,30 @@
}
ASSERT (oldSize > api->getSize ());
i = 0;
- ASSERT (128 == api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (128 == api->iterateLowPriority (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateUp, &i));
ASSERT (256 == i);
- ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateDown, &i));
ASSERT (0 == i);
- ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateDelete, api));
i = 0;
ASSERT (0 ==
- api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
iterateDown, &i));
i = 42;
value = initValue (i);
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
api->put (&key, value);
- ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
priorityCheck, &i));
- ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
priorityCheck, &i));
ASSERT (1 ==
@@ -227,7 +227,7 @@
iterateAllNow ((GNUNET_DatastoreValueIterator) & iteratePriority,
api));
i += 4;
- ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
priorityCheck, &i));
GNUNET_free (value);
@@ -238,7 +238,7 @@
GNUNET_free (value);
value = NULL;
- ASSERT (2 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ ASSERT (2 == api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY,
(GNUNET_DatastoreValueIterator) &
multipleCheck, &value));
GNUNET_free (value);
@@ -246,7 +246,7 @@
api->iterateAllNow ((GNUNET_DatastoreValueIterator) & iterateDelete,
api));
ASSERT (0 ==
- api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
+ api->iterateExpirationTime (GNUNET_ECRS_BLOCKTYPE_ANY, NULL,
NULL));
api->drop ();
Modified: GNUnet/src/applications/stats/sqstats.c
===================================================================
--- GNUnet/src/applications/stats/sqstats.c 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/applications/stats/sqstats.c 2007-12-13 07:03:58 UTC (rev
5892)
@@ -60,25 +60,25 @@
switch (ntohl (value->type))
{
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY:
+ case GNUNET_ECRS_BLOCKTYPE_ANY:
data->stat_block[0]++;
break;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
+ case GNUNET_ECRS_BLOCKTYPE_DATA:
data->stat_block[1]++;
break;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
+ case GNUNET_ECRS_BLOCKTYPE_SIGNED:
data->stat_block[2]++;
break;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD:
data->stat_block[3]++;
break;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
data->stat_block[4]++;
break;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
+ case GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
data->stat_block[5]++;
break;
- case GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
+ case GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
data->stat_block[6]++;
break;
default:
Modified: GNUnet/src/applications/tracekit/tracekittest.c
===================================================================
--- GNUnet/src/applications/tracekit/tracekittest.c 2007-12-13 06:47:05 UTC
(rev 5891)
+++ GNUnet/src/applications/tracekit/tracekittest.c 2007-12-13 07:03:58 UTC
(rev 5892)
@@ -35,12 +35,37 @@
#define PEER_COUNT 4
-#define SIZE 1024 * 1024 * 2
+#define TEST_DEPTH PEER_COUNT
static struct GNUNET_GE_Context *ectx;
static struct GNUNET_GC_Configuration *cfg;
+static int
+report (void *unused,
+ const GNUNET_PeerIdentity * reporter,
+ const GNUNET_PeerIdentity * link)
+{
+ GNUNET_EncName src;
+ GNUNET_EncName dst;
+
+ GNUNET_hash_to_enc (&reporter->hashPubKey, &src);
+ if (link != NULL)
+ {
+ GNUNET_hash_to_enc (&link->hashPubKey, &dst);
+ fprintf (stdout,
+ _("`%s' connected to `%s'.\n"),
+ (const char *) &src, (const char *) &dst);
+ }
+ else
+ {
+ fprintf (stdout,
+ _("`%s' is not connected to any peer.\n"),
+ (const char *) &src);
+ }
+ return GNUNET_OK;
+}
+
/**
* Testcase to test tracekit
* @return 0: ok, -1: error
@@ -49,10 +74,9 @@
main (int argc, char **argv)
{
struct GNUNET_TESTING_DaemonContext *peers;
+ struct GNUNET_ClientServerConnection *sock;
int ret;
int i;
- char buf[128];
- GNUNET_CronTime start;
ret = 0;
cfg = GNUNET_GC_create ();
@@ -84,9 +108,17 @@
return -1;
}
}
+ sock = GNUNET_client_connection_create (ectx, cfg);
+ if (sock == NULL)
+ {
+ fprintf (stderr, _("Error establishing connection with gnunetd.\n"));
+ GNUNET_fini (ectx, cfg);
+ return 1;
+ }
+ ret = 0; /* FIXME: set to 1 here, to 0 in report! */
+ GNUNET_TRACEKIT_run (sock, TEST_DEPTH, 0, &report, &ret);
+ GNUNET_client_connection_destroy (sock);
-
-FAILURE:
#if START_PEERS
GNUNET_TESTING_stop_daemons (peers);
#endif
Modified: GNUnet/src/include/gnunet_dht_service.h
===================================================================
--- GNUnet/src/include/gnunet_dht_service.h 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/include/gnunet_dht_service.h 2007-12-13 07:03:58 UTC (rev
5892)
@@ -88,9 +88,9 @@
*
* @param key the key to store under
*/
- void (*put) (const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size, GNUNET_CronTime expire, const char *data);
+ int (*put) (const GNUNET_HashCode * key,
+ unsigned int type,
+ unsigned int size, GNUNET_CronTime expire, const char *data);
} GNUNET_DHT_ServiceAPI;
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2007-12-13 06:47:05 UTC (rev
5891)
+++ GNUnet/src/include/gnunet_protocols.h 2007-12-13 07:03:58 UTC (rev
5892)
@@ -438,47 +438,47 @@
/**
* Reserved number for "any type".
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY 0
+#define GNUNET_ECRS_BLOCKTYPE_ANY 0
/**
* Data block (leaf or inner block).
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA 1
+#define GNUNET_ECRS_BLOCKTYPE_DATA 1
/**
* Namespace binding (subspace entry)
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED 2
+#define GNUNET_ECRS_BLOCKTYPE_SIGNED 2
/**
* Keyword binding (entry in keyword space)
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD 3
+#define GNUNET_ECRS_BLOCKTYPE_KEYWORD 3
/**
* Namespace advertisement.
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE 4
+#define GNUNET_ECRS_BLOCKTYPE_NAMESPACE 4
/**
* Namespace advertisement in keyword space.
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE 5
+#define GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE 5
/**
* DHT String2String (for dht-testing)
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING 7
+#define GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING 7
/**
* Reserved for internal usage
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_RESERVED 0xFFFFFFFE
+#define GNUNET_ECRS_BLOCKTYPE_RESERVED 0xFFFFFFFE
/**
* Type of OnDemand encoded blocks.
*/
-#define GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND 0xFFFFFFFF
+#define GNUNET_ECRS_BLOCKTYPE_ONDEMAND 0xFFFFFFFF
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5892 - in GNUnet/src: applications applications/advertising applications/datastore applications/dht/module applications/dht/tools applications/fs applications/fs/ecrs applications/fs/lib applications/fs/module applications/gap applications/sqstore_mysql applications/sqstore_sqlite applications/stats applications/tracekit include,
gnunet <=