[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10655 - in gnunet: . src/peerinfo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10655 - in gnunet: . src/peerinfo |
Date: |
Thu, 18 Mar 2010 15:55:38 +0100 |
Author: grothoff
Date: 2010-03-18 15:55:38 +0100 (Thu, 18 Mar 2010)
New Revision: 10655
Modified:
gnunet/TODO
gnunet/src/peerinfo/gnunet-peerinfo.c
Log:
stuff
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-03-18 14:46:42 UTC (rev 10654)
+++ gnunet/TODO 2010-03-18 14:55:38 UTC (rev 10655)
@@ -23,8 +23,10 @@
- disconnect notifications from TCP not always as nice as we might want
them to be (but how can we do this cleanly given that UDP is
connectionless?)
- implement transport API to pretty-print transport address
- + transport_api extension (API extension!)
- + service-transport extension (protocol extension)
+ + resolve cyclic dependency (gnunet-peerinfo -> transport_api -> peerinfo!)
+ + gnunet-transport-service crashes when asked to resolve address (!)
+ + asynchronous transport lookup and non-CPS iterator in peerinfo require
+ some work to ensure printing in the proper order...
- instantly filter addresses from *other* peers that
are *equal* to our own address + port (i.e., localhost:2086). We
no longer filter those for outgoing (helps with loopback testing
Modified: gnunet/src/peerinfo/gnunet-peerinfo.c
===================================================================
--- gnunet/src/peerinfo/gnunet-peerinfo.c 2010-03-18 14:46:42 UTC (rev
10654)
+++ gnunet/src/peerinfo/gnunet-peerinfo.c 2010-03-18 14:55:38 UTC (rev
10655)
@@ -28,6 +28,7 @@
#include "gnunet_configuration_lib.h"
#include "gnunet_getopt_lib.h"
#include "gnunet_peerinfo_service.h"
+#include "gnunet_transport_service.h"
#include "gnunet_program_lib.h"
static int no_resolve;
@@ -36,7 +37,64 @@
static int get_self;
+static struct GNUNET_SCHEDULER_Handle *sched;
+
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
+
+#if FIXME
/**
+ * Function to call with a human-readable format of an address
+ *
+ * @param cls closure
+ * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
+ */
+static void
+print_resolved_address (void *cls,
+ const char *address)
+{
+ /* FIXME: need to buffer output from all requests and print it at
+ once, otherwise we mix results... */
+ if (address == NULL)
+ {
+ fprintf (stderr, "\n");
+ return;
+ }
+ fprintf (stderr, " %s\n", address);
+}
+#endif
+
+/**
+ * Iterator callback to go over all addresses.
+ *
+ * @param cls closure
+ * @param tname name of the transport
+ * @param expiration expiration time
+ * @param addr the address
+ * @param addrlen length of the address
+ * @return GNUNET_OK to keep the address and continue
+ */
+static int
+print_address (void *cls,
+ const char *tname,
+ struct GNUNET_TIME_Absolute expiration,
+ const void *addr, size_t addrlen)
+{
+#if FIXME
+ GNUNET_TRANSPORT_address_lookup (sched,
+ cfg,
+ addr,
+ addrlen,
+ no_resolve,
+ tname,
+ GNUNET_TIME_UNIT_SECONDS,
+ &print_resolved_address,
+ NULL);
+#endif
+ return GNUNET_OK;
+}
+
+
+/**
* Print information about the peer.
* Currently prints the GNUNET_PeerIdentity, trust and the IP.
* Could of course do more (e.g. resolve via DNS).
@@ -48,34 +106,33 @@
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
- /* FIXME: add printing of address information!
- => need extended transport API! */
- if (peer == NULL)
+ if (peer == NULL)
+ return;
+ GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
+ if (be_quiet)
{
- return;
+ printf ("%s\n", (const char *) &enc);
+ return;
}
- GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
- if (be_quiet)
- printf ("%s\n", (const char *) &enc);
- else
- printf (_("Peer `%s' with trust %8u\n"), (const char *) &enc, trust);
+ printf (_("Peer `%s' with trust %8u\n"), (const char *) &enc, trust);
+ GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &print_address, NULL);
}
/**
* Main function that will be run by the scheduler.
*
* @param cls closure
- * @param sched the scheduler to use
+ * @param s the scheduler to use
* @param args remaining command-line arguments
* @param cfgfile name of the configuration file used (for saving, can be
NULL!)
- * @param cfg configuration
+ * @param c configuration
*/
static void
run (void *cls,
- struct GNUNET_SCHEDULER_Handle *sched,
+ struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
struct GNUNET_CRYPTO_RsaPrivateKey *priv;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
@@ -83,6 +140,8 @@
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
char *fn;
+ sched = s;
+ cfg = c;
if (get_self != GNUNET_YES)
{
(void) GNUNET_PEERINFO_iterate (cfg,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10655 - in gnunet: . src/peerinfo,
gnunet <=