aboutsummaryrefslogtreecommitdiff
path: root/src/hello/hello-uri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hello/hello-uri.c')
-rw-r--r--src/hello/hello-uri.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/hello/hello-uri.c b/src/hello/hello-uri.c
index dd191738f..8f8f699e9 100644
--- a/src/hello/hello-uri.c
+++ b/src/hello/hello-uri.c
@@ -552,7 +552,8 @@ GNUNET_HELLO_builder_from_url (const char *url)
552 552
553struct GNUNET_MQ_Envelope * 553struct GNUNET_MQ_Envelope *
554GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, 554GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
555 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) 555 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
556 struct GNUNET_TIME_Relative expiration_time)
556{ 557{
557 struct GNUNET_MQ_Envelope *env; 558 struct GNUNET_MQ_Envelope *env;
558 struct HelloUriMessage *msg; 559 struct HelloUriMessage *msg;
@@ -568,7 +569,8 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
568 GNUNET_HELLO_builder_to_block (builder, 569 GNUNET_HELLO_builder_to_block (builder,
569 priv, 570 priv,
570 NULL, 571 NULL,
571 &blen)); 572 &blen,
573 expiration_time));
572 env = GNUNET_MQ_msg_extra (msg, 574 env = GNUNET_MQ_msg_extra (msg,
573 blen, 575 blen,
574 GNUNET_MESSAGE_TYPE_HELLO_URI); 576 GNUNET_MESSAGE_TYPE_HELLO_URI);
@@ -577,7 +579,8 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
577 GNUNET_HELLO_builder_to_block (builder, 579 GNUNET_HELLO_builder_to_block (builder,
578 priv, 580 priv,
579 &msg[1], 581 &msg[1],
580 &blen)); 582 &blen,
583 expiration_time));
581 return env; 584 return env;
582} 585}
583 586
@@ -585,7 +588,8 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
585struct GNUNET_MessageHeader * 588struct GNUNET_MessageHeader *
586GNUNET_HELLO_builder_to_dht_hello_msg ( 589GNUNET_HELLO_builder_to_dht_hello_msg (
587 const struct GNUNET_HELLO_Builder *builder, 590 const struct GNUNET_HELLO_Builder *builder,
588 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) 591 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
592 struct GNUNET_TIME_Relative expiration_time)
589{ 593{
590 struct DhtHelloMessage *msg; 594 struct DhtHelloMessage *msg;
591 size_t blen; 595 size_t blen;
@@ -600,7 +604,8 @@ GNUNET_HELLO_builder_to_dht_hello_msg (
600 GNUNET_HELLO_builder_to_block (builder, 604 GNUNET_HELLO_builder_to_block (builder,
601 priv, 605 priv,
602 NULL, 606 NULL,
603 &blen)); 607 &blen,
608 expiration_time));
604 GNUNET_assert (blen < UINT16_MAX); 609 GNUNET_assert (blen < UINT16_MAX);
605 GNUNET_assert (blen >= sizeof (struct BlockHeader)); 610 GNUNET_assert (blen >= sizeof (struct BlockHeader));
606 { 611 {
@@ -611,7 +616,8 @@ GNUNET_HELLO_builder_to_dht_hello_msg (
611 GNUNET_HELLO_builder_to_block (builder, 616 GNUNET_HELLO_builder_to_block (builder,
612 priv, 617 priv,
613 buf, 618 buf,
614 &blen)); 619 &blen,
620 expiration_time));
615 msg = GNUNET_malloc (sizeof (*msg) 621 msg = GNUNET_malloc (sizeof (*msg)
616 + blen 622 + blen
617 - sizeof (*block)); 623 - sizeof (*block));
@@ -699,7 +705,8 @@ enum GNUNET_GenericReturnValue
699GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, 705GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
700 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 706 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
701 void *block, 707 void *block,
702 size_t *block_size) 708 size_t *block_size,
709 struct GNUNET_TIME_Relative expiration_time)
703{ 710{
704 struct BlockHeader bh; 711 struct BlockHeader bh;
705 size_t needed = sizeof (bh); 712 size_t needed = sizeof (bh);
@@ -720,7 +727,10 @@ GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
720 return GNUNET_NO; 727 return GNUNET_NO;
721 } 728 }
722 bh.pid = builder->pid; 729 bh.pid = builder->pid;
723 et = GNUNET_TIME_relative_to_timestamp (GNUNET_HELLO_ADDRESS_EXPIRATION); 730 if (GNUNET_TIME_UNIT_ZERO.rel_value_us == expiration_time.rel_value_us)
731 et = GNUNET_TIME_relative_to_timestamp (GNUNET_HELLO_ADDRESS_EXPIRATION);
732 else
733 et = GNUNET_TIME_relative_to_timestamp (expiration_time);
724 bh.expiration_time = GNUNET_TIME_absolute_hton (et.abs_time); 734 bh.expiration_time = GNUNET_TIME_absolute_hton (et.abs_time);
725 sign_hello (builder, 735 sign_hello (builder,
726 et, 736 et,