aboutsummaryrefslogtreecommitdiff
path: root/src/hello
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-27 14:20:12 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-27 14:20:12 +0000
commitfb6d4c04a9db33e63a2ce238732c7cfc6df4c798 (patch)
tree676495f2c2e1005518b941a467005bcb49ba73cb /src/hello
parent363ce5239bd63abd18643b1a7b4b0523683d36e7 (diff)
downloadgnunet-fb6d4c04a9db33e63a2ce238732c7cfc6df4c798.tar.gz
gnunet-fb6d4c04a9db33e63a2ce238732c7cfc6df4c798.zip
helper
Diffstat (limited to 'src/hello')
-rw-r--r--src/hello/hello.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 501f057c8..b53bf62bc 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -590,6 +590,7 @@ find_matching (void *cls, const char *tname,
590 return GNUNET_OK; 590 return GNUNET_OK;
591} 591}
592 592
593
593/** 594/**
594 * Test if two HELLO messages contain the same addresses. 595 * Test if two HELLO messages contain the same addresses.
595 * If they only differ in expiration time, the lowest 596 * If they only differ in expiration time, the lowest
@@ -629,4 +630,33 @@ GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1,
629} 630}
630 631
631 632
633static int
634find_min_expire (void *cls, const char *tname,
635 struct GNUNET_TIME_Absolute expiration, const void *addr,
636 uint16_t addrlen)
637{
638 struct GNUNET_TIME_Absolute *min = cls;
639
640 *min = GNUNET_TIME_absolute_min (*min, expiration);
641 return GNUNET_OK;
642}
643
644
645/**
646 * When does the last address in the given HELLO expire?
647 *
648 * @param msg HELLO to inspect
649 * @return time the last address expires, 0 if there are no addresses in the HELLO
650 */
651struct GNUNET_TIME_Absolute
652GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg)
653{
654 struct GNUNET_TIME_Absolute ret;
655
656 ret.abs_value = 0;
657 GNUNET_HELLO_iterate_addresses (msg, GNUNET_NO, &find_min_expire, &ret);
658 return ret;
659}
660
661
632/* end of hello.c */ 662/* end of hello.c */