aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-03-07 08:55:06 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-03-07 08:55:06 +0000
commit19d6b482f8586fa1010f50791b5fcc4d77c3a6bc (patch)
treebce82721defac88506d51db8da2462bdf1464fbb /src/namestore
parenta76f6c6081fa2f663d0f35cb10f657291a86af57 (diff)
downloadgnunet-19d6b482f8586fa1010f50791b5fcc4d77c3a6bc.tar.gz
gnunet-19d6b482f8586fa1010f50791b5fcc4d77c3a6bc.zip
- fix in api
- added second zone to test
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/namestore_api.c15
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c21
2 files changed, 34 insertions, 2 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index da772cf82..fbf4711ae 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -93,6 +93,7 @@ struct GNUNET_NAMESTORE_ZoneIterator
93 GNUNET_HashCode zone; 93 GNUNET_HashCode zone;
94 uint32_t no_flags; 94 uint32_t no_flags;
95 uint32_t flags; 95 uint32_t flags;
96 int has_zone;
96}; 97};
97 98
98 99
@@ -1485,7 +1486,17 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
1485 it->proc = proc; 1486 it->proc = proc;
1486 it->proc_cls = proc; 1487 it->proc_cls = proc;
1487 it->op_id = rid; 1488 it->op_id = rid;
1488 it->zone = *zone; 1489
1490 if (NULL != zone)
1491 {
1492 it->zone = *zone;
1493 it->has_zone = GNUNET_YES;
1494 }
1495 else
1496 {
1497 memset (&it->zone, '\0', sizeof (it->zone));
1498 it->has_zone = GNUNET_NO;
1499 }
1489 GNUNET_CONTAINER_DLL_insert_tail(h->z_head, h->z_tail, it); 1500 GNUNET_CONTAINER_DLL_insert_tail(h->z_head, h->z_tail, it);
1490 1501
1491 /* set msg_size*/ 1502 /* set msg_size*/
@@ -1500,7 +1511,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
1500 msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); 1511 msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START);
1501 msg->gns_header.header.size = htons (msg_size); 1512 msg->gns_header.header.size = htons (msg_size);
1502 msg->gns_header.r_id = htonl (rid); 1513 msg->gns_header.r_id = htonl (rid);
1503 if (NULL == zone) 1514 if (NULL != zone)
1504 msg->zone = *zone; 1515 msg->zone = *zone;
1505 else 1516 else
1506 memset (&msg->zone, '\0', sizeof (msg->zone)); 1517 memset (&msg->zone, '\0', sizeof (msg->zone));
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 019036991..7d98eefb0 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -40,6 +40,10 @@ static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
40static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; 40static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
41static GNUNET_HashCode zone; 41static GNUNET_HashCode zone;
42 42
43static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
44static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
45static GNUNET_HashCode zone2;
46
43static struct GNUNET_NAMESTORE_ZoneIterator *zi; 47static struct GNUNET_NAMESTORE_ZoneIterator *zi;
44static int res; 48static int res;
45 49
@@ -51,6 +55,10 @@ struct GNUNET_CRYPTO_RsaSignature *sig_2;
51char * s_name_2; 55char * s_name_2;
52struct GNUNET_NAMESTORE_RecordData *s_rd_2; 56struct GNUNET_NAMESTORE_RecordData *s_rd_2;
53 57
58struct GNUNET_CRYPTO_RsaSignature *sig_3;
59char * s_name_3;
60struct GNUNET_NAMESTORE_RecordData *s_rd_3;
61
54static void 62static void
55start_arm (const char *cfgname) 63start_arm (const char *cfgname)
56{ 64{
@@ -334,6 +342,12 @@ run (void *cls, char *const *args, const char *cfgfile,
334 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 342 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
335 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone); 343 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
336 344
345 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2");
346 GNUNET_assert (privkey2 != NULL);
347 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
348 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
349
350
337 start_arm (cfgfile); 351 start_arm (cfgfile);
338 GNUNET_assert (arm != NULL); 352 GNUNET_assert (arm != NULL);
339 353
@@ -354,6 +368,13 @@ run (void *cls, char *const *args, const char *cfgfile,
354 368
355 sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1); 369 sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1);
356 GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont, NULL); 370 GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont, NULL);
371
372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n");
373 /* name in different zone */
374 GNUNET_asprintf(&s_name_3, "dummy3");
375 s_rd_3 = create_record(1);
376 sig_3 = GNUNET_NAMESTORE_create_signature(privkey, s_name_3, s_rd_3, 1);
377 GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL);
357} 378}
358 379
359static int 380static int