aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo-tool/gnunet-peerinfo.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-30 21:03:31 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-30 21:03:31 +0000
commit6d5b099541c60303b664547f18f4aaa864e33d68 (patch)
tree3169f571d3f66ec23ab540d17c012f00103688f2 /src/peerinfo-tool/gnunet-peerinfo.c
parenta0ba5b741b56036bd35bd9ba88164324b2ff7ada (diff)
downloadgnunet-6d5b099541c60303b664547f18f4aaa864e33d68.tar.gz
gnunet-6d5b099541c60303b664547f18f4aaa864e33d68.zip
-getting core, nse, testbed, ats-tool and peerinfo-tool to compile again (part of #3047)
Diffstat (limited to 'src/peerinfo-tool/gnunet-peerinfo.c')
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 8963637c9..af7a8f757 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -190,11 +190,6 @@ static struct GNUNET_PEERINFO_IteratorContext *pic;
190static struct GNUNET_PeerIdentity my_peer_identity; 190static struct GNUNET_PeerIdentity my_peer_identity;
191 191
192/** 192/**
193 * My public key.
194 */
195static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
196
197/**
198 * Head of list of print contexts. 193 * Head of list of print contexts.
199 */ 194 */
200static struct PrintContext *pc_head; 195static struct PrintContext *pc_head;
@@ -232,13 +227,11 @@ state_machine (void *cls,
232static void 227static void
233dump_pc (struct PrintContext *pc) 228dump_pc (struct PrintContext *pc)
234{ 229{
235 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
236 unsigned int i; 230 unsigned int i;
237 231
238 GNUNET_CRYPTO_hash_to_enc (&pc->peer.hashPubKey, &enc);
239 printf (_("%sPeer `%s'\n"), 232 printf (_("%sPeer `%s'\n"),
240 (GNUNET_YES == pc->friend_only) ? "F2F: " : "", 233 (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
241 (const char *) &enc); 234 GNUNET_i2s_full (&pc->peer));
242 for (i = 0; i < pc->num_addresses; i++) 235 for (i = 0; i < pc->num_addresses; i++)
243 { 236 {
244 if (NULL != pc->address_list[i].result) 237 if (NULL != pc->address_list[i].result)
@@ -345,7 +338,6 @@ static void
345print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, 338print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
346 const struct GNUNET_HELLO_Message *hello, const char *err_msg) 339 const struct GNUNET_HELLO_Message *hello, const char *err_msg)
347{ 340{
348 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
349 struct PrintContext *pc; 341 struct PrintContext *pc;
350 int friend_only; 342 int friend_only;
351 343
@@ -367,10 +359,9 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
367 friend_only = GNUNET_HELLO_is_friend_only (hello); 359 friend_only = GNUNET_HELLO_is_friend_only (hello);
368 if ((GNUNET_YES == be_quiet) || (NULL == hello)) 360 if ((GNUNET_YES == be_quiet) || (NULL == hello))
369 { 361 {
370 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
371 printf ("%s%s\n", 362 printf ("%s%s\n",
372 (GNUNET_YES == friend_only) ? "F2F: " : "", 363 (GNUNET_YES == friend_only) ? "F2F: " : "",
373 (const char *) &enc); 364 GNUNET_i2s_full (peer));
374 return; 365 return;
375 } 366 }
376 pc = GNUNET_malloc (sizeof (struct PrintContext)); 367 pc = GNUNET_malloc (sizeof (struct PrintContext));
@@ -546,7 +537,8 @@ parse_hello_uri (const char *put_uri)
546{ 537{
547 struct GNUNET_HELLO_Message *hello = NULL; 538 struct GNUNET_HELLO_Message *hello = NULL;
548 539
549 int ret = GNUNET_HELLO_parse_uri(put_uri, &my_public_key, &hello, &GPI_plugins_find); 540 int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key,
541 &hello, &GPI_plugins_find);
550 542
551 if (NULL != hello) { 543 if (NULL != hello) {
552 /* WARNING: this adds the address from URI WITHOUT verification! */ 544 /* WARNING: this adds the address from URI WITHOUT verification! */
@@ -677,9 +669,9 @@ run (void *cls, char *const *args, const char *cfgfile,
677 return; 669 return;
678 } 670 }
679 GNUNET_free (fn); 671 GNUNET_free (fn);
680 GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &my_public_key); 672 GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv,
673 &my_peer_identity.public_key);
681 GNUNET_free (priv); 674 GNUNET_free (priv);
682 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), &my_peer_identity.hashPubKey);
683 } 675 }
684 676
685 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 677 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
@@ -725,14 +717,14 @@ state_machine (void *cls,
725 } 717 }
726 else if (GNUNET_YES == get_self) 718 else if (GNUNET_YES == get_self)
727 { 719 {
728 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
729 get_self = GNUNET_NO; 720 get_self = GNUNET_NO;
730 GNUNET_CRYPTO_hash_to_enc (&my_peer_identity.hashPubKey, &enc);
731 if (be_quiet) 721 if (be_quiet)
732 printf ("%s\n", (char *) &enc); 722 printf ("%s\n",
723 GNUNET_i2s_full (&my_peer_identity));
733 else 724 else
734 printf (_("I am peer `%s'.\n"), (const char *) &enc); 725 printf (_("I am peer `%s'.\n"),
735 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 726 GNUNET_i2s_full (&my_peer_identity));
727 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
736 } 728 }
737 else if (GNUNET_YES == get_uri) 729 else if (GNUNET_YES == get_uri)
738 { 730 {