diff options
Diffstat (limited to 'src/include/gnunet_hello_uri_lib.h')
-rw-r--r-- | src/include/gnunet_hello_uri_lib.h | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/src/include/gnunet_hello_uri_lib.h b/src/include/gnunet_hello_uri_lib.h index bba7078e6..aecda0885 100644 --- a/src/include/gnunet_hello_uri_lib.h +++ b/src/include/gnunet_hello_uri_lib.h | |||
@@ -70,6 +70,13 @@ GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity *pid); | |||
70 | 70 | ||
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Get the PeerIdentity for this builder. | ||
74 | */ | ||
75 | const struct GNUNET_PeerIdentity * | ||
76 | GNUNET_HELLO_builder_get_id (const struct GNUNET_HELLO_Builder *builder); | ||
77 | |||
78 | |||
79 | /** | ||
73 | * Release resources of a @a builder. | 80 | * Release resources of a @a builder. |
74 | * | 81 | * |
75 | * @param[in] builder to free | 82 | * @param[in] builder to free |
@@ -111,6 +118,17 @@ GNUNET_HELLO_builder_from_url (const char *url); | |||
111 | 118 | ||
112 | 119 | ||
113 | /** | 120 | /** |
121 | * Get the expiration time for this HELLO. | ||
122 | * | ||
123 | * @param msg The hello msg. | ||
124 | * @return The expiration time. | ||
125 | */ | ||
126 | struct GNUNET_TIME_Absolute | ||
127 | GNUNET_HELLO_builder_get_expiration_time (const struct | ||
128 | GNUNET_MessageHeader *msg); | ||
129 | |||
130 | |||
131 | /** | ||
114 | * Generate envelope with GNUnet HELLO message (including | 132 | * Generate envelope with GNUnet HELLO message (including |
115 | * peer ID) from a @a builder | 133 | * peer ID) from a @a builder |
116 | * | 134 | * |
@@ -120,7 +138,8 @@ GNUNET_HELLO_builder_from_url (const char *url); | |||
120 | */ | 138 | */ |
121 | struct GNUNET_MQ_Envelope * | 139 | struct GNUNET_MQ_Envelope * |
122 | GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, | 140 | GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, |
123 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); | 141 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
142 | struct GNUNET_TIME_Relative expiration_time); | ||
124 | 143 | ||
125 | 144 | ||
126 | /** | 145 | /** |
@@ -133,7 +152,8 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, | |||
133 | struct GNUNET_MessageHeader * | 152 | struct GNUNET_MessageHeader * |
134 | GNUNET_HELLO_builder_to_dht_hello_msg ( | 153 | GNUNET_HELLO_builder_to_dht_hello_msg ( |
135 | const struct GNUNET_HELLO_Builder *builder, | 154 | const struct GNUNET_HELLO_Builder *builder, |
136 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); | 155 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
156 | struct GNUNET_TIME_Relative expiration_time); | ||
137 | 157 | ||
138 | 158 | ||
139 | /** | 159 | /** |
@@ -162,7 +182,8 @@ enum GNUNET_GenericReturnValue | |||
162 | GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, | 182 | GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, |
163 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 183 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
164 | void *block, | 184 | void *block, |
165 | size_t *block_size); | 185 | size_t *block_size, |
186 | struct GNUNET_TIME_Relative expiration_time); | ||
166 | 187 | ||
167 | 188 | ||
168 | /** | 189 | /** |
@@ -199,6 +220,7 @@ GNUNET_HELLO_builder_del_address (struct GNUNET_HELLO_Builder *builder, | |||
199 | */ | 220 | */ |
200 | typedef void | 221 | typedef void |
201 | (*GNUNET_HELLO_UriCallback) (void *cls, | 222 | (*GNUNET_HELLO_UriCallback) (void *cls, |
223 | const struct GNUNET_PeerIdentity* pid, | ||
202 | const char *uri); | 224 | const char *uri); |
203 | 225 | ||
204 | 226 | ||
@@ -206,13 +228,12 @@ typedef void | |||
206 | * Iterate over URIs in a builder. | 228 | * Iterate over URIs in a builder. |
207 | * | 229 | * |
208 | * @param builder builder to iterate over | 230 | * @param builder builder to iterate over |
209 | * @param[out] pid set to the peer the @a builder is for | ||
210 | * @param uc callback invoked for each URI, can be NULL | 231 | * @param uc callback invoked for each URI, can be NULL |
211 | * @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 | ||
212 | */ | 234 | */ |
213 | void | 235 | const struct GNUNET_PeerIdentity * |
214 | GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, | 236 | GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, |
215 | struct GNUNET_PeerIdentity *pid, | ||
216 | GNUNET_HELLO_UriCallback uc, | 237 | GNUNET_HELLO_UriCallback uc, |
217 | void *uc_cls); | 238 | void *uc_cls); |
218 | 239 | ||
@@ -237,6 +258,35 @@ GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello, | |||
237 | struct GNUNET_TIME_Absolute *block_expiration); | 258 | struct GNUNET_TIME_Absolute *block_expiration); |
238 | 259 | ||
239 | 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 | */ | ||
268 | char * | ||
269 | GNUNET_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 | */ | ||
281 | void | ||
282 | GNUNET_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 | |||
240 | #if 0 /* keep Emacsens' auto-indent happy */ | 290 | #if 0 /* keep Emacsens' auto-indent happy */ |
241 | { | 291 | { |
242 | #endif | 292 | #endif |