[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27805 - in gnunet/src: include namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27805 - in gnunet/src: include namestore |
Date: |
Tue, 9 Jul 2013 00:36:00 +0200 |
Author: grothoff
Date: 2013-07-09 00:36:00 +0200 (Tue, 09 Jul 2013)
New Revision: 27805
Modified:
gnunet/src/include/gnunet_namestore_service.h
gnunet/src/include/gnunet_protocols.h
gnunet/src/namestore/gnunet-service-namestore.c
gnunet/src/namestore/namestore.h
gnunet/src/namestore/namestore_api.c
Log:
-get rid of iteration response, use lookup response instead, message formats
were identical to begin with
Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h 2013-07-08 21:44:05 UTC
(rev 27804)
+++ gnunet/src/include/gnunet_namestore_service.h 2013-07-08 22:36:00 UTC
(rev 27805)
@@ -458,13 +458,12 @@
* Function called whenever the records for a given name changed.
*
* @param cls closure
- * @param was_removed GNUNET_NO if the record was added, GNUNET_YES if it was
removed,
- * GNUNET_SYSERR if the communication with the namestore
broke down
+ * @param zone_key NULL if the communication with the namestore broke down
* (and thus all entries should be 'cleared' until the
communication
* can be re-established, at which point the monitor will
* re-add all records that are (still) in the namestore
after
- * the reconnect); if this value is SYSERR, all other
arguments
- * will be 0/NULL.
+ * the reconnect); if this value is NULL, all other
arguments
+ * will also be 0/NULL.
* @param freshness when does the corresponding block in the DHT expire (until
* when should we never do a DHT lookup for the same name
again)?;
* GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any type
in the namestore,
@@ -476,7 +475,6 @@
* @param signature signature of the record block
*/
typedef void (*GNUNET_NAMESTORE_RecordMonitor)(void *cls,
- int was_removed,
const struct
GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key,
struct GNUNET_TIME_Absolute
freshness,
const char *name,
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2013-07-08 21:44:05 UTC (rev
27804)
+++ gnunet/src/include/gnunet_protocols.h 2013-07-08 22:36:00 UTC (rev
27805)
@@ -1402,14 +1402,16 @@
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE 440
/**
- * Client to service: please start iteration
+ * Client to service: start monitoring (yields sequence of
+ * "ZONE_ITERATION_RESPONSES" --- forever).
*/
-#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 445
+#define GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START 441
/**
- * Service to client: current record in iteration (or end of list).
+ * Client to service: please start iteration; receives
+ * "GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE" messages in return.
*/
-#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 446
+#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 445
/**
* Client to service: next record in iteration please.
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2013-07-08 21:44:05 UTC
(rev 27804)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2013-07-08 22:36:00 UTC
(rev 27805)
@@ -1364,7 +1364,7 @@
struct GNUNET_NAMESTORE_CryptoContainer *cc;
struct GNUNET_HashCode long_hash;
struct GNUNET_CRYPTO_ShortHashCode zone_hash;
- struct ZoneIterationResponseMessage *zir_msg;
+ struct LookupNameResponseMessage *zir_msg;
struct GNUNET_TIME_Relative rt;
unsigned int rd_count_filtered;
unsigned int c;
@@ -1484,14 +1484,14 @@
name);
name_len = strlen (name) + 1;
rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count_filtered,
rd_filtered);
- msg_size = sizeof (struct ZoneIterationResponseMessage) + name_len +
rd_ser_len;
+ msg_size = sizeof (struct LookupNameResponseMessage) + name_len + rd_ser_len;
zir_msg = GNUNET_malloc (msg_size);
- zir_msg->gns_header.header.type = htons
(GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE);
+ zir_msg->gns_header.header.type = htons
(GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE);
zir_msg->gns_header.header.size = htons (msg_size);
zir_msg->gns_header.r_id = htonl (proc->zi->request_id);
zir_msg->expire = GNUNET_TIME_absolute_hton (expire);
- zir_msg->reserved = htons (0);
+ zir_msg->contains_sig = htons ((NULL == signature) ? GNUNET_NO : GNUNET_YES);
zir_msg->name_len = htons (name_len);
zir_msg->rd_count = htons (rd_count_filtered);
zir_msg->rd_len = htons (rd_ser_len);
@@ -1524,7 +1524,7 @@
run_zone_iteration_round (struct GNUNET_NAMESTORE_ZoneIteration *zi)
{
struct ZoneIterationProcResult proc;
- struct ZoneIterationResponseMessage zir_end;
+ struct LookupNameResponseMessage zir_end;
struct GNUNET_CRYPTO_ShortHashCode *zone;
memset (&proc, 0, sizeof (proc));
@@ -1560,8 +1560,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No more results for all zones\n");
memset (&zir_end, 0, sizeof (zir_end));
- zir_end.gns_header.header.type = htons
(GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE);
- zir_end.gns_header.header.size = htons (sizeof (struct
ZoneIterationResponseMessage));
+ zir_end.gns_header.header.type = htons
(GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE);
+ zir_end.gns_header.header.size = htons (sizeof (struct
LookupNameResponseMessage));
zir_end.gns_header.r_id = htonl(zi->request_id);
GNUNET_SERVER_notification_context_unicast (snc,
zi->client->client,
Modified: gnunet/src/namestore/namestore.h
===================================================================
--- gnunet/src/namestore/namestore.h 2013-07-08 21:44:05 UTC (rev 27804)
+++ gnunet/src/namestore/namestore.h 2013-07-08 22:36:00 UTC (rev 27805)
@@ -137,7 +137,6 @@
*/
struct GNUNET_TIME_AbsoluteNBO expire;
-
/**
* Name length
*/
@@ -352,7 +351,10 @@
*/
uint16_t rd_count;
- /* result in NBO: GNUNET_OK on success, GNUNET_NO if there were no results,
GNUNET_SYSERR on error */
+ /**
+ * result in NBO: GNUNET_OK on success, GNUNET_NO if there were no
+ * results, GNUNET_SYSERR on error
+ */
int16_t res;
/**
@@ -443,52 +445,6 @@
};
-/**
- * Next result of zone iteration for the given operation
- * // FIXME: use 'struct LookupResponseMessage' instead? (identical except
- * for having 'contains_sig' instead of 'reserved', but fully compatible
otherwise).
- */
-struct ZoneIterationResponseMessage
-{
- /**
- * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
- */
- struct GNUNET_NAMESTORE_Header gns_header;
-
- struct GNUNET_TIME_AbsoluteNBO expire;
-
- uint16_t name_len;
-
- /**
- * Record data length
- */
- uint16_t rd_len;
-
- /**
- * Number of records contained
- */
- uint16_t rd_count;
-
- /**
- * always zero (for alignment)
- */
- uint16_t reserved;
-
- /**
- * All zeros if 'contains_sig' is GNUNET_NO.
- */
- struct GNUNET_CRYPTO_EccSignature signature;
-
- /**
- * The public key
- */
- struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
-
-};
-
-
-
-
GNUNET_NETWORK_STRUCT_END
Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c 2013-07-08 21:44:05 UTC (rev
27804)
+++ gnunet/src/namestore/namestore_api.c 2013-07-08 22:36:00 UTC (rev
27805)
@@ -514,7 +514,7 @@
*/
static int
handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
- const struct ZoneIterationResponseMessage *msg,
+ const struct LookupNameResponseMessage *msg,
size_t size)
{
struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubdummy;
@@ -534,13 +534,12 @@
rd_count = ntohs (msg->rd_count);
name_len = ntohs (msg->name_len);
expire = GNUNET_TIME_absolute_ntoh (msg->expire);
- exp_msg_len = sizeof (struct ZoneIterationResponseMessage) + name_len +
rd_len;
+ exp_msg_len = sizeof (struct LookupNameResponseMessage) + name_len + rd_len;
if (msg_len != exp_msg_len)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- GNUNET_break (0 == ntohs (msg->reserved));
memset (&pubdummy, '\0', sizeof (pubdummy));
if ((0 == name_len) && (0 == (memcmp (&msg->public_key, &pubdummy, sizeof
(pubdummy)))))
{
@@ -589,13 +588,13 @@
/* handle different message type */
switch (type)
{
- case GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE:
- if (size < sizeof (struct ZoneIterationResponseMessage))
+ case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE:
+ if (size < sizeof (struct LookupNameResponseMessage))
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- return handle_zone_iteration_response (ze, (const struct
ZoneIterationResponseMessage *) msg, size);
+ return handle_zone_iteration_response (ze, (const struct
LookupNameResponseMessage *) msg, size);
default:
GNUNET_break (0);
return GNUNET_SYSERR;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27805 - in gnunet/src: include namestore,
gnunet <=