X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fgnunet_common.h;h=aacf6328a84a72f07938f59f5e5757e3b64df9f9;hb=8de34260292a2e6f7bb980dcefd8d95f5763ad25;hp=61b572eb86822141ba1f70265a1b1ac75a4cac14;hpb=0a217a8df1657b4334b55b0e4a6c7837a8dbcfd9;p=oweals%2Fgnunet.git diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 61b572eb8..aacf6328a 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -206,6 +206,17 @@ void GNUNET_logger_add (GNUNET_Logger logger, void *logger_cls); void GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); +/** + * Convert a hash value to a string (for printing debug messages). + * This is one of the very few calls in the entire API that is + * NOT reentrant! + * + * @param hc the hash code + * @return string + */ +const char *GNUNET_h2s (const GNUNET_HashCode *hc); + + /** * Convert a peer identity to a string (for printing debug messages). * This is one of the very few calls in the entire API that is @@ -217,6 +228,20 @@ void GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); */ const char *GNUNET_i2s (const struct GNUNET_PeerIdentity *pid); + +/** + * Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string + * (for printing debug messages). This is one of the very few calls + * in the entire API that is NOT reentrant! + * + * @param addr the address + * @param addrlen the length of the address + * @return nicely formatted string for the address + * will be overwritten by next call to GNUNET_a2s. + */ +const char *GNUNET_a2s (const struct sockaddr *addr, + socklen_t addrlen); + /** * Convert error type to string. * @@ -287,7 +312,7 @@ unsigned long long GNUNET_htonll (unsigned long long n); /** * Maximum allocation with GNUNET_malloc macro. */ -#define GNUNET_MAX_GNUNET_MALLOC_CHECKED (1024 * 1024 * 40) +#define GNUNET_MAX_MALLOC_CHECKED (1024 * 1024 * 40) /** * Wrapper around malloc. Allocates size bytes of memory.