[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6781 - in GNUnet: . doc/man src/server
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6781 - in GNUnet: . doc/man src/server |
Date: |
Tue, 6 May 2008 04:30:40 -0600 (MDT) |
Author: grothoff
Date: 2008-05-06 04:30:40 -0600 (Tue, 06 May 2008)
New Revision: 6781
Modified:
GNUnet/ChangeLog
GNUnet/doc/man/gnunet-peer-info.1
GNUnet/src/server/gnunet-peer-info.c
GNUnet/todo
Log:
make it possible to get our own identity with gnunet-peer-info
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2008-05-06 10:10:25 UTC (rev 6780)
+++ GNUnet/ChangeLog 2008-05-06 10:30:40 UTC (rev 6781)
@@ -1,5 +1,6 @@
Tue May 6 04:10:02 MDT 2008
Added simple sanity check for [MODULES] values.
+ Added "-s" and "-q" options to gnunet-peer-info.
Thu Apr 24 00:05:17 MDT 2008
Simplified FSUI stop/abort/pause/resume API calls
Modified: GNUnet/doc/man/gnunet-peer-info.1
===================================================================
--- GNUnet/doc/man/gnunet-peer-info.1 2008-05-06 10:10:25 UTC (rev 6780)
+++ GNUnet/doc/man/gnunet-peer-info.1 2008-05-06 10:30:40 UTC (rev 6781)
@@ -1,4 +1,4 @@
-.TH GNUNET-PEER-INFO 1 "Dec 29, 2006" "GNUnet"
+.TH GNUNET-PEER-INFO 1 "May 6, 2008" "GNUnet"
.SH NAME
gnunet\-peer\-info \- Display information about other known nodes.
@@ -26,6 +26,12 @@
.IP "\-n, \-\-numeric"
Disable resolution of IPs to hostnames
.B
+.IP "\-q, \-\-quiet"
+Do not print anything but the peer identities
+.B
+.IP "\-s, \-\-self"
+Print only our own identity (together with "\-q", this is the exact line that
other peers would have to put in to their friends file in order to consider
this peer one of their friends in F2F mode).
+.B
.IP "\-v, \-\-version"
Print the version number
.B
Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c 2008-05-06 10:10:25 UTC (rev
6780)
+++ GNUnet/src/server/gnunet-peer-info.c 2008-05-06 10:30:40 UTC (rev
6781)
@@ -43,6 +43,10 @@
static int no_resolve = GNUNET_NO;
+static int get_self = GNUNET_NO;
+
+static int be_quiet = GNUNET_NO;
+
/**
* All gnunet-peer-info command line options
*/
@@ -54,6 +58,12 @@
{'n', "numeric", NULL,
gettext_noop ("don't resolve host names"),
0, &GNUNET_getopt_configure_set_one, &no_resolve},
+ {'q', "quiet", NULL,
+ gettext_noop ("output only the identity strings"),
+ 0, &GNUNET_getopt_configure_set_one, &be_quiet},
+ {'s', "self", NULL,
+ gettext_noop ("output our own identity only"),
+ 0, &GNUNET_getopt_configure_set_one, &get_self},
GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -116,8 +126,8 @@
if (NULL == hello)
{
GNUNET_GE_LOG (ectx,
- GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
- _("Could not get address of peer `%s'.\n"), &enc);
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
+ _("Could not get address of peer `%s'.\n"), &enc);
return GNUNET_OK;
}
if (GNUNET_SYSERR == GNUNET_RSA_verify (&hello->senderIdentity,
@@ -129,8 +139,9 @@
&hello->publicKey))
{
GNUNET_GE_LOG (ectx,
- GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
- _("hello message invalid (signature invalid).\n"));
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
+ _("`%s' message invalid (signature invalid).\n"),
+ "HELLO");
}
addr = NULL;
addr_len = 0;
@@ -151,12 +162,20 @@
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Could not get address of peer `%s'.\n"), &enc);
- printf (_("Peer `%s' with trust %8u\n"),
- (char *) &enc, identity->getHostTrust (id));
+ if (be_quiet)
+ printf ("%s\n",
+ (char *) &enc);
+ else
+ printf (_("Peer `%s' with trust %8u\n"),
+ (char *) &enc, identity->getHostTrust (id));
return GNUNET_OK;
}
- printf (_("Peer `%s' with trust %8u and address `%s'\n"),
- (char *) &enc, identity->getHostTrust (id), info);
+ if (be_quiet)
+ printf ("%s\n",
+ (char *) &enc);
+ else
+ printf (_("Peer `%s' with trust %8u and address `%s'\n"),
+ (char *) &enc, identity->getHostTrust (id), info);
GNUNET_free (info);
return GNUNET_OK;
}
@@ -166,6 +185,9 @@
{
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
+ const GNUNET_RSA_PublicKey * me;
+ GNUNET_PeerIdentity id;
+ GNUNET_EncName enc;
int ret;
ret = GNUNET_init (argc,
@@ -184,20 +206,57 @@
"DISABLE",
"YES"));
cron = GNUNET_cron_create (ectx);
- GNUNET_CORE_init (ectx, cfg, cron, NULL);
+ if (GNUNET_OK != GNUNET_CORE_init (ectx, cfg, cron, NULL))
+ {
+ GNUNET_cron_destroy (cron);
+ GNUNET_fini (ectx, cfg);
+ return -1;
+ }
identity = GNUNET_CORE_request_service ("identity");
+ if (identity == NULL)
+ {
+ GNUNET_CORE_done ();
+ GNUNET_cron_destroy (cron);
+ GNUNET_fini (ectx, cfg);
+ return -1;
+ }
transport = GNUNET_CORE_request_service ("transport");
- if (no_resolve != GNUNET_YES)
+ if (transport == NULL)
{
+ GNUNET_CORE_release_service(identity);
+ GNUNET_CORE_done ();
+ GNUNET_cron_destroy (cron);
+ GNUNET_fini (ectx, cfg);
+ return -1;
+ }
+ if (get_self != GNUNET_YES)
+ {
+ if (no_resolve != GNUNET_YES)
+ {
#if HAVE_ADNS
- identity->forEachHost (0, /* no timeout */
- &resolveHostInfo, NULL);
- /* give GNU ADNS time to resolve... */
- GNUNET_thread_sleep (2 * GNUNET_CRON_SECONDS);
+ identity->forEachHost (0, /* no timeout */
+ &resolveHostInfo, NULL);
+ /* give GNU ADNS time to resolve... */
+ GNUNET_thread_sleep (2 * GNUNET_CRON_SECONDS);
#endif
+ }
+ identity->forEachHost (0, /* no timeout */
+ &printHostInfo, NULL);
+ }
+ else
+ {
+ me = identity->getPublicPrivateKey();
+ identity->getPeerIdentity(me,
+ &id);
+ GNUNET_hash_to_enc(&id.hashPubKey,
+ &enc);
+ if (be_quiet)
+ printf ("%s\n",
+ (char *) &enc);
+ else
+ printf(_("I am peer `%s'.\n"),
+ (const char*)&enc);
}
- identity->forEachHost (0, /* no timeout */
- &printHostInfo, NULL);
GNUNET_CORE_release_service (identity);
GNUNET_CORE_release_service (transport);
GNUNET_CORE_done ();
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-05-06 10:10:25 UTC (rev 6780)
+++ GNUnet/todo 2008-05-06 10:30:40 UTC (rev 6781)
@@ -10,7 +10,6 @@
- gnunet-chat (CS-only) [RC]
- test new asynchronous ECRS API (and resulting FSUI changes):
* make sure error handling & reporting are nice [RC]
-- make it easier to get your own identity (gnunet-peer-info? gnunet-setup?)
[RC]
- google-style search support:
* extended FSUI support (test event generation, support for probing
downloads)
* gnunet-gtk and gnunet-qt support (visualization, sorting, event handling)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6781 - in GNUnet: . doc/man src/server,
gnunet <=