diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-22 14:05:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-22 14:05:29 +0000 |
commit | 323b7225e6173544de255541087df8bd22ad1644 (patch) | |
tree | 0ec1dcf83dc3867487c61efe7eea8cae0aa89ff3 /src | |
parent | 68af1b34807c447d4e01d947ae103d54246244fc (diff) | |
download | gnunet-323b7225e6173544de255541087df8bd22ad1644.tar.gz gnunet-323b7225e6173544de255541087df8bd22ad1644.zip |
output public key of peer
Diffstat (limited to 'src')
-rw-r--r-- | src/hello/gnunet-hello.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c index 93eaeef2b..d18ae6a4e 100644 --- a/src/hello/gnunet-hello.c +++ b/src/hello/gnunet-hello.c | |||
@@ -56,10 +56,11 @@ static int address_count; | |||
56 | * @param cls closure | 56 | * @param cls closure |
57 | * @param address address to add | 57 | * @param address address to add |
58 | * @param expiration old expiration | 58 | * @param expiration old expiration |
59 | * @return GNUNET_OK keep iterating | 59 | * @return #GNUNET_OK keep iterating |
60 | */ | 60 | */ |
61 | static int | 61 | static int |
62 | add_to_buf (void *cls, const struct GNUNET_HELLO_Address *address, | 62 | add_to_buf (void *cls, |
63 | const struct GNUNET_HELLO_Address *address, | ||
63 | struct GNUNET_TIME_Absolute expiration) | 64 | struct GNUNET_TIME_Absolute expiration) |
64 | { | 65 | { |
65 | struct AddContext *ac = cls; | 66 | struct AddContext *ac = cls; |
@@ -86,7 +87,9 @@ add_to_buf (void *cls, const struct GNUNET_HELLO_Address *address, | |||
86 | * @return number of bytes added, 0 to terminate | 87 | * @return number of bytes added, 0 to terminate |
87 | */ | 88 | */ |
88 | static ssize_t | 89 | static ssize_t |
89 | add_from_hello (void *cls, size_t max, void *buf) | 90 | add_from_hello (void *cls, |
91 | size_t max, | ||
92 | void *buf) | ||
90 | { | 93 | { |
91 | struct GNUNET_HELLO_Message **orig = cls; | 94 | struct GNUNET_HELLO_Message **orig = cls; |
92 | struct AddContext ac; | 95 | struct AddContext ac; |
@@ -171,8 +174,18 @@ main (int argc, char *argv[]) | |||
171 | argv[1]); | 174 | argv[1]); |
172 | return 1; | 175 | return 1; |
173 | } | 176 | } |
174 | result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig, | 177 | { |
175 | GNUNET_HELLO_is_friend_only (orig)); | 178 | char *pid; |
179 | |||
180 | pid = GNUNET_CRYPTO_eddsa_public_key_to_string (&pk); | ||
181 | fprintf (stdout, | ||
182 | "Processing HELLO for peer `%s'\n", | ||
183 | pid); | ||
184 | GNUNET_free (pid); | ||
185 | } | ||
186 | result = GNUNET_HELLO_create (&pk, &add_from_hello, | ||
187 | &orig, | ||
188 | GNUNET_HELLO_is_friend_only (orig)); | ||
176 | GNUNET_assert (NULL != result); | 189 | GNUNET_assert (NULL != result); |
177 | fh = GNUNET_DISK_file_open (argv[1], | 190 | fh = GNUNET_DISK_file_open (argv[1], |
178 | GNUNET_DISK_OPEN_WRITE, | 191 | GNUNET_DISK_OPEN_WRITE, |