aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_hello_uri_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_hello_uri_lib.h')
-rw-r--r--src/include/gnunet_hello_uri_lib.h68
1 files changed, 62 insertions, 6 deletions
diff --git a/src/include/gnunet_hello_uri_lib.h b/src/include/gnunet_hello_uri_lib.h
index c109a151a..aecda0885 100644
--- a/src/include/gnunet_hello_uri_lib.h
+++ b/src/include/gnunet_hello_uri_lib.h
@@ -19,6 +19,9 @@
19 */ 19 */
20 20
21/** 21/**
22 * @addtogroup Backbone
23 * @{
24 *
22 * @author Christian Grothoff 25 * @author Christian Grothoff
23 * @file 26 * @file
24 * Helper library for handling HELLO URIs 27 * Helper library for handling HELLO URIs
@@ -39,6 +42,7 @@ extern "C" {
39#endif 42#endif
40#endif 43#endif
41 44
45
42#include "gnunet_util_lib.h" 46#include "gnunet_util_lib.h"
43 47
44 48
@@ -66,6 +70,13 @@ GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity *pid);
66 70
67 71
68/** 72/**
73 * Get the PeerIdentity for this builder.
74 */
75const struct GNUNET_PeerIdentity *
76GNUNET_HELLO_builder_get_id (const struct GNUNET_HELLO_Builder *builder);
77
78
79/**
69 * Release resources of a @a builder. 80 * Release resources of a @a builder.
70 * 81 *
71 * @param[in] builder to free 82 * @param[in] builder to free
@@ -107,6 +118,17 @@ GNUNET_HELLO_builder_from_url (const char *url);
107 118
108 119
109/** 120/**
121 * Get the expiration time for this HELLO.
122 *
123 * @param msg The hello msg.
124 * @return The expiration time.
125 */
126struct GNUNET_TIME_Absolute
127GNUNET_HELLO_builder_get_expiration_time (const struct
128 GNUNET_MessageHeader *msg);
129
130
131/**
110 * Generate envelope with GNUnet HELLO message (including 132 * Generate envelope with GNUnet HELLO message (including
111 * peer ID) from a @a builder 133 * peer ID) from a @a builder
112 * 134 *
@@ -116,7 +138,8 @@ GNUNET_HELLO_builder_from_url (const char *url);
116 */ 138 */
117struct GNUNET_MQ_Envelope * 139struct GNUNET_MQ_Envelope *
118GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, 140GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
119 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); 141 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
142 struct GNUNET_TIME_Relative expiration_time);
120 143
121 144
122/** 145/**
@@ -129,7 +152,8 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
129struct GNUNET_MessageHeader * 152struct GNUNET_MessageHeader *
130GNUNET_HELLO_builder_to_dht_hello_msg ( 153GNUNET_HELLO_builder_to_dht_hello_msg (
131 const struct GNUNET_HELLO_Builder *builder, 154 const struct GNUNET_HELLO_Builder *builder,
132 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); 155 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
156 struct GNUNET_TIME_Relative expiration_time);
133 157
134 158
135/** 159/**
@@ -158,7 +182,8 @@ enum GNUNET_GenericReturnValue
158GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, 182GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
159 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 183 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
160 void *block, 184 void *block,
161 size_t *block_size); 185 size_t *block_size,
186 struct GNUNET_TIME_Relative expiration_time);
162 187
163 188
164/** 189/**
@@ -195,6 +220,7 @@ GNUNET_HELLO_builder_del_address (struct GNUNET_HELLO_Builder *builder,
195 */ 220 */
196typedef void 221typedef void
197(*GNUNET_HELLO_UriCallback) (void *cls, 222(*GNUNET_HELLO_UriCallback) (void *cls,
223 const struct GNUNET_PeerIdentity* pid,
198 const char *uri); 224 const char *uri);
199 225
200 226
@@ -202,13 +228,12 @@ typedef void
202 * Iterate over URIs in a builder. 228 * Iterate over URIs in a builder.
203 * 229 *
204 * @param builder builder to iterate over 230 * @param builder builder to iterate over
205 * @param[out] pid set to the peer the @a builder is for
206 * @param uc callback invoked for each URI, can be NULL 231 * @param uc callback invoked for each URI, can be NULL
207 * @param uc_cls closure for @a addrgen 232 * @param uc_cls closure for @a addrgen
233 * @return pid of the peer the @a builder is for, can be NULL
208 */ 234 */
209void 235const struct GNUNET_PeerIdentity *
210GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, 236GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder,
211 struct GNUNET_PeerIdentity *pid,
212 GNUNET_HELLO_UriCallback uc, 237 GNUNET_HELLO_UriCallback uc,
213 void *uc_cls); 238 void *uc_cls);
214 239
@@ -233,6 +258,35 @@ GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello,
233 struct GNUNET_TIME_Absolute *block_expiration); 258 struct GNUNET_TIME_Absolute *block_expiration);
234 259
235 260
261/**
262 * Given an address as a string, extract the prefix that identifies
263 * the communicator offering transmissions to that address.
264 *
265 * @param address a peer's address
266 * @return NULL if the address is mal-formed, otherwise the prefix
267 */
268char *
269GNUNET_HELLO_address_to_prefix (const char *address);
270
271/**
272 * Build address record by signing raw information with private key.
273 *
274 * @param address text address to sign
275 * @param nt network type of @a address
276 * @param mono_time when was @a address valid
277 * @param private_key signing key to use
278 * @param[out] result where to write address record (allocated)
279 * @param[out] result_size set to size of @a result
280 */
281void
282GNUNET_HELLO_sign_address (
283 const char *address,
284 enum GNUNET_NetworkType nt,
285 struct GNUNET_TIME_Absolute mono_time,
286 const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key,
287 void **result,
288 size_t *result_size);
289
236#if 0 /* keep Emacsens' auto-indent happy */ 290#if 0 /* keep Emacsens' auto-indent happy */
237{ 291{
238#endif 292#endif
@@ -245,4 +299,6 @@ GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello,
245 299
246/** @} */ /* end of group */ 300/** @} */ /* end of group */
247 301
302/** @} */ /* end of group addition */
303
248/* end of gnunet_hello_uri_lib.h */ 304/* end of gnunet_hello_uri_lib.h */