diff options
Diffstat (limited to 'src/include/gnunet_hello_lib.h')
-rw-r--r-- | src/include/gnunet_hello_lib.h | 107 |
1 files changed, 55 insertions, 52 deletions
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index 9fe158852..fff0045aa 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h | |||
@@ -65,7 +65,8 @@ extern "C" { | |||
65 | * These information are only valid for the local peer and are not serialized | 65 | * These information are only valid for the local peer and are not serialized |
66 | * when a #GNUNET_HELLO_Message is created | 66 | * when a #GNUNET_HELLO_Message is created |
67 | */ | 67 | */ |
68 | enum GNUNET_HELLO_AddressInfo { | 68 | enum GNUNET_HELLO_AddressInfo |
69 | { | ||
69 | /** | 70 | /** |
70 | * No additional information | 71 | * No additional information |
71 | */ | 72 | */ |
@@ -85,7 +86,8 @@ enum GNUNET_HELLO_AddressInfo { | |||
85 | * separated. This is NOT the format that would be used | 86 | * separated. This is NOT the format that would be used |
86 | * on the wire. | 87 | * on the wire. |
87 | */ | 88 | */ |
88 | struct GNUNET_HELLO_Address { | 89 | struct GNUNET_HELLO_Address |
90 | { | ||
89 | /** | 91 | /** |
90 | * For which peer is this an address? | 92 | * For which peer is this an address? |
91 | */ | 93 | */ |
@@ -132,11 +134,11 @@ struct GNUNET_HELLO_Address { | |||
132 | * @return the address struct | 134 | * @return the address struct |
133 | */ | 135 | */ |
134 | struct GNUNET_HELLO_Address * | 136 | struct GNUNET_HELLO_Address * |
135 | GNUNET_HELLO_address_allocate(const struct GNUNET_PeerIdentity *peer, | 137 | GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer, |
136 | const char *transport_name, | 138 | const char *transport_name, |
137 | const void *address, | 139 | const void *address, |
138 | size_t address_length, | 140 | size_t address_length, |
139 | enum GNUNET_HELLO_AddressInfo local_info); | 141 | enum GNUNET_HELLO_AddressInfo local_info); |
140 | 142 | ||
141 | 143 | ||
142 | /** | 144 | /** |
@@ -146,7 +148,7 @@ GNUNET_HELLO_address_allocate(const struct GNUNET_PeerIdentity *peer, | |||
146 | * @return a copy of the address struct | 148 | * @return a copy of the address struct |
147 | */ | 149 | */ |
148 | struct GNUNET_HELLO_Address * | 150 | struct GNUNET_HELLO_Address * |
149 | GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address); | 151 | GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address); |
150 | 152 | ||
151 | 153 | ||
152 | /** | 154 | /** |
@@ -158,8 +160,8 @@ GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address); | |||
158 | * @return 0 if the addresses are equal, -1 if @a a1< @a a2, 1 if @a a1> @a a2. | 160 | * @return 0 if the addresses are equal, -1 if @a a1< @a a2, 1 if @a a1> @a a2. |
159 | */ | 161 | */ |
160 | int | 162 | int |
161 | GNUNET_HELLO_address_cmp(const struct GNUNET_HELLO_Address *a1, | 163 | GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1, |
162 | const struct GNUNET_HELLO_Address *a2); | 164 | const struct GNUNET_HELLO_Address *a2); |
163 | 165 | ||
164 | 166 | ||
165 | /** | 167 | /** |
@@ -169,7 +171,7 @@ GNUNET_HELLO_address_cmp(const struct GNUNET_HELLO_Address *a1, | |||
169 | * @return the size | 171 | * @return the size |
170 | */ | 172 | */ |
171 | size_t | 173 | size_t |
172 | GNUNET_HELLO_address_get_size(const struct GNUNET_HELLO_Address *address); | 174 | GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address); |
173 | 175 | ||
174 | 176 | ||
175 | /** | 177 | /** |
@@ -180,8 +182,8 @@ GNUNET_HELLO_address_get_size(const struct GNUNET_HELLO_Address *address); | |||
180 | * @return #GNUNET_YES or #GNUNET_NO | 182 | * @return #GNUNET_YES or #GNUNET_NO |
181 | */ | 183 | */ |
182 | int | 184 | int |
183 | GNUNET_HELLO_address_check_option(const struct GNUNET_HELLO_Address *address, | 185 | GNUNET_HELLO_address_check_option (const struct GNUNET_HELLO_Address *address, |
184 | enum GNUNET_HELLO_AddressInfo option); | 186 | enum GNUNET_HELLO_AddressInfo option); |
185 | 187 | ||
186 | 188 | ||
187 | /** | 189 | /** |
@@ -189,7 +191,7 @@ GNUNET_HELLO_address_check_option(const struct GNUNET_HELLO_Address *address, | |||
189 | * | 191 | * |
190 | * @param addr address to free | 192 | * @param addr address to free |
191 | */ | 193 | */ |
192 | #define GNUNET_HELLO_address_free(addr) GNUNET_free(addr) | 194 | #define GNUNET_HELLO_address_free(addr) GNUNET_free (addr) |
193 | 195 | ||
194 | 196 | ||
195 | GNUNET_NETWORK_STRUCT_BEGIN | 197 | GNUNET_NETWORK_STRUCT_BEGIN |
@@ -207,7 +209,8 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
207 | * unaligned!) | 209 | * unaligned!) |
208 | * 4) address (address-length bytes; possibly unaligned!) | 210 | * 4) address (address-length bytes; possibly unaligned!) |
209 | */ | 211 | */ |
210 | struct GNUNET_HELLO_Message { | 212 | struct GNUNET_HELLO_Message |
213 | { | ||
211 | /** | 214 | /** |
212 | * Type will be #GNUNET_MESSAGE_TYPE_HELLO. | 215 | * Type will be #GNUNET_MESSAGE_TYPE_HELLO. |
213 | */ | 216 | */ |
@@ -233,7 +236,7 @@ GNUNET_NETWORK_STRUCT_END | |||
233 | * @return #GNUNET_YES for friend-only or #GNUNET_NO otherwise | 236 | * @return #GNUNET_YES for friend-only or #GNUNET_NO otherwise |
234 | */ | 237 | */ |
235 | int | 238 | int |
236 | GNUNET_HELLO_is_friend_only(const struct GNUNET_HELLO_Message *h); | 239 | GNUNET_HELLO_is_friend_only (const struct GNUNET_HELLO_Message *h); |
237 | 240 | ||
238 | 241 | ||
239 | /** | 242 | /** |
@@ -248,10 +251,10 @@ GNUNET_HELLO_is_friend_only(const struct GNUNET_HELLO_Message *h); | |||
248 | * the target buffer was not big enough. | 251 | * the target buffer was not big enough. |
249 | */ | 252 | */ |
250 | size_t | 253 | size_t |
251 | GNUNET_HELLO_add_address(const struct GNUNET_HELLO_Address *address, | 254 | GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address, |
252 | struct GNUNET_TIME_Absolute expiration, | 255 | struct GNUNET_TIME_Absolute expiration, |
253 | char *target, | 256 | char *target, |
254 | size_t max); | 257 | size_t max); |
255 | 258 | ||
256 | 259 | ||
257 | /** | 260 | /** |
@@ -285,10 +288,10 @@ typedef ssize_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, | |||
285 | * @return the hello message | 288 | * @return the hello message |
286 | */ | 289 | */ |
287 | struct GNUNET_HELLO_Message * | 290 | struct GNUNET_HELLO_Message * |
288 | GNUNET_HELLO_create(const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, | 291 | GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, |
289 | GNUNET_HELLO_GenerateAddressListCallback addrgen, | 292 | GNUNET_HELLO_GenerateAddressListCallback addrgen, |
290 | void *addrgen_cls, | 293 | void *addrgen_cls, |
291 | int friend_only); | 294 | int friend_only); |
292 | 295 | ||
293 | 296 | ||
294 | /** | 297 | /** |
@@ -298,7 +301,7 @@ GNUNET_HELLO_create(const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, | |||
298 | * @return the size, 0 if HELLO is invalid | 301 | * @return the size, 0 if HELLO is invalid |
299 | */ | 302 | */ |
300 | uint16_t | 303 | uint16_t |
301 | GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello); | 304 | GNUNET_HELLO_size (const struct GNUNET_HELLO_Message *hello); |
302 | 305 | ||
303 | 306 | ||
304 | /** | 307 | /** |
@@ -311,8 +314,8 @@ GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello); | |||
311 | * @return the combined hello message | 314 | * @return the combined hello message |
312 | */ | 315 | */ |
313 | struct GNUNET_HELLO_Message * | 316 | struct GNUNET_HELLO_Message * |
314 | GNUNET_HELLO_merge(const struct GNUNET_HELLO_Message *h1, | 317 | GNUNET_HELLO_merge (const struct GNUNET_HELLO_Message *h1, |
315 | const struct GNUNET_HELLO_Message *h2); | 318 | const struct GNUNET_HELLO_Message *h2); |
316 | 319 | ||
317 | 320 | ||
318 | /** | 321 | /** |
@@ -332,9 +335,9 @@ GNUNET_HELLO_merge(const struct GNUNET_HELLO_Message *h1, | |||
332 | * do not match at all | 335 | * do not match at all |
333 | */ | 336 | */ |
334 | struct GNUNET_TIME_Absolute | 337 | struct GNUNET_TIME_Absolute |
335 | GNUNET_HELLO_equals(const struct GNUNET_HELLO_Message *h1, | 338 | GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1, |
336 | const struct GNUNET_HELLO_Message *h2, | 339 | const struct GNUNET_HELLO_Message *h2, |
337 | struct GNUNET_TIME_Absolute now); | 340 | struct GNUNET_TIME_Absolute now); |
338 | 341 | ||
339 | 342 | ||
340 | /** | 343 | /** |
@@ -360,7 +363,7 @@ typedef int (*GNUNET_HELLO_AddressIterator) ( | |||
360 | * @return time the last address expires, 0 if there are no addresses in the HELLO | 363 | * @return time the last address expires, 0 if there are no addresses in the HELLO |
361 | */ | 364 | */ |
362 | struct GNUNET_TIME_Absolute | 365 | struct GNUNET_TIME_Absolute |
363 | GNUNET_HELLO_get_last_expiration(const struct GNUNET_HELLO_Message *msg); | 366 | GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg); |
364 | 367 | ||
365 | 368 | ||
366 | /** | 369 | /** |
@@ -376,10 +379,10 @@ GNUNET_HELLO_get_last_expiration(const struct GNUNET_HELLO_Message *msg); | |||
376 | * @return the modified HELLO or NULL | 379 | * @return the modified HELLO or NULL |
377 | */ | 380 | */ |
378 | struct GNUNET_HELLO_Message * | 381 | struct GNUNET_HELLO_Message * |
379 | GNUNET_HELLO_iterate_addresses(const struct GNUNET_HELLO_Message *msg, | 382 | GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg, |
380 | int return_modified, | 383 | int return_modified, |
381 | GNUNET_HELLO_AddressIterator it, | 384 | GNUNET_HELLO_AddressIterator it, |
382 | void *it_cls); | 385 | void *it_cls); |
383 | 386 | ||
384 | 387 | ||
385 | /** | 388 | /** |
@@ -396,7 +399,7 @@ GNUNET_HELLO_iterate_addresses(const struct GNUNET_HELLO_Message *msg, | |||
396 | * @param it_cls closure for @a it | 399 | * @param it_cls closure for @a it |
397 | */ | 400 | */ |
398 | void | 401 | void |
399 | GNUNET_HELLO_iterate_new_addresses( | 402 | GNUNET_HELLO_iterate_new_addresses ( |
400 | const struct GNUNET_HELLO_Message *new_hello, | 403 | const struct GNUNET_HELLO_Message *new_hello, |
401 | const struct GNUNET_HELLO_Message *old_hello, | 404 | const struct GNUNET_HELLO_Message *old_hello, |
402 | struct GNUNET_TIME_Absolute expiration_limit, | 405 | struct GNUNET_TIME_Absolute expiration_limit, |
@@ -412,8 +415,8 @@ GNUNET_HELLO_iterate_new_addresses( | |||
412 | * @return #GNUNET_SYSERR if the HELLO was malformed | 415 | * @return #GNUNET_SYSERR if the HELLO was malformed |
413 | */ | 416 | */ |
414 | int | 417 | int |
415 | GNUNET_HELLO_get_id(const struct GNUNET_HELLO_Message *hello, | 418 | GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, |
416 | struct GNUNET_PeerIdentity *peer); | 419 | struct GNUNET_PeerIdentity *peer); |
417 | 420 | ||
418 | 421 | ||
419 | /** | 422 | /** |
@@ -425,7 +428,7 @@ GNUNET_HELLO_get_id(const struct GNUNET_HELLO_Message *hello, | |||
425 | * @return header or NULL if the HELLO was malformed | 428 | * @return header or NULL if the HELLO was malformed |
426 | */ | 429 | */ |
427 | struct GNUNET_MessageHeader * | 430 | struct GNUNET_MessageHeader * |
428 | GNUNET_HELLO_get_header(struct GNUNET_HELLO_Message *hello); | 431 | GNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello); |
429 | 432 | ||
430 | 433 | ||
431 | /** | 434 | /** |
@@ -447,8 +450,8 @@ typedef struct GNUNET_TRANSPORT_PluginFunctions *( | |||
447 | * @return Hello URI string | 450 | * @return Hello URI string |
448 | */ | 451 | */ |
449 | char * | 452 | char * |
450 | GNUNET_HELLO_compose_uri(const struct GNUNET_HELLO_Message *hello, | 453 | GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello, |
451 | GNUNET_HELLO_TransportPluginsFind plugins_find); | 454 | GNUNET_HELLO_TransportPluginsFind plugins_find); |
452 | 455 | ||
453 | 456 | ||
454 | /** | 457 | /** |
@@ -461,10 +464,10 @@ GNUNET_HELLO_compose_uri(const struct GNUNET_HELLO_Message *hello, | |||
461 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the URI was invalid, #GNUNET_NO on other errors | 464 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the URI was invalid, #GNUNET_NO on other errors |
462 | */ | 465 | */ |
463 | int | 466 | int |
464 | GNUNET_HELLO_parse_uri(const char *uri, | 467 | GNUNET_HELLO_parse_uri (const char *uri, |
465 | struct GNUNET_CRYPTO_EddsaPublicKey *pubkey, | 468 | struct GNUNET_CRYPTO_EddsaPublicKey *pubkey, |
466 | struct GNUNET_HELLO_Message **hello, | 469 | struct GNUNET_HELLO_Message **hello, |
467 | GNUNET_HELLO_TransportPluginsFind plugins_find); | 470 | GNUNET_HELLO_TransportPluginsFind plugins_find); |
468 | 471 | ||
469 | 472 | ||
470 | /* NG API */ | 473 | /* NG API */ |
@@ -482,7 +485,7 @@ GNUNET_HELLO_parse_uri(const char *uri, | |||
482 | * @param result_size[out] set to size of @a result | 485 | * @param result_size[out] set to size of @a result |
483 | */ | 486 | */ |
484 | void | 487 | void |
485 | GNUNET_HELLO_sign_address( | 488 | GNUNET_HELLO_sign_address ( |
486 | const char *address, | 489 | const char *address, |
487 | enum GNUNET_NetworkType nt, | 490 | enum GNUNET_NetworkType nt, |
488 | struct GNUNET_TIME_Absolute mono_time, | 491 | struct GNUNET_TIME_Absolute mono_time, |
@@ -502,11 +505,11 @@ GNUNET_HELLO_sign_address( | |||
502 | * @return NULL on error, otherwise the address | 505 | * @return NULL on error, otherwise the address |
503 | */ | 506 | */ |
504 | char * | 507 | char * |
505 | GNUNET_HELLO_extract_address(const void *raw, | 508 | GNUNET_HELLO_extract_address (const void *raw, |
506 | size_t raw_size, | 509 | size_t raw_size, |
507 | const struct GNUNET_PeerIdentity *pid, | 510 | const struct GNUNET_PeerIdentity *pid, |
508 | enum GNUNET_NetworkType *nt, | 511 | enum GNUNET_NetworkType *nt, |
509 | struct GNUNET_TIME_Absolute *mono_time); | 512 | struct GNUNET_TIME_Absolute *mono_time); |
510 | 513 | ||
511 | 514 | ||
512 | /** | 515 | /** |
@@ -517,7 +520,7 @@ GNUNET_HELLO_extract_address(const void *raw, | |||
517 | * @return NULL if the address is mal-formed, otherwise the prefix | 520 | * @return NULL if the address is mal-formed, otherwise the prefix |
518 | */ | 521 | */ |
519 | char * | 522 | char * |
520 | GNUNET_HELLO_address_to_prefix(const char *address); | 523 | GNUNET_HELLO_address_to_prefix (const char *address); |
521 | 524 | ||
522 | 525 | ||
523 | #if 0 /* keep Emacsens' auto-indent happy */ | 526 | #if 0 /* keep Emacsens' auto-indent happy */ |