[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20336 - in gnunet/src: gns include namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20336 - in gnunet/src: gns include namestore |
Date: |
Wed, 7 Mar 2012 13:45:04 +0100 |
Author: wachs
Date: 2012-03-07 13:45:04 +0100 (Wed, 07 Mar 2012)
New Revision: 20336
Modified:
gnunet/src/gns/gnunet-gns-fcfsd.c
gnunet/src/gns/namestore_stub_api.c
gnunet/src/gns/test_gns_dht_delegated_lookup.c
gnunet/src/gns/test_gns_simple_delegated_lookup.c
gnunet/src/gns/test_gns_simple_lookup.c
gnunet/src/gns/test_gns_twopeer.c
gnunet/src/include/gnunet_namestore_service.h
gnunet/src/namestore/gnunet-namestore.c
gnunet/src/namestore/gnunet-service-namestore.c
gnunet/src/namestore/namestore_api.c
gnunet/src/namestore/test_namestore_api.conf
gnunet/src/namestore/test_namestore_api_create.c
gnunet/src/namestore/test_namestore_api_create_update.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:
namestore api change: include block expiration time in record create
Modified: gnunet/src/gns/gnunet-gns-fcfsd.c
===================================================================
--- gnunet/src/gns/gnunet-gns-fcfsd.c 2012-03-07 12:16:45 UTC (rev 20335)
+++ gnunet/src/gns/gnunet-gns-fcfsd.c 2012-03-07 12:45:04 UTC (rev 20336)
@@ -392,6 +392,7 @@
r.flags = htonl (GNUNET_NAMESTORE_RF_AUTHORITY);
request->qe = GNUNET_NAMESTORE_record_create (ns,
fcfs_zone_pkey,
+
GNUNET_TIME_absolute_get_forever(),
request->domain_name,
&r,
&put_continuation,
Modified: gnunet/src/gns/namestore_stub_api.c
===================================================================
--- gnunet/src/gns/namestore_stub_api.c 2012-03-07 12:16:45 UTC (rev 20335)
+++ gnunet/src/gns/namestore_stub_api.c 2012-03-07 12:45:04 UTC (rev 20336)
@@ -227,6 +227,7 @@
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h,
const struct GNUNET_CRYPTO_RsaPrivateKey *key,
+ const struct GNUNET_TIME_Absolute expire,
const char *name,
const struct GNUNET_NAMESTORE_RecordData *rd,
GNUNET_NAMESTORE_ContinuationWithStatus cont,
Modified: gnunet/src/gns/test_gns_dht_delegated_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_dht_delegated_lookup.c 2012-03-07 12:16:45 UTC
(rev 20335)
+++ gnunet/src/gns/test_gns_dht_delegated_lookup.c 2012-03-07 12:45:04 UTC
(rev 20336)
@@ -302,6 +302,7 @@
GNUNET_NAMESTORE_record_create (namestore_handle,
alice_key,
+ GNUNET_TIME_absolute_get_forever(),
TEST_AUTHORITY_NAME,
&rd,
&put_dht,
Modified: gnunet/src/gns/test_gns_simple_delegated_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_simple_delegated_lookup.c 2012-03-07 12:16:45 UTC
(rev 20335)
+++ gnunet/src/gns/test_gns_simple_delegated_lookup.c 2012-03-07 12:45:04 UTC
(rev 20336)
@@ -226,6 +226,7 @@
GNUNET_NAMESTORE_record_create (namestore_handle,
alice_key,
+ GNUNET_TIME_absolute_get_forever(),
TEST_AUTHORITY_NAME,
&rd,
NULL,
Modified: gnunet/src/gns/test_gns_simple_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_simple_lookup.c 2012-03-07 12:16:45 UTC (rev
20335)
+++ gnunet/src/gns/test_gns_simple_lookup.c 2012-03-07 12:45:04 UTC (rev
20336)
@@ -214,6 +214,7 @@
GNUNET_NAMESTORE_record_create (namestore_handle,
alice_key,
+ GNUNET_TIME_absolute_get_forever(),
TEST_RECORD_NAME,
&rd,
&finish_testing,
Modified: gnunet/src/gns/test_gns_twopeer.c
===================================================================
--- gnunet/src/gns/test_gns_twopeer.c 2012-03-07 12:16:45 UTC (rev 20335)
+++ gnunet/src/gns/test_gns_twopeer.c 2012-03-07 12:45:04 UTC (rev 20336)
@@ -437,6 +437,7 @@
GNUNET_NAMESTORE_record_create (namestore_handle,
alice_key,
+ GNUNET_TIME_absolute_get_forever(),
"bob",
&rd,
NULL,
@@ -445,6 +446,7 @@
rd.data = &alice_pkey;
GNUNET_NAMESTORE_record_create (namestore_handle,
bob_key,
+ GNUNET_TIME_absolute_get_forever(),
"alice",
&rd,
NULL,
@@ -460,6 +462,7 @@
GNUNET_NAMESTORE_record_create (namestore_handle,
bob_key,
+ GNUNET_TIME_absolute_get_forever(),
"www",
&rd,
NULL,
Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h 2012-03-07 12:16:45 UTC
(rev 20335)
+++ gnunet/src/include/gnunet_namestore_service.h 2012-03-07 12:45:04 UTC
(rev 20336)
@@ -227,6 +227,7 @@
*
* @param h handle to the namestore
* @param pkey private key of the zone
+ * @param expire block expiration time
* @param name name that is being mapped (at most 255 characters long)
* @param rd record data to store
* @param cont continuation to call when done
@@ -235,11 +236,12 @@
*/
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_CRYPTO_RsaPrivateKey *pkey,
- const char *name,
- const struct GNUNET_NAMESTORE_RecordData *rd,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls);
+ const struct GNUNET_CRYPTO_RsaPrivateKey *pkey,
+ const struct GNUNET_TIME_Absolute expire,
+ const char *name,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
+ GNUNET_NAMESTORE_ContinuationWithStatus cont,
+ void *cont_cls);
/**
Modified: gnunet/src/namestore/gnunet-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore.c 2012-03-07 12:16:45 UTC (rev
20335)
+++ gnunet/src/namestore/gnunet-namestore.c 2012-03-07 12:45:04 UTC (rev
20336)
@@ -103,9 +103,13 @@
* Desired expiration time.
*/
static char *expirationstring;
-
/**
+ * Desired block expiration time.
+ */
+static char *blockexpirationstring;
+
+/**
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
@@ -257,6 +261,7 @@
void *data = NULL;
size_t data_size = 0;
struct GNUNET_TIME_Relative etime;
+ struct GNUNET_TIME_Relative btime;
struct GNUNET_NAMESTORE_RecordData rd;
if (NULL == keyfile)
@@ -354,6 +359,27 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
+ if (NULL != blockexpirationstring)
+ {
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_fancy_time_to_relative (blockexpirationstring,
+ &btime))
+ {
+ fprintf (stderr,
+ _("Invalid time format `%s'\n"),
+ blockexpirationstring);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ } else if (add | del)
+ {
+ fprintf (stderr,
+ _("Missing option `%s' for operation `%s'\n"),
+ "-b", _("add/del"));
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
if (add)
{
if (NULL == name)
@@ -371,6 +397,7 @@
rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY; // FIXME: not always...
add_qe = GNUNET_NAMESTORE_record_create (ns,
zone_pkey,
+ GNUNET_TIME_relative_to_absolute
(btime),
name,
&rd,
&add_continuation,
@@ -391,7 +418,7 @@
rd.record_type = type;
rd.expiration = GNUNET_TIME_relative_to_absolute (etime);
rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY; // FIXME: not always...
- del_qe = GNUNET_NAMESTORE_record_create (ns,
+ del_qe = GNUNET_NAMESTORE_record_remove (ns,
zone_pkey,
name,
&rd,
@@ -423,7 +450,10 @@
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
{'a', "add", NULL,
gettext_noop ("add record"), 0,
- &GNUNET_GETOPT_set_one, &add},
+ &GNUNET_GETOPT_set_one, &add},
+ {'b', "name-expiration", "TIME",
+ gettext_noop ("expiration time for name to use (for adding only)"), 1,
+ &GNUNET_GETOPT_set_string, &blockexpirationstring},
{'d', "delete", NULL,
gettext_noop ("delete record"), 0,
&GNUNET_GETOPT_set_one, &del},
@@ -431,7 +461,7 @@
gettext_noop ("display records"), 0,
&GNUNET_GETOPT_set_one, &list},
{'e', "expiration", "TIME",
- gettext_noop ("expiration time to use (for adding only)"), 1,
+ gettext_noop ("expiration time for record to use (for adding only)"), 1,
&GNUNET_GETOPT_set_string, &expirationstring},
{'n', "name", "NAME",
gettext_noop ("name of the record to add/delete/display"), 1,
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2012-03-07 12:16:45 UTC
(rev 20335)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2012-03-07 12:45:04 UTC
(rev 20336)
@@ -170,6 +170,7 @@
GNUNET_free (no);
}
+
GNUNET_SERVER_client_drop(nc->client);
GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc);
GNUNET_free (nc);
@@ -543,6 +544,7 @@
struct CreateRecordContext * crc = cls;
struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
struct GNUNET_NAMESTORE_RecordData *rd_new = NULL;
+ struct GNUNET_TIME_Absolute block_expiration;
int res;
int exist = GNUNET_SYSERR;
int update = GNUNET_NO;
@@ -609,11 +611,16 @@
}
}
+ block_expiration = GNUNET_TIME_absolute_max(crc->expire, expire);
+ if (block_expiration.abs_value != expire.abs_value)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updated block expiration time\n");
+
+
/* Database operation */
GNUNET_assert ((rd_new != NULL) && (rd_count_new > 0));
res = GSN_database->put_records(GSN_database->cls,
(const struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) crc->pubkey,
- crc->expire,
+ block_expiration,
crc->name,
rd_count_new, rd_new,
signature_new);
@@ -729,6 +736,7 @@
}
struct GNUNET_NAMESTORE_RecordData rd[rd_count];
+
res = GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
if ((res != GNUNET_OK) || (rd_count != 1))
{
@@ -742,6 +750,8 @@
GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
GNUNET_CRYPTO_hash (&pub, sizeof (struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+ crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire);
+ crc.res = GNUNET_SYSERR;
crc.pkey = pkey;
crc.pubkey = &pub;
crc.rd = rd;
@@ -1289,7 +1299,6 @@
GNUNET_CONTAINER_DLL_insert (nc->op_head, nc->op_tail, zi);
-
res = GSN_database->iterate_records (GSN_database->cls, zone_tmp , NULL,
zi->offset , &zone_iteration_proc, zi);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c 2012-03-07 12:16:45 UTC (rev
20335)
+++ gnunet/src/namestore/namestore_api.c 2012-03-07 12:45:04 UTC (rev
20336)
@@ -1095,6 +1095,7 @@
*
* @param h handle to the namestore
* @param pkey private key of the zone
+ * @param expire block expiration time
* @param name name that is being mapped (at most 255 characters long)
* @param rd record data to store
* @param cont continuation to call when done
@@ -1104,6 +1105,7 @@
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h,
const struct GNUNET_CRYPTO_RsaPrivateKey *pkey,
+ const struct GNUNET_TIME_Absolute expire,
const char *name,
const struct GNUNET_NAMESTORE_RecordData *rd,
GNUNET_NAMESTORE_ContinuationWithStatus cont,
@@ -1169,6 +1171,7 @@
msg->rd_count = htons (1);
msg->rd_len = htons (rd_ser_len);
msg->pkey_len = htons (key_len);
+ msg->expire = GNUNET_TIME_absolute_hton(expire);
memcpy (pkey_tmp, pkey_enc, key_len);
memcpy (name_tmp, name, name_len);
memcpy (rd_tmp, rd_ser, rd_ser_len);
Modified: gnunet/src/namestore/test_namestore_api.conf
===================================================================
--- gnunet/src/namestore/test_namestore_api.conf 2012-03-07 12:16:45 UTC
(rev 20335)
+++ gnunet/src/namestore/test_namestore_api.conf 2012-03-07 12:45:04 UTC
(rev 20336)
@@ -4,7 +4,7 @@
UNIXPATH = /tmp/gnunet-p1-service-arm.sock
[namestore]
-#PREFIX = valgrind --leak-check=full
+#PREFIX = valgrind --leak-check=full --track-origins=yes
AUTOSTART = YES
UNIXPATH = /tmp/gnunet-service-namestore.sock
UNIX_MATCH_UID = YES
Modified: gnunet/src/namestore/test_namestore_api_create.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_create.c 2012-03-07 12:16:45 UTC
(rev 20335)
+++ gnunet/src/namestore/test_namestore_api_create.c 2012-03-07 12:45:04 UTC
(rev 20336)
@@ -301,7 +301,7 @@
s_second_record->data_size = TEST_CREATE_RECORD_DATALEN;
memset ((char *) s_second_record->data, TEST_CREATE_RECORD_DATA,
TEST_CREATE_RECORD_DATALEN);
- GNUNET_NAMESTORE_record_create (nsh, privkey, name, s_second_record,
&create_second_cont, name);
+ GNUNET_NAMESTORE_record_create (nsh, privkey,
GNUNET_TIME_absolute_get_forever(), name, s_second_record, &create_second_cont,
name);
}
else
@@ -430,7 +430,7 @@
GNUNET_break (s_name != NULL);
/* create initial record */
- GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record,
&create_first_cont, s_name);
+ GNUNET_NAMESTORE_record_create (nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name, s_first_record, &create_first_cont,
s_name);
}
static int
Modified: gnunet/src/namestore/test_namestore_api_create_update.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_create_update.c 2012-03-07
12:16:45 UTC (rev 20335)
+++ gnunet/src/namestore/test_namestore_api_create_update.c 2012-03-07
12:45:04 UTC (rev 20336)
@@ -301,7 +301,7 @@
s_second_record->data_size = TEST_CREATE_RECORD_DATALEN;
memset ((char *) s_second_record->data, TEST_CREATE_RECORD_DATA,
TEST_CREATE_RECORD_DATALEN);
- GNUNET_NAMESTORE_record_create (nsh, privkey, name, s_second_record,
&create_second_cont, name);
+ GNUNET_NAMESTORE_record_create (nsh, privkey,
GNUNET_TIME_absolute_get_forever(), name, s_second_record, &create_second_cont,
name);
}
else
@@ -349,7 +349,7 @@
{
res = 0;
s_first_record->expiration = GNUNET_TIME_absolute_get ();
- GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record,
&create_updated_cont, s_name);
+ GNUNET_NAMESTORE_record_create (nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name, s_first_record,
&create_updated_cont, s_name);
}
else
{
@@ -369,7 +369,7 @@
{
res = 0;
/* check if record was created correct */
- GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record,
&create_identical_cont, s_name);
+ GNUNET_NAMESTORE_record_create (nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name, s_first_record,
&create_identical_cont, s_name);
}
else
{
@@ -474,7 +474,7 @@
GNUNET_break (s_name != NULL);
/* create initial record */
- GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record,
&create_first_cont, s_name);
+ GNUNET_NAMESTORE_record_create (nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name, s_first_record, &create_first_cont,
s_name);
}
static int
Modified: gnunet/src/namestore/test_namestore_api_zone_iteration.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration.c 2012-03-07
12:16:45 UTC (rev 20335)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration.c 2012-03-07
12:45:04 UTC (rev 20336)
@@ -409,7 +409,7 @@
GNUNET_asprintf(&s_name_1, "dummy1");
s_rd_1 = create_record(1);
sig_1 = GNUNET_NAMESTORE_create_signature(privkey, s_name_1, s_rd_1, 1);
- GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_1, s_rd_1, &put_cont,
NULL);
+ GNUNET_NAMESTORE_record_create(nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name_1, s_rd_1, &put_cont, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n");
@@ -417,7 +417,7 @@
s_rd_2 = create_record(1);
sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1);
- GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont,
NULL);
+ GNUNET_NAMESTORE_record_create(nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name_2, s_rd_2, &put_cont, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n");
/* name in different zone */
Modified: gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
2012-03-07 12:16:45 UTC (rev 20335)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
2012-03-07 12:45:04 UTC (rev 20336)
@@ -390,7 +390,7 @@
GNUNET_asprintf(&s_name_1, "dummy1");
s_rd_1 = create_record(1);
sig_1 = GNUNET_NAMESTORE_create_signature(privkey, s_name_1, s_rd_1, 1);
- GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_1, s_rd_1, &put_cont,
NULL);
+ GNUNET_NAMESTORE_record_create(nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name_1, s_rd_1, &put_cont, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n");
@@ -398,7 +398,7 @@
s_rd_2 = create_record(1);
sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1);
- GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont,
NULL);
+ GNUNET_NAMESTORE_record_create(nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name_2, s_rd_2, &put_cont, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n");
/* name in different zone */
Modified: gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
2012-03-07 12:16:45 UTC (rev 20335)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration_stop.c
2012-03-07 12:45:04 UTC (rev 20336)
@@ -28,7 +28,7 @@
#define VERBOSE GNUNET_NO
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
static struct GNUNET_NAMESTORE_Handle * nsh;
@@ -430,7 +430,7 @@
GNUNET_asprintf(&s_name_1, "dummy1");
s_rd_1 = create_record(1);
sig_1 = GNUNET_NAMESTORE_create_signature(privkey, s_name_1, s_rd_1, 1);
- GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_1, s_rd_1, &put_cont,
NULL);
+ GNUNET_NAMESTORE_record_create(nsh, privkey,
GNUNET_TIME_absolute_get_forever(), s_name_1, s_rd_1, &put_cont, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n");
@@ -438,7 +438,7 @@
s_rd_2 = create_record(1);
sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1);
- GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont,
NULL);
+ GNUNET_NAMESTORE_record_create(nsh,
privkey,GNUNET_TIME_absolute_get_forever(), s_name_2, s_rd_2, &put_cont, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n");
/* name in different zone */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20336 - in gnunet/src: gns include namestore,
gnunet <=