[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 13/40: NEWS: Changed new hello uri api to allow to change the e
From: |
gnunet |
Subject: |
[gnunet] 13/40: NEWS: Changed new hello uri api to allow to change the expiration time |
Date: |
Thu, 05 Oct 2023 08:57:16 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 39bcd0fd01fc552af43b7bd945ddba510172ad36
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Thu Aug 3 10:31:46 2023 +0200
NEWS: Changed new hello uri api to allow to change the expiration time
---
src/dht/gnunet-service-dht.c | 3 ++-
src/dht/gnunet-service-dht_neighbours.c | 6 ++++--
src/hello/hello-uri.c | 26 ++++++++++++++++++--------
src/hello/test_hello-uri.c | 12 ++++++++----
src/include/gnunet_hello_uri_lib.h | 9 ++++++---
5 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 39433791d..0766bea62 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -236,7 +236,8 @@ broadcast_hello (void *cls)
&broadcast_hello,
NULL);
hello = GNUNET_HELLO_builder_to_dht_hello_msg (GDS_my_hello,
- &GDS_my_private_key);
+ &GDS_my_private_key,
+ GNUNET_TIME_UNIT_ZERO);
if (NULL == hello)
{
GNUNET_break (0);
diff --git a/src/dht/gnunet-service-dht_neighbours.c
b/src/dht/gnunet-service-dht_neighbours.c
index 010a7dd62..b0a71de95 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -2183,7 +2183,8 @@ handle_find_my_hello (struct PeerInfo *pi,
GNUNET_HELLO_builder_to_block (GDS_my_hello,
&GDS_my_private_key,
NULL,
- &block_size));
+ &block_size,
+ GNUNET_TIME_UNIT_ZERO));
{
char block[block_size];
@@ -2191,7 +2192,8 @@ handle_find_my_hello (struct PeerInfo *pi,
GNUNET_HELLO_builder_to_block (GDS_my_hello,
&GDS_my_private_key,
block,
- &block_size))
+ &block_size,
+ GNUNET_TIME_UNIT_ZERO))
{
GNUNET_STATISTICS_update (GDS_stats,
"# FIND PEER requests ignored due to lack of
HELLO",
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)
struct GNUNET_MQ_Envelope *
GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+ struct GNUNET_TIME_Relative expiration_time)
{
struct GNUNET_MQ_Envelope *env;
struct HelloUriMessage *msg;
@@ -568,7 +569,8 @@ GNUNET_HELLO_builder_to_env (const struct
GNUNET_HELLO_Builder *builder,
GNUNET_HELLO_builder_to_block (builder,
priv,
NULL,
- &blen));
+ &blen,
+ expiration_time));
env = GNUNET_MQ_msg_extra (msg,
blen,
GNUNET_MESSAGE_TYPE_HELLO_URI);
@@ -577,7 +579,8 @@ GNUNET_HELLO_builder_to_env (const struct
GNUNET_HELLO_Builder *builder,
GNUNET_HELLO_builder_to_block (builder,
priv,
&msg[1],
- &blen));
+ &blen,
+ expiration_time));
return env;
}
@@ -585,7 +588,8 @@ GNUNET_HELLO_builder_to_env (const struct
GNUNET_HELLO_Builder *builder,
struct GNUNET_MessageHeader *
GNUNET_HELLO_builder_to_dht_hello_msg (
const struct GNUNET_HELLO_Builder *builder,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+ struct GNUNET_TIME_Relative expiration_time)
{
struct DhtHelloMessage *msg;
size_t blen;
@@ -600,7 +604,8 @@ GNUNET_HELLO_builder_to_dht_hello_msg (
GNUNET_HELLO_builder_to_block (builder,
priv,
NULL,
- &blen));
+ &blen,
+ expiration_time));
GNUNET_assert (blen < UINT16_MAX);
GNUNET_assert (blen >= sizeof (struct BlockHeader));
{
@@ -611,7 +616,8 @@ GNUNET_HELLO_builder_to_dht_hello_msg (
GNUNET_HELLO_builder_to_block (builder,
priv,
buf,
- &blen));
+ &blen,
+ expiration_time));
msg = GNUNET_malloc (sizeof (*msg)
+ blen
- sizeof (*block));
@@ -699,7 +705,8 @@ enum GNUNET_GenericReturnValue
GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
const struct GNUNET_CRYPTO_EddsaPrivateKey
*priv,
void *block,
- size_t *block_size)
+ size_t *block_size,
+ struct GNUNET_TIME_Relative expiration_time)
{
struct BlockHeader bh;
size_t needed = sizeof (bh);
@@ -720,7 +727,10 @@ GNUNET_HELLO_builder_to_block (const struct
GNUNET_HELLO_Builder *builder,
return GNUNET_NO;
}
bh.pid = builder->pid;
- et = GNUNET_TIME_relative_to_timestamp (GNUNET_HELLO_ADDRESS_EXPIRATION);
+ if (GNUNET_TIME_UNIT_ZERO.rel_value_us == expiration_time.rel_value_us)
+ et = GNUNET_TIME_relative_to_timestamp (GNUNET_HELLO_ADDRESS_EXPIRATION);
+ else
+ et = GNUNET_TIME_relative_to_timestamp (expiration_time);
bh.expiration_time = GNUNET_TIME_absolute_hton (et.abs_time);
sign_hello (builder,
et,
diff --git a/src/hello/test_hello-uri.c b/src/hello/test_hello-uri.c
index 01b6f2d8e..1062f446b 100644
--- a/src/hello/test_hello-uri.c
+++ b/src/hello/test_hello-uri.c
@@ -95,19 +95,22 @@ main (int argc,
GNUNET_HELLO_builder_to_block (b,
&priv,
NULL,
- &block_size));
+ &block_size,
+ NULL));
GNUNET_assert (GNUNET_NO ==
GNUNET_HELLO_builder_to_block (b,
&priv,
NULL,
- &block_size));
+ &block_size,
+ NULL));
GNUNET_assert (0 != block_size);
block = GNUNET_malloc (block_size);
GNUNET_assert (GNUNET_OK ==
GNUNET_HELLO_builder_to_block (b,
&priv,
block,
- &block_size));
+ &block_size,
+ NULL));
b2 = GNUNET_HELLO_builder_from_block (block,
block_size);
GNUNET_free (block);
@@ -154,7 +157,8 @@ main (int argc,
unsigned int found;
env = GNUNET_HELLO_builder_to_env (b,
- &priv);
+ &priv,
+ NULL);
b2 = GNUNET_HELLO_builder_from_msg (GNUNET_MQ_env_get_msg (env));
GNUNET_free (env);
GNUNET_assert (NULL != b2);
diff --git a/src/include/gnunet_hello_uri_lib.h
b/src/include/gnunet_hello_uri_lib.h
index bba7078e6..4e48bc1a0 100644
--- a/src/include/gnunet_hello_uri_lib.h
+++ b/src/include/gnunet_hello_uri_lib.h
@@ -120,7 +120,8 @@ GNUNET_HELLO_builder_from_url (const char *url);
*/
struct GNUNET_MQ_Envelope *
GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+ struct GNUNET_TIME_Relative expiration_time);
/**
@@ -133,7 +134,8 @@ GNUNET_HELLO_builder_to_env (const struct
GNUNET_HELLO_Builder *builder,
struct GNUNET_MessageHeader *
GNUNET_HELLO_builder_to_dht_hello_msg (
const struct GNUNET_HELLO_Builder *builder,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+ struct GNUNET_TIME_Relative expiration_time);
/**
@@ -162,7 +164,8 @@ enum GNUNET_GenericReturnValue
GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
const struct GNUNET_CRYPTO_EddsaPrivateKey
*priv,
void *block,
- size_t *block_size);
+ size_t *block_size,
+ struct GNUNET_TIME_Relative expiration_time);
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (92c6b1ae0 -> 898b9a01a), gnunet, 2023/10/05
- [gnunet] 01/40: NEWS: Added __attribute__((deprecated)) to the old transport API, gnunet, 2023/10/05
- [gnunet] 06/40: TNG: Accidentally removed code., gnunet, 2023/10/05
- [gnunet] 02/40: NEWS: Added __attribute__((deprecated)) to the old transport API, gnunet, 2023/10/05
- [gnunet] 09/40: NEWS: Moved start peer command to testing subsystem., gnunet, 2023/10/05
- [gnunet] 05/40: TNG: Deactivated all tests which rely on the old transport api., gnunet, 2023/10/05
- [gnunet] 12/40: TNG: Fixed bug that QueueEntry of another queue still holds reference to PendingMessage., gnunet, 2023/10/05
- [gnunet] 13/40: NEWS: Changed new hello uri api to allow to change the expiration time,
gnunet <=
- [gnunet] 22/40: NEWS: Code moved to the core package to get rid of circular dependencies., gnunet, 2023/10/05
- [gnunet] 16/40: TOPOLOGY: Exchanged peerinfo api to store hellos with new peerstore api., gnunet, 2023/10/05
- [gnunet] 19/40: HELLO: Cli tool for changing hello files in contrib can change file from old to new hello design., gnunet, 2023/10/05
- [gnunet] 07/40: NEWS: Added command to execute a script., gnunet, 2023/10/05
- [gnunet] 17/40: PEERSTORE: change watch to return actual values, before watching., gnunet, 2023/10/05
- [gnunet] 32/40: Merge branch 'master' into l20integration, gnunet, 2023/10/05
- [gnunet] 29/40: TNG: Fixed syntax., gnunet, 2023/10/05
- [gnunet] 03/40: News: Merge branch 'l20integration' of ssh://git.gnunet.org/gnunet into l20integration, gnunet, 2023/10/05
- [gnunet] 36/40: Fix warnings; CADET not FTBFS because old hello removed, gnunet, 2023/10/05
- [gnunet] 33/40: Merge branch 'master' into l20integration, gnunet, 2023/10/05