aboutsummaryrefslogtreecommitdiff
path: root/src/hello
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-07-12 22:11:16 +0000
committerChristian Grothoff <christian@grothoff.org>2009-07-12 22:11:16 +0000
commit434bd08c383c1128e4c95d84d8e546ced6dfb629 (patch)
treec07689baaa32aa123e3bcc5939c74bde1f2a9b06 /src/hello
parent0764da28f2a3003c208703245b2247432855fc90 (diff)
downloadgnunet-434bd08c383c1128e4c95d84d8e546ced6dfb629.tar.gz
gnunet-434bd08c383c1128e4c95d84d8e546ced6dfb629.zip
transport fixes, hello API extension
Diffstat (limited to 'src/hello')
-rw-r--r--src/hello/hello.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 79d0edf8d..a7aaf7d54 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -479,5 +479,27 @@ GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello,
479} 479}
480 480
481 481
482/**
483 * Get the peer identity from a HELLO message.
484 *
485 * @param hello the hello message
486 * @param peer where to store the peer's identity
487 * @return GNUNET_SYSERR if the HELLO was malformed
488 */
489int
490GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello,
491 struct GNUNET_PeerIdentity *peer)
492{
493 uint16_t ret = ntohs (hello->header.size);
494 if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
495 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
496 return GNUNET_SYSERR;
497 GNUNET_CRYPTO_hash (&hello->publicKey,
498 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
499 &peer->hashPubKey);
500 return GNUNET_OK;
501}
502
503
482 504
483/* end of hello.c */ 505/* end of hello.c */