X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fcommon_logging.c;h=23749dd99f6c9ac16e5622a965a71b2310f5d0a3;hb=27520ef39b732562a6c4ffa8640b44250ad72a4a;hp=fbc0de50c972653a44891285059731149d6ce90c;hpb=f736b24935d66733e9a53798fbc87dbc8aff9fca;p=oweals%2Fgnunet.git diff --git a/src/util/common_logging.c b/src/util/common_logging.c index fbc0de50c..23749dd99 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -1011,6 +1011,43 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind) } +/** + * Convert a short hash 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 short hash code + * @return string form; will be overwritten by next call to GNUNET_h2s. + */ +const char * +GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc) +{ + static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret; + + GNUNET_CRYPTO_short_hash_to_enc (hc, &ret); + ret.short_encoding[8] = '\0'; + return (const char *) ret.short_encoding; +} + + +/** + * Convert a short hash 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 short hash code + * @return string form; will be overwritten by next call to GNUNET_h2s_full. + */ +const char * +GNUNET_short_h2s_full (const struct GNUNET_CRYPTO_ShortHashCode * hc) +{ + static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret; + + GNUNET_CRYPTO_short_hash_to_enc (hc, &ret); + ret.short_encoding[sizeof (ret) - 1] = '\0'; + return (const char *) ret.short_encoding; +} + /** * Convert a hash to a string (for printing debug messages). * This is one of the very few calls in the entire API that is @@ -1152,6 +1189,45 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen) } +/** + * Log error message about missing configuration option. + * + * @param kind log level + * @param section section with missing option + * @param option name of missing option + */ +void +GNUNET_log_config_missing (enum GNUNET_ErrorType kind, + const char *section, + const char *option) +{ + GNUNET_log (kind, + _("Configuration fails to specify option `%s' in section `%s'!\n"), + option, + section); +} + + +/** + * Log error message about invalid configuration option value. + * + * @param kind log level + * @param section section with invalid option + * @param option name of invalid option + * @param required what is required that is invalid about the option + */ +void +GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, + const char *section, + const char *option, + const char *required) +{ + GNUNET_log (kind, + _("Configuration specifies invalid value for option `%s' in section `%s': %s\n"), + option, section, required); +} + + /** * Initializer */