diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-11-27 14:43:02 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-11-27 14:43:02 +0100 |
commit | c30f9fe5daf92a89849f7d6d22eacb603918b42d (patch) | |
tree | 70b07926e1170c5b19a3d09a773ec2c1422d84df /src/include/gnunet_strings_lib.h | |
parent | b035390c73b241ddb513f420671043e9113c237c (diff) | |
download | gnunet-c30f9fe5daf92a89849f7d6d22eacb603918b42d.tar.gz gnunet-c30f9fe5daf92a89849f7d6d22eacb603918b42d.zip |
largely completing gnunet-nat tool, using new service API (but untested)
Diffstat (limited to 'src/include/gnunet_strings_lib.h')
-rw-r--r-- | src/include/gnunet_strings_lib.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 15d4f57ac..0328882dd 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -349,25 +349,27 @@ GNUNET_STRINGS_base64_encode (const char *data, size_t len, char **output); | |||
349 | * | 349 | * |
350 | * @param data the data to encode | 350 | * @param data the data to encode |
351 | * @param len the length of the input | 351 | * @param len the length of the input |
352 | * @param output where to write the output (*output should be NULL, | 352 | * @param[out] output where to write the output (*output should be NULL, |
353 | * is allocated) | 353 | * is allocated) |
354 | * @return the size of the output | 354 | * @return the size of the output |
355 | */ | 355 | */ |
356 | size_t | 356 | size_t |
357 | GNUNET_STRINGS_base64_decode (const char *data, size_t len, char **output); | 357 | GNUNET_STRINGS_base64_decode (const char *data, |
358 | size_t len, | ||
359 | char **output); | ||
358 | 360 | ||
359 | 361 | ||
360 | /** | 362 | /** |
361 | * Parse a path that might be an URI. | 363 | * Parse a path that might be an URI. |
362 | * | 364 | * |
363 | * @param path path to parse. Must be NULL-terminated. | 365 | * @param path path to parse. Must be NULL-terminated. |
364 | * @param scheme_part a pointer to 'char *' where a pointer to a string that | 366 | * @param[out] scheme_part pointer to a string that |
365 | * represents the URI scheme will be stored. Can be NULL. The string is | 367 | * represents the URI scheme will be stored. Can be NULL. The string is |
366 | * allocated by the function, and should be freed by GNUNET_free() when | 368 | * allocated by the function, and should be freed by GNUNET_free() when |
367 | * it is no longer needed. | 369 | * it is no longer needed. |
368 | * @param path_part a pointer to 'const char *' where a pointer to the path | 370 | * @param path_part a pointer to 'const char *' where a pointer to the path |
369 | * part of the URI will be stored. Can be NULL. Points to the same block | 371 | * part of the URI will be stored. Can be NULL. Points to the same block |
370 | * of memory as 'path', and thus must not be freed. Might point to '\0', | 372 | * of memory as @a path, and thus must not be freed. Might point to '\0', |
371 | * if path part is zero-length. | 373 | * if path part is zero-length. |
372 | * @return #GNUNET_YES if it's an URI, #GNUNET_NO otherwise. If 'path' is not | 374 | * @return #GNUNET_YES if it's an URI, #GNUNET_NO otherwise. If 'path' is not |
373 | * an URI, '* scheme_part' and '*path_part' will remain unchanged | 375 | * an URI, '* scheme_part' and '*path_part' will remain unchanged |
@@ -475,6 +477,21 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, | |||
475 | 477 | ||
476 | 478 | ||
477 | /** | 479 | /** |
480 | * Parse an address given as a string into a | ||
481 | * `struct sockaddr`. | ||
482 | * | ||
483 | * @param addr the address | ||
484 | * @param[out] af set to the parsed address family (i.e. AF_INET) | ||
485 | * @param[out] sa set to the parsed address | ||
486 | * @return 0 on error, otherwise number of bytes in @a sa | ||
487 | */ | ||
488 | size_t | ||
489 | GNUNET_STRINGS_parse_socket_addr (const char *addr, | ||
490 | uint8_t *af, | ||
491 | struct sockaddr **sa); | ||
492 | |||
493 | |||
494 | /** | ||
478 | * Tries to convert @a addr string to an IP (v4 or v6) address. | 495 | * Tries to convert @a addr string to an IP (v4 or v6) address. |
479 | * Will automatically decide whether to treat 'addr' as v4 or v6 address. | 496 | * Will automatically decide whether to treat 'addr' as v4 or v6 address. |
480 | * | 497 | * |