diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-04-02 15:16:18 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-04-02 15:16:18 +0000 |
commit | d9dda7eda6b55b311982d99885aafd82448a057e (patch) | |
tree | f6b5d65310c729d3f8d88e86af27d4b811f82795 /src/hello | |
parent | 76d642d75443241b4457e4f0f8e46abf83749872 (diff) | |
download | gnunet-d9dda7eda6b55b311982d99885aafd82448a057e.tar.gz gnunet-d9dda7eda6b55b311982d99885aafd82448a057e.zip |
hello api call, may be unnecessary
Diffstat (limited to 'src/hello')
-rw-r--r-- | src/hello/hello.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/hello/hello.c b/src/hello/hello.c index dfcc31dc2..4ddeebd03 100644 --- a/src/hello/hello.c +++ b/src/hello/hello.c | |||
@@ -510,4 +510,23 @@ GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, | |||
510 | return GNUNET_OK; | 510 | return GNUNET_OK; |
511 | } | 511 | } |
512 | 512 | ||
513 | /** | ||
514 | * Get the header from a HELLO message, used so other code | ||
515 | * can correctly send HELLO messages. | ||
516 | * | ||
517 | * @param hello the hello message | ||
518 | * | ||
519 | * @return header or NULL if the HELLO was malformed | ||
520 | */ | ||
521 | struct GNUNET_MessageHeader * | ||
522 | GNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello) | ||
523 | { | ||
524 | uint16_t ret = ntohs (hello->header.size); | ||
525 | if ((ret < sizeof (struct GNUNET_HELLO_Message)) || | ||
526 | (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO)) | ||
527 | return NULL; | ||
528 | |||
529 | return &hello->header; | ||
530 | } | ||
531 | |||
513 | /* end of hello.c */ | 532 | /* end of hello.c */ |