[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35671 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35671 - gnunet/src/dht |
Date: |
Wed, 29 Apr 2015 10:29:16 +0200 |
Author: grothoff
Date: 2015-04-29 10:29:16 +0200 (Wed, 29 Apr 2015)
New Revision: 35671
Modified:
gnunet/src/dht/gnunet-service-dht_datacache.c
gnunet/src/dht/gnunet-service-wdht_datacache.c
gnunet/src/dht/gnunet-service-xdht_datacache.c
Log:
-doxygen
Modified: gnunet/src/dht/gnunet-service-dht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_datacache.c 2015-04-29 08:17:17 UTC
(rev 35670)
+++ gnunet/src/dht/gnunet-service-dht_datacache.c 2015-04-29 08:29:16 UTC
(rev 35671)
@@ -17,7 +17,6 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file dht/gnunet-service-dht_datacache.c
* @brief GNUnet DHT service's datacache integration
@@ -78,11 +77,20 @@
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# ITEMS stored in datacache"), 1,
GNUNET_NO);
- r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration,
- put_path_length, put_path);
+ r = GNUNET_DATACACHE_put (datacache,
+ key,
+ data_size,
+ data,
+ type,
+ expiration,
+ put_path_length,
+ put_path);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n",
- GNUNET_h2s (key), data_size, r, put_path_length);
+ GNUNET_h2s (key),
+ data_size,
+ r,
+ put_path_length);
}
@@ -112,7 +120,7 @@
size_t xquery_size;
/**
- * Mutator value for the reply_bf, see gnunet_block_lib.h
+ * Mutator value for the @e reply_bf, see gnunet_block_lib.h
*/
uint32_t reply_bf_mutator;
@@ -126,7 +134,7 @@
/**
* Iterator for local get request results,
*
- * @param cls closure for iterator, a DatacacheGetContext
+ * @param cls closure for iterator, a `struct GetRequestContext`
* @param exp when does this value expire?
* @param key the key this data is stored under
* @param size the size of the data identified by key
Modified: gnunet/src/dht/gnunet-service-wdht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-wdht_datacache.c 2015-04-29 08:17:17 UTC
(rev 35670)
+++ gnunet/src/dht/gnunet-service-wdht_datacache.c 2015-04-29 08:29:16 UTC
(rev 35671)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing
authors)
+ Copyright (C) 2009, 2010, 2011, 2015 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
@@ -19,7 +19,7 @@
*/
/**
- * @file dht/gnunet-service-dht_datacache.c
+ * @file dht/gnunet-service-wdht_datacache.c
* @brief GNUnet DHT service's datacache integration
* @author Christian Grothoff
* @author Nathan Evans
@@ -48,18 +48,19 @@
*
* @param expiration when will the reply expire
* @param key the query this reply is for
- * @param put_path_length number of peers in 'put_path'
+ * @param put_path_length number of peers in @a put_path
* @param put_path path the reply took on put
* @param type type of the reply
- * @param data_size number of bytes in 'data'
+ * @param data_size number of bytes in @a data
* @param data application payload data
*/
void
GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode *key,
unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
- enum GNUNET_BLOCK_Type type, size_t data_size,
+ enum GNUNET_BLOCK_Type type,
+ size_t data_size,
const void *data)
{
int r;
@@ -67,7 +68,7 @@
if (NULL == datacache)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("%s request received, but have no datacache!\n"), "PUT");
+ _("PUT request received, but have no datacache!\n"));
return;
}
if (data_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
@@ -77,19 +78,27 @@
}
/* Put size is actual data size plus struct overhead plus path length (if
any) */
- GNUNET_STATISTICS_update (GDS_stats,
- gettext_noop ("# ITEMS stored in datacache"), 1,
- GNUNET_NO);
-
- struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id();
- DEBUG("DATACACHE_PUT KEY = %s, peer =
%s\n",GNUNET_h2s(key),GNUNET_i2s(&peer));
- r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration,
- put_path_length, put_path);
+ r = GNUNET_DATACACHE_put (datacache,
+ key,
+ data_size,
+ data,
+ type,
+ expiration,
+ put_path_length,
+ put_path);
+ if (GNUNET_OK == r)
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# ITEMS stored in datacache"), 1,
+ GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n",
- GNUNET_h2s (key), data_size, r, put_path_length);
+ GNUNET_h2s (key),
+ data_size,
+ r,
+ put_path_length);
}
+
/**
* List of peers in the get path.
*/
@@ -133,17 +142,17 @@
struct GNUNET_HashCode key;
/**
- * Number of bytes in xquery.
+ * Number of bytes in @e xquery.
*/
size_t xquery_size;
/**
- * Mutator value for the reply_bf, see gnunet_block_lib.h
+ * Mutator value for the @e reply_bf, see gnunet_block_lib.h
*/
uint32_t reply_bf_mutator;
/**
- * Total number of peers in get path.
+ * Total number of peers in @e head.
*/
unsigned int get_path_length;
@@ -290,16 +299,17 @@
* @param key the query
* @param type requested data type
* @param xquery extended query
- * @param xquery_size number of bytes in xquery
+ * @param xquery_size number of bytes in @a xquery
* @param reply_bf where the reply bf is (to be) stored, possibly updated, can
be NULL
- * @param reply_bf_mutator mutation value for reply_bf
+ * @param reply_bf_mutator mutation value for @a reply_bf
+ * @param get_path_length Total number of peers in @a get_path
+ * @param get_path Peers query has traversed during GET
* @return evaluation result for the local replies
- * @get_path_length Total number of peers in get path
- * @get_path Peers in get path.
*/
enum GNUNET_BLOCK_EvaluationResult
-GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
- enum GNUNET_BLOCK_Type type, const void *xquery,
+GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key,
+ enum GNUNET_BLOCK_Type type,
+ const void *xquery,
size_t xquery_size,
struct GNUNET_CONTAINER_BloomFilter **reply_bf,
uint32_t reply_bf_mutator,
@@ -324,15 +334,13 @@
ctx.reply_bf_mutator = reply_bf_mutator;
ctx.get_path_length = get_path_length;
- if (next_hop != NULL)
- {
- memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity));
- }
+ if (NULL != next_hop)
+ ctx.next_hop = *next_hop;
unsigned int i = 0;
ctx.head = NULL;
ctx.tail = NULL;
- if (get_path != NULL)
+ if (NULL != get_path)
{
while (i < get_path_length)
{
@@ -346,9 +354,15 @@
}
}
- r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator,
+ r = GNUNET_DATACACHE_get (datacache,
+ key,
+ type,
+ &datacache_get_iterator,
&ctx);
- DEBUG ("DATACACHE_GET for key %s completed (%d). %u results
found.\n",GNUNET_h2s (key), ctx.eval, r);
+ DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",
+ GNUNET_h2s (key),
+ ctx.eval,
+ r);
return ctx.eval;
}
@@ -369,7 +383,7 @@
void
GDS_DATACACHE_done ()
{
- if (datacache != NULL)
+ if (NULL != datacache)
{
GNUNET_DATACACHE_destroy (datacache);
datacache = NULL;
@@ -377,4 +391,4 @@
}
-/* end of gnunet-service-dht_datacache.c */
+/* end of gnunet-service-wdht_datacache.c */
Modified: gnunet/src/dht/gnunet-service-xdht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_datacache.c 2015-04-29 08:17:17 UTC
(rev 35670)
+++ gnunet/src/dht/gnunet-service-xdht_datacache.c 2015-04-29 08:29:16 UTC
(rev 35671)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing
authors)
+ Copyright (C) 2009, 2010, 2011, 2015 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
@@ -17,9 +17,8 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
- * @file dht/gnunet-service-dht_datacache.c
+ * @file dht/gnunet-service-xdht_datacache.c
* @brief GNUnet DHT service's datacache integration
* @author Christian Grothoff
* @author Nathan Evans
@@ -49,18 +48,19 @@
*
* @param expiration when will the reply expire
* @param key the query this reply is for
- * @param put_path_length number of peers in 'put_path'
+ * @param put_path_length number of peers in @a put_path
* @param put_path path the reply took on put
* @param type type of the reply
- * @param data_size number of bytes in 'data'
+ * @param data_size number of bytes in @a data
* @param data application payload data
*/
void
GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode *key,
unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
- enum GNUNET_BLOCK_Type type, size_t data_size,
+ enum GNUNET_BLOCK_Type type,
+ size_t data_size,
const void *data)
{
int r;
@@ -68,7 +68,7 @@
if (NULL == datacache)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("%s request received, but have no datacache!\n"), "PUT");
+ "PUT request received, but have no datacache!\n");
return;
}
if (data_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
@@ -78,19 +78,27 @@
}
/* Put size is actual data size plus struct overhead plus path length (if
any) */
- GNUNET_STATISTICS_update (GDS_stats,
- gettext_noop ("# ITEMS stored in datacache"), 1,
- GNUNET_NO);
-
- struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id();
- DEBUG("DATACACHE_PUT KEY = %s, peer =
%s\n",GNUNET_h2s(key),GNUNET_i2s(&peer));
- r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration,
- put_path_length, put_path);
+ r = GNUNET_DATACACHE_put (datacache,
+ key,
+ data_size,
+ data,
+ type,
+ expiration,
+ put_path_length,
+ put_path);
+ if (GNUNET_OK == r)
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# ITEMS stored in datacache"), 1,
+ GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n",
- GNUNET_h2s (key), data_size, r, put_path_length);
+ GNUNET_h2s (key),
+ data_size,
+ r,
+ put_path_length);
}
+
/**
* List of peers in the get path.
*/
@@ -139,7 +147,7 @@
size_t xquery_size;
/**
- * Mutator value for the reply_bf, see gnunet_block_lib.h
+ * Mutator value for the @e reply_bf, see gnunet_block_lib.h
*/
uint32_t reply_bf_mutator;
@@ -181,10 +189,10 @@
* Iterator for local get request results,
*
* @param cls closure for iterator, a `struct GetRequestContext`
- * @param key the key this data is stored under
+ * @param key the key this @a data is stored under
* @param size the size of the data identified by key
* @param data the actual data
- * @param type the type of the data
+ * @param type the type of the @a data
* @param exp when does this value expire?
* @param put_path_length number of peers in @a put_path
* @param put_path path the reply took on put
@@ -241,11 +249,17 @@
i++;
iterator = iterator->next;
}
- GDS_NEIGHBOURS_send_get_result (key,type,
&(ctx->next_hop),&(ctx->source_peer),
- put_path_length, put_path,
ctx->get_path_length,
- get_path, exp, data, size );
+ GDS_NEIGHBOURS_send_get_result (key,type,
+ &ctx->next_hop,
+ &ctx->source_peer,
+ put_path_length,
+ put_path,
+ ctx->get_path_length,
+ get_path,
+ exp,
+ data,
+ size);
GNUNET_free_non_null (get_path);
-
break;
case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
GNUNET_STATISTICS_update (GDS_stats,
@@ -277,7 +291,8 @@
("# Unsupported RESULTS found in datacache"), 1,
GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Unsupported block type (%u) in local response!\n"), type);
+ _("Unsupported block type (%u) in local response!\n"),
+ type);
break;
}
@@ -291,16 +306,17 @@
* @param key the query
* @param type requested data type
* @param xquery extended query
- * @param xquery_size number of bytes in xquery
+ * @param xquery_size number of bytes in @a xquery
* @param reply_bf where the reply bf is (to be) stored, possibly updated, can
be NULL
- * @param reply_bf_mutator mutation value for reply_bf
+ * @param reply_bf_mutator mutation value for @a reply_bf
* @return evaluation result for the local replies
* @get_path_length Total number of peers in get path
* @get_path Peers in get path.
*/
enum GNUNET_BLOCK_EvaluationResult
-GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
- enum GNUNET_BLOCK_Type type, const void *xquery,
+GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key,
+ enum GNUNET_BLOCK_Type type,
+ const void *xquery,
size_t xquery_size,
struct GNUNET_CONTAINER_BloomFilter **reply_bf,
uint32_t reply_bf_mutator,
@@ -325,15 +341,13 @@
ctx.reply_bf_mutator = reply_bf_mutator;
ctx.get_path_length = get_path_length;
- if (next_hop != NULL)
- {
- memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity));
- }
+ if (NULL != next_hop)
+ ctx.next_hop = *next_hop;
unsigned int i = 0;
ctx.head = NULL;
ctx.tail = NULL;
- if (get_path != NULL)
+ if (NULL != get_path)
{
while (i < get_path_length)
{
@@ -347,9 +361,15 @@
}
}
- r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator,
+ r = GNUNET_DATACACHE_get (datacache,
+ key,
+ type,
+ &datacache_get_iterator,
&ctx);
- DEBUG ("DATACACHE_GET for key %s completed (%d). %u results
found.\n",GNUNET_h2s (key), ctx.eval, r);
+ DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",
+ GNUNET_h2s (key),
+ ctx.eval,
+ r);
return ctx.eval;
}
@@ -370,7 +390,7 @@
void
GDS_DATACACHE_done ()
{
- if (datacache != NULL)
+ if (NULL != datacache)
{
GNUNET_DATACACHE_destroy (datacache);
datacache = NULL;
@@ -378,4 +398,4 @@
}
-/* end of gnunet-service-dht_datacache.c */
+/* end of gnunet-service-xdht_datacache.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35671 - gnunet/src/dht,
gnunet <=