error.c

Go to the documentation of this file.
00001 /*
00002  * a error2str function to make sense of all the
00003  * error codes we have laying ardoun
00004  *
00005  * a Net::DNS like library for C
00006  * LibDNS Team @ NLnet Labs
00007  * (c) NLnet Labs, 2005-2006
00008  * See the file LICENSE for the license
00009  */
00010 
00011 #include <ldns/config.h>
00012 
00013 #include <ldns/ldns.h>
00014 
00015 ldns_lookup_table ldns_error_str[] = {
00016         { LDNS_STATUS_OK, "All OK" },
00017         { LDNS_STATUS_EMPTY_LABEL, "Empty label" },
00018         { LDNS_STATUS_LABEL_OVERFLOW, "Label length overflow" },
00019         { LDNS_STATUS_DOMAINNAME_OVERFLOW, "Domainname length overflow" },
00020         { LDNS_STATUS_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" },
00021         { LDNS_STATUS_DDD_OVERFLOW, "\\DDD sequence overflow (>255)" },
00022         { LDNS_STATUS_PACKET_OVERFLOW, "Packet size overflow" },
00023         { LDNS_STATUS_INVALID_POINTER, "Invalid compression pointer" },
00024         { LDNS_STATUS_MEM_ERR, "General memory error" },
00025         { LDNS_STATUS_INTERNAL_ERR, "Internal error, this should not happen" },
00026         { LDNS_STATUS_SSL_ERR, "Error in SSL library" },
00027         { LDNS_STATUS_ERR, "General LDNS error" },
00028         { LDNS_STATUS_INVALID_INT, "Conversion error, integer expected" },
00029         { LDNS_STATUS_INVALID_IP4, "Conversion error, ip4 addr expected" },
00030         { LDNS_STATUS_INVALID_IP6, "Conversion error, ip6 addr expected" },
00031         { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" },
00032         { LDNS_STATUS_INVALID_B32_EXT, "Conversion error, b32 ext encoding expected" },
00033         { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" },
00034         { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" },
00035         { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" },
00036         { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" },
00037         { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" },
00038         { LDNS_STATUS_FILE_ERR, "Could not open the files" },
00039         { LDNS_STATUS_UNKNOWN_INET, "Uknown address family" },
00040         { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." },
00041         { LDNS_STATUS_NULL, "Supplied value pointer null" },
00042         { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" },
00043         { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" },
00044         { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" },
00045         { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" },
00046         { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" },
00047         { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" },
00048         { LDNS_STATUS_CRYPTO_NO_DS, "No DS record(s)" },
00049         { LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, "Could not validate DS record(s)" },
00050         { LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, "No keys with the keytag and algorithm from the RRSIG found" },
00051         { LDNS_STATUS_CRYPTO_VALIDATED, "Valid DNSSEC signature" },
00052         { LDNS_STATUS_CRYPTO_BOGUS, "Bogus DNSSEC signature" },
00053         { LDNS_STATUS_CRYPTO_SIG_EXPIRED, "DNSSEC signature has expired" },
00054         { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, "DNSSEC signature not incepted yet" },
00055         { LDNS_STATUS_CRYPTO_TSIG_BOGUS, "Bogus TSIG signature" },
00056         { LDNS_STATUS_CRYPTO_TSIG_ERR, "Could not create TSIG signature" },
00057         { LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, "DNSSEC signature has expiration date earlier than inception date" },
00058         { LDNS_STATUS_ENGINE_KEY_NOT_LOADED, "Unable to load private key from engine" },
00059         { LDNS_STATUS_NSEC3_ERR, "Error in NSEC3 denial of existence proof" },
00060         { LDNS_STATUS_RES_NO_NS, "No (valid) nameservers defined in the resolver" },
00061         { LDNS_STATUS_RES_QUERY, "No correct query given to resolver" },
00062         { LDNS_STATUS_WIRE_INCOMPLETE_HEADER, "header section incomplete" },
00063         { LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, "question section incomplete" },
00064         { LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, "answer section incomplete" },
00065         { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" },
00066         { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" },
00067         { LDNS_STATUS_NO_DATA, "No data" },
00068         { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" },
00069         { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" },
00070         { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" },
00071         { LDNS_STATUS_SYNTAX_TTL_ERR, "Syntax error, could not parse the RR's TTL" },
00072         { LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, "Syntax error, $INCLUDE not implemented" },
00073         { LDNS_STATUS_SYNTAX_RDATA_ERR, "Syntax error, could not parse the RR's rdata" },
00074         { LDNS_STATUS_SYNTAX_DNAME_ERR, "Syntax error, could not parse the RR's dname(s)" },
00075         { LDNS_STATUS_SYNTAX_VERSION_ERR, "Syntax error, version mismatch" },
00076         { LDNS_STATUS_SYNTAX_ALG_ERR, "Syntax error, algorithm unknown or non parseable" },
00077         { LDNS_STATUS_SYNTAX_KEYWORD_ERR, "Syntax error, unknown keyword in input" },
00078         { LDNS_STATUS_SYNTAX_ERR, "Syntax error, could not parse the RR" },
00079         { LDNS_STATUS_SYNTAX_EMPTY, "Empty line was returned" },
00080         { LDNS_STATUS_SYNTAX_TTL, "$TTL directive was seen in the zone" },
00081         { LDNS_STATUS_SYNTAX_ORIGIN, "$ORIGIN directive was seen in the zone" },
00082         { LDNS_STATUS_SYNTAX_INCLUDE, "$INCLUDE directive was seen in the zone" },
00083         { LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, "Iterations count for NSEC3 record higher than maximum" },
00084         { LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, "Syntax error, value expected" },
00085         { LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer value too large" },
00086         { LDNS_STATUS_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" },
00087         { LDNS_STATUS_SOCKET_ERROR, "Error creating socket" },
00088         { LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, "Existence denied by NSEC" },
00089         { LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, "RR not covered by the given NSEC RRs" },
00090         { LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, "wildcard not covered by the given NSEC RRs" },
00091         { LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND, "original of NSEC3 hashed name could not be found" },
00092         { LDNS_STATUS_MISSING_RDATA_FIELDS_RRSIG, "The RRSIG has to few rdata fields" },
00093         { LDNS_STATUS_MISSING_RDATA_FIELDS_KEY, "The DNSKEY has to few rdata fields" },
00094         { LDNS_STATUS_CRYPTO_SIG_EXPIRED_WITHIN_MARGIN, 
00095                 "DNSSEC signature will expire too soon" },
00096         { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED_WITHIN_MARGIN,
00097                 "DNSSEC signature not incepted long enough" },
00098         { LDNS_STATUS_DANE_UNKNOWN_CERTIFICATE_USAGE,
00099                 "Unknown TLSA Certificate Usage" },
00100         { LDNS_STATUS_DANE_UNKNOWN_SELECTOR, "Unknown TLSA Selector" },
00101         { LDNS_STATUS_DANE_UNKNOWN_MATCHING_TYPE,
00102                 "Unknown TLSA Matching Type" },
00103         { LDNS_STATUS_DANE_UNKNOWN_PROTOCOL,
00104                 "Unknown protocol. Only IPv4 and IPv6 are understood" },
00105         { LDNS_STATUS_DANE_UNKNOWN_TRANSPORT,
00106                 "Unknown transport. Should be one of {tcp, udp, sctp}" },
00107         { LDNS_STATUS_DANE_MISSING_EXTRA_CERTS,  /* Trust anchor assertion */
00108                 "More than one certificate should be provided" },
00109         { LDNS_STATUS_DANE_EXTRA_CERTS_NOT_USED, /* Trust anchor assertion */
00110                 "Non of the extra certificates is used to sign the first" },
00111         { LDNS_STATUS_DANE_OFFSET_OUT_OF_RANGE,   /* Trust anchor assertion */
00112                 "The offset was out of range" },
00113         { LDNS_STATUS_DANE_INSECURE,             /* Unused by library */
00114                 "The queried resource records were insecure" },
00115         { LDNS_STATUS_DANE_BOGUS,             /* Unused by library */
00116                 "The queried resource records were bogus" },
00117         { LDNS_STATUS_DANE_TLSA_DID_NOT_MATCH,
00118                 "The TLSA record(s) "
00119                 "did not match with the server certificate (chain)" },
00120         { LDNS_STATUS_DANE_NON_CA_CERTIFICATE,
00121                 "The certificate was not a CA certificate" },
00122         { LDNS_STATUS_DANE_PKIX_DID_NOT_VALIDATE,
00123                 "Could not PKIX validate" },
00124         { LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR,
00125                 "The validation path "
00126                 "did not end in a self-signed certificate" },
00127         { 0, NULL }
00128 };
00129 
00130 const char *
00131 ldns_get_errorstr_by_id(ldns_status err)
00132 {
00133         ldns_lookup_table *lt;
00134 
00135         lt = ldns_lookup_by_id(ldns_error_str, err);
00136 
00137         if (lt) {
00138                 return lt->name;
00139         }
00140         return NULL;
00141 }

Generated on Wed Dec 19 16:56:49 2012 for ldns by  doxygen 1.4.7