diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-12 12:57:13 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-19 12:39:55 +0100 |
commit | cd84bf32e23b4396583a8fa1bfe4a00c1fba3715 (patch) | |
tree | d97d18e1e8604f1f0f48925a7677ba01f6c3c412 /src/include | |
parent | ba9296269617c157baffb59a6240c87ae5935e95 (diff) | |
download | gnunet-cd84bf32e23b4396583a8fa1bfe4a00c1fba3715.tar.gz gnunet-cd84bf32e23b4396583a8fa1bfe4a00c1fba3715.zip |
-also add serialization from/to block
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_hello_uri_lib.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/include/gnunet_hello_uri_lib.h b/src/include/gnunet_hello_uri_lib.h index 0f61384d1..00b84e0e4 100644 --- a/src/include/gnunet_hello_uri_lib.h +++ b/src/include/gnunet_hello_uri_lib.h | |||
@@ -78,6 +78,18 @@ GNUNET_HELLO_builder_from_msg (const struct GNUNET_MessageHeader *msg); | |||
78 | 78 | ||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Parse @a block into builder. | ||
82 | * | ||
83 | * @param block DHT block to parse | ||
84 | * @param block_size number of bytes in @a block | ||
85 | * @return builder, NULL on failure | ||
86 | */ | ||
87 | struct GNUNET_HELLO_Builder * | ||
88 | GNUNET_HELLO_builder_from_block (const void *block, | ||
89 | size_t block_size); | ||
90 | |||
91 | |||
92 | /** | ||
81 | * Parse GNUnet HELLO @a url into builder. | 93 | * Parse GNUnet HELLO @a url into builder. |
82 | * | 94 | * |
83 | * @param url URL to parse | 95 | * @param url URL to parse |
@@ -108,6 +120,21 @@ GNUNET_HELLO_builder_to_url (struct GNUNET_HELLO_Builder *builder); | |||
108 | 120 | ||
109 | 121 | ||
110 | /** | 122 | /** |
123 | * Generate DHT block from a @a builder | ||
124 | * | ||
125 | * @param builder the builder to serialize | ||
126 | * @param[out] block where to write the block, NULL to only calculate @a block_size | ||
127 | * @param[in,out] block_size input is number of bytes available in @a block, | ||
128 | * output is number of bytes needed in @a block | ||
129 | * @return #GNUNET_OK on success, #GNUNET_NO if @a block_size was too small | ||
130 | */ | ||
131 | enum GNUNET_GenericReturnValue | ||
132 | GNUNET_HELLO_builder_to_block (struct GNUNET_HELLO_Builder *builder, | ||
133 | void *block, | ||
134 | size_t *block_size); | ||
135 | |||
136 | |||
137 | /** | ||
111 | * Add individual @a address to the @a builder | 138 | * Add individual @a address to the @a builder |
112 | * | 139 | * |
113 | * @param[in,out] builder to update | 140 | * @param[in,out] builder to update |