Changeset View
Changeset View
Standalone View
Standalone View
contrib/ldns/error.c
/* | /* | ||||
* a error2str function to make sense of all the | * a error2str function to make sense of all the | ||||
* error codes we have laying ardoun | * error codes we have laying around | ||||
* | * | ||||
* a Net::DNS like library for C | * a Net::DNS like library for C | ||||
* LibDNS Team @ NLnet Labs | * LibDNS Team @ NLnet Labs | ||||
* (c) NLnet Labs, 2005-2006 | * (c) NLnet Labs, 2005-2006 | ||||
* See the file LICENSE for the license | * See the file LICENSE for the license | ||||
*/ | */ | ||||
#include <ldns/config.h> | #include <ldns/config.h> | ||||
Show All 19 Lines | ldns_lookup_table ldns_error_str[] = { | ||||
{ LDNS_STATUS_INVALID_STR, "Conversion error, string expected" }, | { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" }, | ||||
{ LDNS_STATUS_INVALID_B32_EXT, "Conversion error, b32 ext encoding expected" }, | { LDNS_STATUS_INVALID_B32_EXT, "Conversion error, b32 ext encoding expected" }, | ||||
{ LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" }, | { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" }, | ||||
{ LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" }, | { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" }, | ||||
{ LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" }, | { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" }, | ||||
{ LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" }, | { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" }, | ||||
{ LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" }, | { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" }, | ||||
{ LDNS_STATUS_FILE_ERR, "Could not open the files" }, | { LDNS_STATUS_FILE_ERR, "Could not open the files" }, | ||||
{ LDNS_STATUS_UNKNOWN_INET, "Uknown address family" }, | { LDNS_STATUS_UNKNOWN_INET, "Unknown address family" }, | ||||
{ LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." }, | { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." }, | ||||
{ LDNS_STATUS_NULL, "Supplied value pointer null" }, | { LDNS_STATUS_NULL, "Supplied value pointer null" }, | ||||
{ LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" }, | { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" }, | ||||
{ LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" }, | { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" }, | ||||
{ LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" }, | { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" }, | ||||
{ LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" }, | { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" }, | ||||
{ LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" }, | { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" }, | ||||
{ LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" }, | { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" }, | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | #if OPENSSL_VERSION_NUMBER < 0x10100000 || defined(HAVE_LIBRESSL) | ||||
"ldns needs to be linked with OpenSSL >= 1.1.0 to be able " | "ldns needs to be linked with OpenSSL >= 1.1.0 to be able " | ||||
"to verify the DANE-TA usage type." }, | "to verify the DANE-TA usage type." }, | ||||
#else | #else | ||||
{ LDNS_STATUS_DANE_NEED_OPENSSL_GE_1_1_FOR_DANE_TA, | { LDNS_STATUS_DANE_NEED_OPENSSL_GE_1_1_FOR_DANE_TA, | ||||
"ldns depends on the availability of the SSL_get0_dane() and " | "ldns depends on the availability of the SSL_get0_dane() and " | ||||
"X509_STORE_CTX_set0_dane() functions within OpenSSL >= 1.1.0 " | "X509_STORE_CTX_set0_dane() functions within OpenSSL >= 1.1.0 " | ||||
"to be able to verify the DANE-TA usage type." }, | "to be able to verify the DANE-TA usage type." }, | ||||
#endif | #endif | ||||
{ LDNS_STATUS_ZONEMD_DOUBLE_OCCURRENCE, "A ZONEMD with the same " | |||||
"<scheme> and hash algorithm occurred more than once." }, | |||||
{ LDNS_STATUS_ZONEMD_UNKNOWN_SCHEME, "Unknown ZONEMD <scheme>" }, | |||||
{ LDNS_STATUS_ZONEMD_UNKNOWN_HASH, "Unknown ZONEMD hash algorithm" }, | |||||
{ LDNS_STATUS_ZONEMD_INVALID_SOA, | |||||
"Missing or invalid SOA to associate with ZONEMD RR" }, | |||||
{ LDNS_STATUS_NO_ZONEMD, | |||||
"NSEC(3) RRs indicate that a ZONEMD exists, " | |||||
"but it is not found in the zone" }, | |||||
{ LDNS_STATUS_NO_VALID_ZONEMD, | |||||
"No ZONEMD matching the zone data was found" }, | |||||
{ LDNS_STATUS_SYNTAX_SVCPARAM_KEY_ERR, "Syntax error in a key in " | |||||
"the ServiceParam rdata field of SVCB or HTTPS RR" }, | |||||
{ LDNS_STATUS_SYNTAX_SVCPARAM_VALUE_ERR, "Syntax error in a value in " | |||||
"the ServiceParam rdata field of SVCB or HTTPS RR" }, | |||||
{ LDNS_STATUS_RESERVED_SVCPARAM_KEY, | |||||
"key65535 is reserved and MUST NOT be used " | |||||
"in the ServiceParam rdata field of SVCB or HTTPS RR" }, | |||||
{ LDNS_STATUS_NO_SVCPARAM_VALUE_EXPECTED, | |||||
"A value was found for a key that SHOULD not have a value " | |||||
"in the ServiceParam rdata field of SVCB or HTTPS RR" }, | |||||
{ LDNS_STATUS_SVCPARAM_KEY_MORE_THAN_ONCE, | |||||
"A key was found more than once " | |||||
"in the ServiceParam rdata field of SVCB or HTTPS RR" }, | |||||
{ LDNS_STATUS_INVALID_SVCPARAM_VALUE, | |||||
"Invalid wireformat of a value " | |||||
"in the ServiceParam rdata field of SVCB or HTTPS RR" }, | |||||
{ 0, NULL } | { 0, NULL } | ||||
}; | }; | ||||
const char * | const char * | ||||
ldns_get_errorstr_by_id(ldns_status err) | ldns_get_errorstr_by_id(ldns_status err) | ||||
{ | { | ||||
ldns_lookup_table *lt; | ldns_lookup_table *lt; | ||||
lt = ldns_lookup_by_id(ldns_error_str, err); | lt = ldns_lookup_by_id(ldns_error_str, err); | ||||
if (lt) { | if (lt) { | ||||
return lt->name; | return lt->name; | ||||
} | } | ||||
return NULL; | return NULL; | ||||
} | } |