- fix in api
authorMatthias Wachs <wachs@net.in.tum.de>
Wed, 7 Mar 2012 08:55:06 +0000 (08:55 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Wed, 7 Mar 2012 08:55:06 +0000 (08:55 +0000)
- added second zone to test

src/namestore/namestore_api.c
src/namestore/test_namestore_api_zone_iteration_specific_zone.c

index da772cf82c758e16a044b09409cada4b31fe184a..fbf4711aed9963c3c46b9370bd3d7f0561222fde 100644 (file)
@@ -93,6 +93,7 @@ struct GNUNET_NAMESTORE_ZoneIterator
   GNUNET_HashCode zone;
   uint32_t no_flags;
   uint32_t flags;
+  int has_zone;
 };
 
 
@@ -1485,7 +1486,17 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
   it->proc = proc;
   it->proc_cls = proc;
   it->op_id = rid;
-  it->zone = *zone;
+
+  if (NULL != zone)
+  {
+    it->zone = *zone;
+    it->has_zone = GNUNET_YES;
+  }
+  else
+  {
+    memset (&it->zone, '\0', sizeof (it->zone));
+    it->has_zone = GNUNET_NO;
+  }
   GNUNET_CONTAINER_DLL_insert_tail(h->z_head, h->z_tail, it);
 
   /* set msg_size*/
@@ -1500,7 +1511,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
   msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START);
   msg->gns_header.header.size = htons (msg_size);
   msg->gns_header.r_id = htonl (rid);
-  if (NULL == zone)
+  if (NULL != zone)
     msg->zone = *zone;
   else
     memset (&msg->zone, '\0', sizeof (msg->zone));
index 01903699124b689e73be7e9cb35dc43755f36ff5..7d98eefb01bae05ef5ee5168c7425a1047e57fca 100644 (file)
@@ -40,6 +40,10 @@ static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 static GNUNET_HashCode zone;
 
+static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
+static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
+static GNUNET_HashCode zone2;
+
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 static int res;
 
@@ -51,6 +55,10 @@ struct GNUNET_CRYPTO_RsaSignature *sig_2;
 char * s_name_2;
 struct GNUNET_NAMESTORE_RecordData *s_rd_2;
 
+struct GNUNET_CRYPTO_RsaSignature *sig_3;
+char * s_name_3;
+struct GNUNET_NAMESTORE_RecordData *s_rd_3;
+
 static void
 start_arm (const char *cfgname)
 {
@@ -334,6 +342,12 @@ run (void *cls, char *const *args, const char *cfgfile,
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
   GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
 
+  privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2");
+  GNUNET_assert (privkey2 != NULL);
+  GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
+  GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
+
+
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);
 
@@ -354,6 +368,13 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   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_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n");
+  /* name in different zone */
+  GNUNET_asprintf(&s_name_3, "dummy3");
+  s_rd_3 = create_record(1);
+  sig_3 = GNUNET_NAMESTORE_create_signature(privkey, s_name_3, s_rd_3, 1);
+  GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL);
 }
 
 static int