[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22393 - in gnunet/src: include namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22393 - in gnunet/src: include namestore |
Date: |
Fri, 29 Jun 2012 17:55:08 +0200 |
Author: grothoff
Date: 2012-06-29 17:55:08 +0200 (Fri, 29 Jun 2012)
New Revision: 22393
Modified:
gnunet/src/include/gnunet_namestore_service.h
gnunet/src/namestore/gnunet-service-namestore.c
gnunet/src/namestore/namestore_common.c
gnunet/src/namestore/test_namestore_api_create.c
gnunet/src/namestore/test_namestore_api_lookup.c
gnunet/src/namestore/test_namestore_api_lookup_specific_type.c
gnunet/src/namestore/test_namestore_api_remove.c
gnunet/src/namestore/test_namestore_api_zone_iteration.c
gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
Log:
-more fixes to namestore
Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h 2012-06-29 15:26:52 UTC
(rev 22392)
+++ gnunet/src/include/gnunet_namestore_service.h 2012-06-29 15:55:08 UTC
(rev 22393)
@@ -162,8 +162,14 @@
* This expiration time of the record is a relative
* time (not an absolute time).
*/
- GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8
+ GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8,
+ /**
+ * This record should not be used unless all (other) records with an absolute
+ * expiration time have expired.
+ */
+ GNUNET_NAMESTORE_RF_SHADOW_RECORD = 16
+
};
@@ -256,6 +262,7 @@
* Store an item in the namestore. If the item is already present,
* the expiration time is updated to the max of the existing time and
* the new time. This API is used by the authority of a zone.
+ * FIXME: consider allowing to pass multiple records in one call!
*
* @param h handle to the namestore
* @param pkey private key of the zone
@@ -325,7 +332,14 @@
/**
* Get a result for a particular key from the namestore. The processor
- * will only be called once.
+ * will only be called once. When using this functions, relative expiration
+ * times will be converted to absolute expiration times and a signature
+ * will be created if we are the authority. The record data and signature
+ * passed to 'proc' is thus always suitable for passing on to other peers
+ * (if we are the authority). If the record type is NOT set to 'ANY' and
+ * if we are NOT the authority, then non-matching records may be omitted
+ * from the result and no valid signature can be created; in this case,
+ * 'signature' will be NULL and the result cannot be given to other peers.
*
* @param h handle to the namestore
* @param zone zone to look up a record from
@@ -339,10 +353,10 @@
*/
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_CRYPTO_ShortHashCode *zone,
- const char *name,
- uint32_t record_type,
- GNUNET_NAMESTORE_RecordProcessor proc, void
*proc_cls);
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
+ const char *name,
+ uint32_t record_type,
+ GNUNET_NAMESTORE_RecordProcessor proc, void
*proc_cls);
/**
@@ -378,10 +392,12 @@
*
* 0) If the bit is clear, all relative expriation times are converted to
* absolute expiration times. This is useful for performing DHT PUT
- * operations (and zone transfers) of our zone.
+ * operations (and zone transfers) of our zone. The generated signatures
+ * will be valid for other peers.
* 1) if it is set, it means that relative expiration times should be
* preserved when returned (this is useful for the zone editor user
- * interface).
+ * interface). No signatures will be created in this case, as
+ * signatures must not cover records with relative expiration times.
*
* Note that not all queries against this interface are equally performant
* as for some combinations no efficient index may exist.
@@ -416,7 +432,9 @@
/**
- * Stops iteration and releases the namestore handle for further calls.
+ * Stops iteration and releases the namestore handle for further calls. Must
+ * be called on any iteration that has not yet completed prior to calling
+ * 'GNUNET_NAMESTORE_disconnect'.
*
* @param it the iterator
*/
@@ -426,7 +444,9 @@
/**
* Cancel a namestore operation. The final callback from the
- * operation must not have been done yet.
+ * operation must not have been done yet. Must be called on any
+ * namestore operation that has not yet completed prior to calling
+ * 'GNUNET_NAMESTORE_disconnect'.
*
* @param qe operation to cancel
*/
@@ -451,6 +471,7 @@
GNUNET_NAMESTORE_records_get_size (unsigned int rd_count,
const struct GNUNET_NAMESTORE_RecordData
*rd);
+
/**
* Serialize the given records to the given destination buffer.
*
@@ -494,6 +515,7 @@
int
GNUNET_NAMESTORE_check_name (const char * name);
+
/**
* Convert the 'value' of a record to a string.
*
@@ -545,6 +567,16 @@
GNUNET_NAMESTORE_number_to_typename (uint32_t type);
+/**
+ * Test if a given record is expired.
+ *
+ * @return GNUNET_YES if the record is expired,
+ * GNUNET_NO if not
+ */
+int
+GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2012-06-29 15:26:52 UTC
(rev 22392)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2012-06-29 15:55:08 UTC
(rev 22393)
@@ -24,8 +24,8 @@
* @author Matthias Wachs
*/
#include "platform.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_service_lib.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_dnsparser_lib.h"
#include "gnunet_namestore_service.h"
#include "gnunet_namestore_plugin.h"
#include "gnunet_signatures.h"
@@ -553,6 +553,7 @@
struct GNUNET_NAMESTORE_CryptoContainer *cc;
struct GNUNET_CRYPTO_RsaSignature *signature_new;
struct GNUNET_TIME_Absolute e;
+ struct GNUNET_TIME_Relative re;
struct GNUNET_CRYPTO_ShortHashCode zone_key_hash;
struct GNUNET_HashCode long_hash;
char *rd_tmp;
@@ -563,79 +564,139 @@
int copied_elements;
int contains_signature;
int authoritative;
- int c;
+ int rd_modified;
+ unsigned int c;
- name_len = (NULL == name) ? 0 : strlen(name) + 1;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found %u records under name `%s'\n",
+ rd_count,
+ name);
+ authoritative = GNUNET_NO;
+ signature_new = NULL;
+ cc = NULL;
+ if (NULL != zone_key)
+ {
+ GNUNET_CRYPTO_short_hash (zone_key,
+ sizeof (struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+ &zone_key_hash);
+ GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash);
+ if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get (zonekeys,
&long_hash)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Am authoritative for zone `%s'\n",
+ GNUNET_short_h2s (&zone_key_hash));
+ authoritative = GNUNET_YES;
+ }
+ }
+
copied_elements = 0;
+ rd_modified = GNUNET_NO;
rd_selected = NULL;
/* count records to copy */
- if (0 != lnc->record_type)
+ for (c = 0; c < rd_count; c++)
{
- /* special record type needed */
+ if ( (GNUNET_YES == authoritative) &&
+ (GNUNET_YES ==
+ GNUNET_NAMESTORE_is_expired (&rd[c]) ) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Skipping expired record\n");
+ continue;
+ }
+ if ( (GNUNET_NAMESTORE_TYPE_ANY == lnc->record_type) ||
+ (rd[c].record_type == lnc->record_type) )
+ copied_elements++; /* found matching record */
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Skipping non-mtaching record\n");
+ rd_modified = GNUNET_YES;
+ }
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found %u records with type %u for name `%s' in zone `%s'\n",
+ copied_elements,
+ lnc->record_type,
+ lnc->name,
+ GNUNET_short_h2s(lnc->zone));
+ if (copied_elements > 0)
+ {
+ rd_selected = GNUNET_malloc (copied_elements * sizeof (struct
GNUNET_NAMESTORE_RecordData));
+ copied_elements = 0;
for (c = 0; c < rd_count; c++)
- if (rd[c].record_type == lnc->record_type)
- copied_elements++; /* found matching record */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found %u records with type %u for name `%s' in zone `%s'\n",
- copied_elements,
- lnc->record_type,
- lnc->name,
- GNUNET_short_h2s(lnc->zone));
- if (copied_elements > 0)
{
- rd_selected = GNUNET_malloc (copied_elements * sizeof (struct
GNUNET_NAMESTORE_RecordData));
- copied_elements = 0;
- for (c = 0; c < rd_count; c++)
+ if ( (GNUNET_YES == authoritative) &&
+ (GNUNET_YES ==
+ GNUNET_NAMESTORE_is_expired (&rd[c])) )
+ continue;
+ if ( (GNUNET_NAMESTORE_TYPE_ANY == lnc->record_type) ||
+ (rd[c].record_type == lnc->record_type) )
{
- if (rd[c].record_type == lnc->record_type)
+ if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
{
- /* found matching record */
- rd_selected[copied_elements] = rd[c]; /* shallow copy! */
- copied_elements++;
+ GNUNET_break (GNUNET_YES == authoritative);
+ rd_modified = GNUNET_YES;
+ re.rel_value = rd[c].expiration_time;
+ e = GNUNET_TIME_relative_to_absolute (re);
}
+ else
+ {
+ e.abs_value = rd[c].expiration_time;
+ }
+ /* found matching record, copy and convert flags to public format */
+ rd_selected[copied_elements] = rd[c]; /* shallow copy! */
+ rd_selected[copied_elements].expiration_time = e.abs_value;
+ if (0 != (rd_selected[copied_elements].flags &
+ (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION |
GNUNET_NAMESTORE_RF_AUTHORITY)))
+ {
+ rd_selected[copied_elements].flags &= ~
(GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION |
+ GNUNET_NAMESTORE_RF_AUTHORITY);
+ rd_modified = GNUNET_YES;
+ }
+ copied_elements++;
}
+ else
+ {
+ rd_modified = GNUNET_YES;
+ }
}
}
else
- {
- copied_elements = rd_count;
- rd_selected = (struct GNUNET_NAMESTORE_RecordData *) rd;
- }
- // FIXME: need to adjust 'rd' from relative to absolute times!
+ rd_selected = NULL;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found %u records for name `%s' in zone `%s'\n",
+ "Found %u matching records for name `%s' in zone `%s'\n",
copied_elements,
lnc->name,
GNUNET_short_h2s (lnc->zone));
-
- if ((copied_elements == rd_count) && (NULL != signature))
- contains_signature = GNUNET_YES; /* returning all records, so include
signature */
- else
- contains_signature = GNUNET_NO; /* returning not all records, so do not
include signature */
-
- authoritative = GNUNET_NO;
- signature_new = NULL;
- if ((NULL != zone_key) && (copied_elements == rd_count))
+ contains_signature = GNUNET_NO;
+ if (copied_elements > 0)
{
- GNUNET_CRYPTO_short_hash (zone_key,
- sizeof (struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- &zone_key_hash);
- GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash);
- if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash)))
+ if (GNUNET_YES == authoritative)
{
+ GNUNET_assert (NULL != cc);
e = get_block_expiration_time (rd_count, rd);
- signature_new = GNUNET_NAMESTORE_create_signature (cc->privkey, e, name,
rd, rd_count);
+ signature_new = GNUNET_NAMESTORE_create_signature (cc->privkey, e, name,
rd_selected, copied_elements);
GNUNET_assert (NULL != signature_new);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating signature for name `%s' with %u records in zone
`%s'\n",
name,
copied_elements,
GNUNET_short_h2s(&zone_key_hash));
- authoritative = GNUNET_YES;
}
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Not authoritative, records modified is %d, have sig is %d\n",
+ rd_modified,
+ NULL != signature);
+ if ((GNUNET_NO == rd_modified) && (NULL != signature))
+ contains_signature = GNUNET_YES; /* returning all records, so include
signature */
+ }
}
rd_ser_len = GNUNET_NAMESTORE_records_get_size (copied_elements,
rd_selected);
+ name_len = (NULL == name) ? 0 : strlen(name) + 1;
r_size = sizeof (struct LookupNameResponseMessage) +
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) +
name_len +
@@ -656,13 +717,12 @@
memcpy (name_tmp, name, name_len);
rd_tmp = &name_tmp[name_len];
GNUNET_NAMESTORE_records_serialize (copied_elements, rd_selected,
rd_ser_len, rd_tmp);
-
if (rd_selected != rd)
GNUNET_free_non_null (rd_selected);
-
if (NULL != zone_key)
lnr_msg->public_key = *zone_key;
- if (GNUNET_YES == authoritative)
+ if ( (GNUNET_YES == authoritative) &&
+ (copied_elements > 0) )
{
/* use new created signature */
lnr_msg->contains_sig = htons (GNUNET_YES);
@@ -957,35 +1017,31 @@
update = GNUNET_NO;
for (c = 0; c < rd_count; c++)
{
- if (crc->rd->record_type != rd[c].record_type)
+ if ( (crc->rd->record_type != rd[c].record_type) ||
+ ((crc->rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
+ != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) )
continue; /* no match */
if ( (GNUNET_NAMESTORE_TYPE_PKEY == crc->rd->record_type) ||
- (GNUNET_NAMESTORE_TYPE_PSEU == crc->rd->record_type) )
+ (GNUNET_NAMESTORE_TYPE_PSEU == crc->rd->record_type) ||
+ (GNUNET_DNSPARSER_TYPE_CNAME == crc->rd->record_type) )
{
- /* Update unique PKEY or PSEU */
- /* FIXME: should we do this test here? Is this not something
- that should be handled closer to the UI? If not, what
- about othrer 'unique' record types like CNAME? */
+ /* Update unique PKEY, PSEU or CNAME record; for these
+ record types, only one can be active at any time */
exist = c;
if ( (crc->rd->data_size != rd[c].data_size) ||
(0 != memcmp (crc->rd->data, rd[c].data, rd[c].data_size)) ||
- (crc->rd->expiration_time != rd[c].expiration_time) ||
- ((crc->rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
- != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) )
+ (crc->rd->expiration_time != rd[c].expiration_time) )
update = GNUNET_YES;
break;
}
if ( (crc->rd->data_size == rd[c].data_size) &&
(0 == memcmp (crc->rd->data, rd[c].data, rd[c].data_size)))
{
- /* FIXME: again, do we need to handle this special case here? */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found matching existing record for `%s'; only updating
expiration date!\n",
crc->name);
exist = c;
- if ( (crc->rd->expiration_time != rd[c].expiration_time) &&
- ((crc->rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
- == (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) ) )
+ if (crc->rd->expiration_time != rd[c].expiration_time)
update = GNUNET_YES;
break;
}
@@ -1682,7 +1738,7 @@
{
// FIXME: new expiration flags need additional special treatment here!
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Record %i has flags: 0x%x must have 0x%x \n",
+ "Record %i has flags: 0x%x must have 0x%x\n",
c, rd[c].flags,
proc->zi->must_have_flags);
include = GNUNET_YES;
@@ -1719,43 +1775,39 @@
"Included %u of %u records\n",
rd_count_filtered, rd_count);
- /* compute / obtain signature */
- GNUNET_CRYPTO_short_hash (zone_key,
- sizeof (struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- &zone_hash);
- GNUNET_CRYPTO_short_hash_double (&zone_hash, &long_hash);
- if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash)))
+ signature = NULL;
+ if (rd_count_filtered > 0)
{
- expire = get_block_expiration_time (rd_count_filtered, rd_filtered);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Creating signature for `%s' in zone `%s' with %u records and
expiration %llu\n",
- name, GNUNET_short_h2s(&zone_hash),
- rd_count_filtered,
- (unsigned long long) expire.abs_value);
- new_signature = GNUNET_NAMESTORE_create_signature (cc->privkey, expire,
name,
- rd_filtered,
rd_count_filtered);
- GNUNET_assert (NULL != signature);
- signature = new_signature;
- }
- else if (rd_count_filtered == rd_count)
- {
- if (NULL != signature)
+ /* compute / obtain signature */
+ GNUNET_CRYPTO_short_hash (zone_key,
+ sizeof (struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+ &zone_hash);
+ GNUNET_CRYPTO_short_hash_double (&zone_hash, &long_hash);
+ if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Using provided signature for `%s' in zone `%s' with %u
records and expiration %llu\n",
- name, GNUNET_short_h2s (&zone_hash), rd_count_filtered,
+ expire = get_block_expiration_time (rd_count_filtered, rd_filtered);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Creating signature for `%s' in zone `%s' with %u records and
expiration %llu\n",
+ name, GNUNET_short_h2s(&zone_hash),
+ rd_count_filtered,
(unsigned long long) expire.abs_value);
- return;
- }
+ new_signature = GNUNET_NAMESTORE_create_signature (cc->privkey, expire,
name,
+ rd_filtered,
rd_count_filtered);
+ GNUNET_assert (NULL != new_signature);
+ signature = new_signature;
+ }
+ else if (rd_count_filtered == rd_count)
+ {
+ if (NULL != signature)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Using provided signature for `%s' in zone `%s' with %u
records and expiration %llu\n",
+ name, GNUNET_short_h2s (&zone_hash), rd_count_filtered,
+ (unsigned long long) expire.abs_value);
+ return;
+ }
+ }
}
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No signature provided for `%s'\n",
- name);
- signature = NULL;
- }
-
if (GNUNET_YES == proc->zi->has_zone)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending name `%s' for iteration over zone `%s'\n",
Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c 2012-06-29 15:26:52 UTC (rev
22392)
+++ gnunet/src/namestore/namestore_common.c 2012-06-29 15:55:08 UTC (rev
22393)
@@ -614,6 +614,22 @@
return name_map[i].name;
}
+/**
+ * Test if a given record is expired.
+ *
+ * @return GNUNET_YES if the record is expired,
+ * GNUNET_NO if not
+ */
+int
+GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd)
+{
+ struct GNUNET_TIME_Absolute at;
+ if (0 != (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+ return GNUNET_NO;
+ at.abs_value = rd->expiration_time;
+ return (0 == GNUNET_TIME_absolute_get_remaining (at).rel_value) ? GNUNET_YES
: GNUNET_NO;
+}
+
/* end of namestore_common.c */
Modified: gnunet/src/namestore/test_namestore_api_create.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_create.c 2012-06-29 15:26:52 UTC
(rev 22392)
+++ gnunet/src/namestore/test_namestore_api_create.c 2012-06-29 15:55:08 UTC
(rev 22393)
@@ -152,13 +152,13 @@
}
}
- if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(zone_key, expire, n,
rd_count, rd, signature))
+ if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (zone_key, expire, n,
rd_count, rd, signature))
{
GNUNET_break (0);
failed = GNUNET_YES;
}
- if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(&pubkey, expire, n,
rd_count, rd, signature))
+ if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (&pubkey, expire, n,
rd_count, rd, signature))
{
GNUNET_break (0);
failed = GNUNET_YES;
@@ -167,7 +167,8 @@
struct GNUNET_NAMESTORE_RecordData rd_new[2];
rd_new[0] = *s_first_record;
rd_new[1] = *s_second_record;
- s_signature_updated = GNUNET_NAMESTORE_create_signature(privkey, expire,
s_name, rd_new, 2);
+ rd_new[1].flags = 0; /* unset GNUNET_NAMESTORE_RF_AUTHORITY */
+ s_signature_updated = GNUNET_NAMESTORE_create_signature (privkey, expire,
s_name, rd_new, 2);
if (0 != memcmp (s_signature_updated, signature, sizeof (struct
GNUNET_CRYPTO_RsaSignature)))
{
@@ -330,7 +331,7 @@
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < count; c++)
{
- rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = TEST_RECORD_DATALEN;
rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
Modified: gnunet/src/namestore/test_namestore_api_lookup.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_lookup.c 2012-06-29 15:26:52 UTC
(rev 22392)
+++ gnunet/src/namestore/test_namestore_api_lookup.c 2012-06-29 15:55:08 UTC
(rev 22393)
@@ -28,8 +28,6 @@
#include "namestore.h"
#include "gnunet_signatures.h"
-#define VERBOSE GNUNET_NO
-
#define RECORDS 5
#define TEST_RECORD_TYPE 1234
@@ -120,6 +118,7 @@
{
GNUNET_break (0);
}
+ GNUNET_assert (NULL != signature);
if (0 != memcmp (signature, s_signature, sizeof (struct
GNUNET_CRYPTO_RsaSignature)))
{
GNUNET_break (0);
@@ -184,7 +183,7 @@
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < count; c++)
{
- rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = TEST_RECORD_DATALEN;
rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
Modified: gnunet/src/namestore/test_namestore_api_lookup_specific_type.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_lookup_specific_type.c
2012-06-29 15:26:52 UTC (rev 22392)
+++ gnunet/src/namestore/test_namestore_api_lookup_specific_type.c
2012-06-29 15:55:08 UTC (rev 22393)
@@ -140,11 +140,6 @@
GNUNET_break(0);
failed = GNUNET_YES;
}
- if (NULL != signature)
- {
- GNUNET_break(0);
- failed = GNUNET_YES;
- }
if (failed == GNUNET_YES)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore returned invalid
response\n");
@@ -254,13 +249,13 @@
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < count-1; c++)
{
- rd[c].expiration_time = 0;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = 1;
rd[c].data_size = TEST_RECORD_DATALEN;
rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
}
- rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = TEST_RECORD_LOOKUP_TYPE_EXISTING;
rd[c].data_size = TEST_RECORD_DATALEN;
rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
Modified: gnunet/src/namestore/test_namestore_api_remove.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_remove.c 2012-06-29 15:26:52 UTC
(rev 22392)
+++ gnunet/src/namestore/test_namestore_api_remove.c 2012-06-29 15:55:08 UTC
(rev 22393)
@@ -220,14 +220,14 @@
struct GNUNET_NAMESTORE_RecordData * rd;
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
- rd[0].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[0].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[0].record_type = 0;
rd[0].data_size = TEST_REMOVE_RECORD_DATALEN;
rd[0].data = GNUNET_malloc(TEST_REMOVE_RECORD_DATALEN);
memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
for (c = 1; c < count; c++)
{
- rd[c].expiration_time = 0;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = TEST_RECORD_DATALEN;
rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
Modified: gnunet/src/namestore/test_namestore_api_zone_iteration.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration.c 2012-06-29
15:26:52 UTC (rev 22392)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration.c 2012-06-29
15:55:08 UTC (rev 22393)
@@ -353,7 +353,7 @@
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < count; c++)
{
- rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = 1111;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
Modified: gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
2012-06-29 15:26:52 UTC (rev 22392)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
2012-06-29 15:55:08 UTC (rev 22393)
@@ -312,7 +312,7 @@
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < count; c++)
{
- rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = 1111;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
Modified: gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
2012-06-29 15:26:52 UTC (rev 22392)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
2012-06-29 15:55:08 UTC (rev 22393)
@@ -361,7 +361,7 @@
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < count; c++)
{
- rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+ rd[c].expiration_time = GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS).abs_value;
rd[c].record_type = 1111;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22393 - in gnunet/src: include namestore,
gnunet <=