diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-07 08:55:06 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-07 08:55:06 +0000 |
commit | 19d6b482f8586fa1010f50791b5fcc4d77c3a6bc (patch) | |
tree | bce82721defac88506d51db8da2462bdf1464fbb /src/namestore | |
parent | a76f6c6081fa2f663d0f35cb10f657291a86af57 (diff) | |
download | gnunet-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.c | 15 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_specific_zone.c | 21 |
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; | |||
40 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 40 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
41 | static GNUNET_HashCode zone; | 41 | static GNUNET_HashCode zone; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2; | ||
44 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2; | ||
45 | static GNUNET_HashCode zone2; | ||
46 | |||
43 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 47 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
44 | static int res; | 48 | static int res; |
45 | 49 | ||
@@ -51,6 +55,10 @@ struct GNUNET_CRYPTO_RsaSignature *sig_2; | |||
51 | char * s_name_2; | 55 | char * s_name_2; |
52 | struct GNUNET_NAMESTORE_RecordData *s_rd_2; | 56 | struct GNUNET_NAMESTORE_RecordData *s_rd_2; |
53 | 57 | ||
58 | struct GNUNET_CRYPTO_RsaSignature *sig_3; | ||
59 | char * s_name_3; | ||
60 | struct GNUNET_NAMESTORE_RecordData *s_rd_3; | ||
61 | |||
54 | static void | 62 | static void |
55 | start_arm (const char *cfgname) | 63 | start_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 | ||
359 | static int | 380 | static int |