aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_strings_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_strings_lib.h')
-rw-r--r--src/include/gnunet_strings_lib.h48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index aa4daf8a3..df70c5e8f 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -18,7 +18,15 @@
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
20 20
21#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22#error "Only <gnunet_util_lib.h> can be included directly."
23#endif
24
21/** 25/**
26 * @addtogroup libgnunetutil
27 * Multi-function utilities library for GNUnet programs
28 * @{
29 *
22 * @author Christian Grothoff 30 * @author Christian Grothoff
23 * @author Krista Bennett 31 * @author Krista Bennett
24 * @author Gerd Knorr <kraxel@bytesex.org> 32 * @author Gerd Knorr <kraxel@bytesex.org>
@@ -33,6 +41,10 @@
33 * @{ 41 * @{
34 */ 42 */
35 43
44#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
45#error "Only <gnunet_util_lib.h> can be included directly."
46#endif
47
36#ifndef GNUNET_STRINGS_LIB_H 48#ifndef GNUNET_STRINGS_LIB_H
37#define GNUNET_STRINGS_LIB_H 49#define GNUNET_STRINGS_LIB_H
38 50
@@ -40,6 +52,7 @@
40 or unsigned long long, this IS platform dependent; 52 or unsigned long long, this IS platform dependent;
41 but "stdlib.h" should be portable 'enough' to be 53 but "stdlib.h" should be portable 'enough' to be
42 unconditionally available... */ 54 unconditionally available... */
55
43#include <stdlib.h> 56#include <stdlib.h>
44#include <sys/socket.h> 57#include <sys/socket.h>
45#include <netinet/in.h> 58#include <netinet/in.h>
@@ -397,15 +410,19 @@ GNUNET_STRINGS_base64_encode (const void *in,
397/** 410/**
398 * url/percent encode (RFC3986). 411 * url/percent encode (RFC3986).
399 * 412 *
413 * FIXME: awkward API, @a len is not actually used
414 * @a out is 0-terminated, should probably be changed
415 * to only input @a data and directly return @out or NULL.
416 *
400 * @param data the data to decode 417 * @param data the data to decode
401 * @param len the length of the input 418 * @param len the length of the input
402 * @param output where to write the output (*output should be NULL, 419 * @param out where to write the output (*out should be NULL,
403 * is allocated) 420 * is allocated)
404 * @return the size of the output 421 * @return the size of the output
405 */ 422 */
406size_t 423size_t
407GNUNET_STRINGS_urlencode (const char *data, 424GNUNET_STRINGS_urlencode (size_t len,
408 size_t len, 425 const char data[static len],
409 char **out); 426 char **out);
410 427
411 428
@@ -444,7 +461,7 @@ GNUNET_STRINGS_base64_decode (const char *data,
444 * 461 *
445 * @param data the data to decode 462 * @param data the data to decode
446 * @param len the length of the input 463 * @param len the length of the input
447 * @param output where to write the output (*output should be NULL, 464 * @param out where to write the output (*out should be NULL,
448 * is allocated) 465 * is allocated)
449 * @return the size of the output 466 * @return the size of the output
450 */ 467 */
@@ -565,7 +582,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
565 */ 582 */
566enum GNUNET_GenericReturnValue 583enum GNUNET_GenericReturnValue
567GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, 584GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
568 uint16_t addrlen, 585 size_t addrlen,
569 struct sockaddr_in6 *r_buf); 586 struct sockaddr_in6 *r_buf);
570 587
571 588
@@ -581,7 +598,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
581 */ 598 */
582enum GNUNET_GenericReturnValue 599enum GNUNET_GenericReturnValue
583GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, 600GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr,
584 uint16_t addrlen, 601 size_t addrlen,
585 struct sockaddr_in *r_buf); 602 struct sockaddr_in *r_buf);
586 603
587 604
@@ -657,6 +674,23 @@ GNUNET_strlcpy (char *dst,
657 size_t n); 674 size_t n);
658 675
659 676
677/**
678 * Sometimes we use the binary name to determine which specific
679 * test to run. In those cases, the string after the last "_"
680 * in 'argv[0]' specifies a string that determines the configuration
681 * file or plugin to use.
682 *
683 * This function returns the respective substring, taking care
684 * of issues such as binaries ending in '.exe' on W32.
685 *
686 * @param argv0 the name of the binary
687 * @return string between the last '_' and the '.exe' (or the end of the string),
688 * NULL if argv0 has no '_'
689 */
690char *
691GNUNET_STRINGS_get_suffix_from_binary_name (const char *argv0);
692
693
660/* ***************** IPv4/IPv6 parsing ****************** */ 694/* ***************** IPv4/IPv6 parsing ****************** */
661 695
662struct GNUNET_STRINGS_PortPolicy 696struct GNUNET_STRINGS_PortPolicy
@@ -765,4 +799,6 @@ GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX);
765 799
766/** @} */ /* end of group */ 800/** @} */ /* end of group */
767 801
802/** @} */ /* end of group addition */
803
768/* end of gnunet_util_string.h */ 804/* end of gnunet_util_string.h */