/*
This file is part of GNUnet.
- (C) 2004, 2009 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2004, 2009 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
}
-static size_t
+static ssize_t
address_generator (void *cls, size_t max, void *buf)
{
size_t *agc = cls;
- size_t ret;
+ ssize_t ret;
struct GNUNET_HELLO_Address address;
if (0 == *agc)
- return 0;
+ return GNUNET_SYSERR; /* Done */
memset (&address.peer, 0, sizeof (struct GNUNET_PeerIdentity));
address.address = "Address";
address.transport_name = "peerinfotest";
return ret;
}
+struct GNUNET_PeerIdentity pid;
static void
add_peer ()
{
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
- struct GNUNET_PeerIdentity pid;
struct GNUNET_HELLO_Message *h2;
size_t agc;
agc = 2;
- memset (&pkey, 32, sizeof (pkey));
- GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey);
- h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc);
+ memset (&pid, 32, sizeof (pid));
+ h2 = GNUNET_HELLO_create (&pid.public_key, &address_generator, &agc, GNUNET_NO);
GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
GNUNET_free (h2);
/* try again */
retries++;
add_peer ();
- ic = GNUNET_PEERINFO_iterate (h, NULL,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 15), &process,
+ ic = GNUNET_PEERINFO_iterate (h, GNUNET_NO, NULL,
+ &process,
cls);
return;
}
{
GNUNET_assert (3 == global_ret);
agc = 3;
- GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &check_it, &agc);
+ GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
+ &check_it, &agc);
GNUNET_assert (agc == 0);
global_ret = 2;
}
static void
-run (void *cls,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TESTING_Peer *peer)
{
h = GNUNET_PEERINFO_connect (cfg);
GNUNET_assert (NULL != h);
add_peer ();
- ic = GNUNET_PEERINFO_iterate (h, NULL,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls);
+ ic = GNUNET_PEERINFO_iterate (h, GNUNET_NO, &pid,
+ &process, cls);
}