ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

error.c
Go to the documentation of this file.
1 /*
2 * a error2str function to make sense of all the
3 * error codes we have laying ardoun
4 *
5 * a Net::DNS like library for C
6 * LibDNS Team @ NLnet Labs
7 * (c) NLnet Labs, 2005-2006
8 * See the file LICENSE for the license
9 */
10
11 #include <ldns/config.h>
12
13 #include <ldns/ldns.h>
14
15 ldns_lookup_table ldns_error_str[] = {
16 { LDNS_STATUS_OK, "All OK" },
17 { LDNS_STATUS_EMPTY_LABEL, "Empty label" },
18 { LDNS_STATUS_LABEL_OVERFLOW, "Label length overflow" },
19 { LDNS_STATUS_DOMAINNAME_OVERFLOW, "Domainname length overflow" },
20 { LDNS_STATUS_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" },
21 { LDNS_STATUS_DDD_OVERFLOW, "\\DDD sequence overflow (>255)" },
22 { LDNS_STATUS_PACKET_OVERFLOW, "Packet size overflow" },
23 { LDNS_STATUS_INVALID_POINTER, "Invalid compression pointer" },
24 { LDNS_STATUS_MEM_ERR, "General memory error" },
25 { LDNS_STATUS_INTERNAL_ERR, "Internal error, this should not happen" },
26 { LDNS_STATUS_SSL_ERR, "Error in SSL library" },
27 { LDNS_STATUS_ERR, "General LDNS error" },
28 { LDNS_STATUS_INVALID_INT, "Conversion error, integer expected" },
29 { LDNS_STATUS_INVALID_IP4, "Conversion error, ip4 addr expected" },
30 { LDNS_STATUS_INVALID_IP6, "Conversion error, ip6 addr expected" },
31 { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" },
32 { LDNS_STATUS_INVALID_B32_EXT, "Conversion error, b32 ext encoding expected" },
33 { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" },
34 { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" },
35 { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" },
36 { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" },
37 { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" },
38 { LDNS_STATUS_FILE_ERR, "Could not open the files" },
39 { LDNS_STATUS_UNKNOWN_INET, "Uknown address family" },
40 { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." },
41 { LDNS_STATUS_NULL, "Supplied value pointer null" },
42 { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" },
43 { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" },
44 { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" },
45 { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" },
46 { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" },
47 { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" },
48 { LDNS_STATUS_CRYPTO_NO_DS, "No DS record(s)" },
49 { LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, "Could not validate DS record(s)" },
50 { LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, "No keys with the keytag and algorithm from the RRSIG found" },
51 { LDNS_STATUS_CRYPTO_VALIDATED, "Valid DNSSEC signature" },
52 { LDNS_STATUS_CRYPTO_BOGUS, "Bogus DNSSEC signature" },
53 { LDNS_STATUS_CRYPTO_SIG_EXPIRED, "DNSSEC signature has expired" },
54 { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, "DNSSEC signature not incepted yet" },
55 { LDNS_STATUS_CRYPTO_TSIG_BOGUS, "Bogus TSIG signature" },
56 { LDNS_STATUS_CRYPTO_TSIG_ERR, "Could not create TSIG signature" },
57 { LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, "DNSSEC signature has expiration date earlier than inception date" },
58 { LDNS_STATUS_ENGINE_KEY_NOT_LOADED, "Unable to load private key from engine" },
59 { LDNS_STATUS_NSEC3_ERR, "Error in NSEC3 denial of existence proof" },
60 { LDNS_STATUS_RES_NO_NS, "No (valid) nameservers defined in the resolver" },
61 { LDNS_STATUS_RES_QUERY, "No correct query given to resolver" },
62 { LDNS_STATUS_WIRE_INCOMPLETE_HEADER, "header section incomplete" },
63 { LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, "question section incomplete" },
64 { LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, "answer section incomplete" },
65 { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" },
66 { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" },
67 { LDNS_STATUS_NO_DATA, "No data" },
68 { LDNS_STATUS_EXISTS_ERR, "Element already exists" },
69 { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" },
70 { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" },
71 { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" },
72 { LDNS_STATUS_SYNTAX_TTL_ERR, "Syntax error, could not parse the RR's TTL" },
73 { LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, "Syntax error, $INCLUDE not implemented" },
74 { LDNS_STATUS_SYNTAX_RDATA_ERR, "Syntax error, could not parse the RR's rdata" },
75 { LDNS_STATUS_SYNTAX_DNAME_ERR, "Syntax error, could not parse the RR's dname(s)" },
76 { LDNS_STATUS_SYNTAX_VERSION_ERR, "Syntax error, version mismatch" },
77 { LDNS_STATUS_SYNTAX_ALG_ERR, "Syntax error, algorithm unknown or non parseable" },
78 { LDNS_STATUS_SYNTAX_KEYWORD_ERR, "Syntax error, unknown keyword in input" },
79 { LDNS_STATUS_SYNTAX_ERR, "Syntax error, could not parse the RR" },
80 { LDNS_STATUS_SYNTAX_EMPTY, "Empty line was returned" },
81 { LDNS_STATUS_SYNTAX_TTL, "$TTL directive was seen in the zone" },
82 { LDNS_STATUS_SYNTAX_ORIGIN, "$ORIGIN directive was seen in the zone" },
83 { LDNS_STATUS_SYNTAX_INCLUDE, "$INCLUDE directive was seen in the zone" },
84 { LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, "Iterations count for NSEC3 record higher than maximum" },
85 { LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, "Syntax error, value expected" },
86 { LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer value too large" },
87 { LDNS_STATUS_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" },
88 { LDNS_STATUS_SOCKET_ERROR, "Error creating socket" },
89 { LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, "Existence denied by NSEC" },
90 { LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, "RR not covered by the given NSEC RRs" },
91 { LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, "wildcard not covered by the given NSEC RRs" },
92 { LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND, "original of NSEC3 hashed name could not be found" },
93 { LDNS_STATUS_MISSING_RDATA_FIELDS_RRSIG, "The RRSIG has to few rdata fields" },
94 { LDNS_STATUS_MISSING_RDATA_FIELDS_KEY, "The DNSKEY has to few rdata fields" },
95 { LDNS_STATUS_CRYPTO_SIG_EXPIRED_WITHIN_MARGIN,
96 "DNSSEC signature will expire too soon" },
97 { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED_WITHIN_MARGIN,
98 "DNSSEC signature not incepted long enough" },
99 { LDNS_STATUS_DANE_UNKNOWN_CERTIFICATE_USAGE,
100 "Unknown TLSA Certificate Usage" },
101 { LDNS_STATUS_DANE_UNKNOWN_SELECTOR, "Unknown TLSA Selector" },
102 { LDNS_STATUS_DANE_UNKNOWN_MATCHING_TYPE,
103 "Unknown TLSA Matching Type" },
104 { LDNS_STATUS_DANE_UNKNOWN_PROTOCOL,
105 "Unknown protocol. Only IPv4 and IPv6 are understood" },
106 { LDNS_STATUS_DANE_UNKNOWN_TRANSPORT,
107 "Unknown transport. Should be one of {tcp, udp, sctp}" },
108 { LDNS_STATUS_DANE_MISSING_EXTRA_CERTS, /* Trust anchor assertion */
109 "More than one certificate should be provided" },
110 { LDNS_STATUS_DANE_EXTRA_CERTS_NOT_USED, /* Trust anchor assertion */
111 "Non of the extra certificates is used to sign the first" },
112 { LDNS_STATUS_DANE_OFFSET_OUT_OF_RANGE, /* Trust anchor assertion */
113 "The offset was out of range" },
114 { LDNS_STATUS_DANE_INSECURE, /* Unused by library */
115 "The queried resource records were insecure" },
116 { LDNS_STATUS_DANE_BOGUS, /* Unused by library */
117 "The queried resource records were bogus" },
118 { LDNS_STATUS_DANE_TLSA_DID_NOT_MATCH,
119 "The TLSA record(s) "
120 "did not match with the server certificate (chain)" },
121 { LDNS_STATUS_DANE_NON_CA_CERTIFICATE,
122 "The certificate was not a CA certificate" },
123 { LDNS_STATUS_DANE_PKIX_DID_NOT_VALIDATE,
124 "Could not PKIX validate" },
125 { LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR,
126 "The validation path "
127 "did not end in a self-signed certificate" },
128 { LDNS_STATUS_INVALID_ILNP64,
129 "Conversion error, 4 colon separated hex numbers expected" },
130 { LDNS_STATUS_INVALID_EUI48,
131 "Conversion error, 6 two character hex numbers "
132 "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx" },
133 { LDNS_STATUS_INVALID_EUI64,
134 "Conversion error, 8 two character hex numbers "
135 "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx-xx-xx" },
136 { LDNS_STATUS_WIRE_RDATA_ERR, "invalid rdata in wire format" },
137 { LDNS_STATUS_INVALID_TAG,
138 "Conversion error, a non-zero sequence of US-ASCII letters "
139 "and numbers in lower case expected" },
140 { LDNS_STATUS_TYPE_NOT_IN_BITMAP,
141 "The RR type bitmap rdata field did not have "
142 "a bit reserved for the specific RR type" },
143 { LDNS_STATUS_INVALID_RDF_TYPE,
144 "The rdata field was not of the expected type" },
145 { LDNS_STATUS_RDATA_OVERFLOW, "Rdata size overflow" },
146 { 0, NULL }
147 };
148
149 const char *
150 ldns_get_errorstr_by_id(ldns_status err)
151 {
152 ldns_lookup_table *lt;
153
154 lt = ldns_lookup_by_id(ldns_error_str, err);
155
156 if (lt) {
157 return lt->name;
158 }
159 return NULL;
160 }
LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND
Definition: error.h:101
LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION
Definition: error.h:66
LDNS_STATUS_INVALID_ILNP64
Definition: error.h:122
LDNS_STATUS_SYNTAX_TYPE_ERR
Definition: error.h:79
LDNS_STATUS_SSL_ERR
Definition: error.h:36
LDNS_STATUS_CRYPTO_UNKNOWN_ALGO
Definition: error.h:52
LDNS_STATUS_NOT_IMPL
Definition: error.h:50
LDNS_STATUS_SYNTAX_INCLUDE
Definition: error.h:90
LDNS_STATUS_SYNTAX_KEYWORD_ERR
Definition: error.h:87
LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY
Definition: error.h:75
LDNS_STATUS_CRYPTO_SIG_EXPIRED_WITHIN_MARGIN
Definition: error.h:104
LDNS_STATUS_NULL
Definition: error.h:51
LDNS_STATUS_ADDRESS_ERR
Definition: error.h:47
LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL
Definition: error.h:82
LDNS_STATUS_DANE_INSECURE
Definition: error.h:115
LDNS_STATUS_CRYPTO_TSIG_BOGUS
Definition: error.h:64
LDNS_STATUS_SYNTAX_TTL
Definition: error.h:88
LDNS_STATUS_MISSING_RDATA_FIELDS_RRSIG
Definition: error.h:102
LDNS_STATUS_OK
Definition: error.h:26
LDNS_STATUS_UNKNOWN_INET
Definition: error.h:49
LDNS_STATUS_INVALID_EUI64
Definition: error.h:124
LDNS_STATUS_SYNTAX_RDATA_ERR
Definition: error.h:83
LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY
Definition: error.h:56
LDNS_STATUS_SOCKET_ERROR
Definition: error.h:96
LDNS_STATUS_LABEL_OVERFLOW
Definition: error.h:28
LDNS_STATUS_INVALID_IP6
Definition: error.h:40
LDNS_STATUS_NO_DATA
Definition: error.h:77
LDNS_STATUS_INVALID_IP4
Definition: error.h:39
LDNS_STATUS_SYNTAX_VERSION_ERR
Definition: error.h:85
LDNS_STATUS_DANE_TLSA_DID_NOT_MATCH
Definition: error.h:117
LDNS_STATUS_RES_QUERY
Definition: error.h:71
LDNS_STATUS_CRYPTO_NO_DNSKEY
Definition: error.h:55
LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED
Definition: error.h:63
LDNS_STATUS_CRYPTO_SIG_EXPIRED
Definition: error.h:62
LDNS_STATUS_CRYPTO_NO_RRSIG
Definition: error.h:54
LDNS_STATUS_INVALID_RDF_TYPE
Definition: error.h:128
LDNS_STATUS_SYNTAX_TTL_ERR
Definition: error.h:81
LDNS_STATUS_CRYPTO_VALIDATED
Definition: error.h:60
LDNS_STATUS_NSEC3_ERR
Definition: error.h:69
LDNS_STATUS_DANE_OFFSET_OUT_OF_RANGE
Definition: error.h:114
LDNS_STATUS_INVALID_POINTER
Definition: error.h:33
LDNS_STATUS_WIRE_INCOMPLETE_QUESTION
Definition: error.h:73
LDNS_STATUS_DANE_PKIX_DID_NOT_VALIDATE
Definition: error.h:119
LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED
Definition: error.h:99
LDNS_STATUS_CRYPTO_BOGUS
Definition: error.h:61
LDNS_STATUS_CERT_BAD_ALGORITHM
Definition: error.h:78
LDNS_STATUS_DANE_UNKNOWN_PROTOCOL
Definition: error.h:110
LDNS_STATUS_DANE_UNKNOWN_SELECTOR
Definition: error.h:108
LDNS_STATUS_DANE_UNKNOWN_MATCHING_TYPE
Definition: error.h:109
LDNS_STATUS_DANE_BOGUS
Definition: error.h:116
ldns.h
Including this file will include all ldns files, and define some lookup tables.
LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR
Definition: error.h:93
LDNS_STATUS_INVALID_EUI48
Definition: error.h:123
LDNS_STATUS_INVALID_TIME
Definition: error.h:45
LDNS_STATUS_WIRE_RDATA_ERR
Definition: error.h:125
LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY
Definition: error.h:59
LDNS_STATUS_NETWORK_ERR
Definition: error.h:46
LDNS_STATUS_INVALID_INT
Definition: error.h:38
LDNS_STATUS_INVALID_B64
Definition: error.h:43
ldns_lookup_by_id
ldns_lookup_table * ldns_lookup_by_id(ldns_lookup_table *table, int id)
Definition: util.c:41
LDNS_STATUS_INVALID_HEX
Definition: error.h:44
LDNS_STATUS_SYNTAX_DNAME_ERR
Definition: error.h:84
LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW
Definition: error.h:92
LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED
Definition: error.h:100
LDNS_STATUS_RES_NO_NS
Definition: error.h:70
LDNS_STATUS_FILE_ERR
Definition: error.h:48
LDNS_STATUS_INVALID_TAG
Definition: error.h:126
LDNS_STATUS_SYNTAX_BAD_ESCAPE
Definition: error.h:95
LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL
Definition: error.h:76
LDNS_STATUS_DOMAINNAME_UNDERFLOW
Definition: error.h:30
LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL
Definition: error.h:53
LDNS_STATUS_DANE_NON_CA_CERTIFICATE
Definition: error.h:118
LDNS_STATUS_SYNTAX_ORIGIN
Definition: error.h:89
LDNS_STATUS_WIRE_INCOMPLETE_ANSWER
Definition: error.h:74
LDNS_STATUS_DANE_UNKNOWN_CERTIFICATE_USAGE
Definition: error.h:107
LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR
Definition: error.h:120
LDNS_STATUS_MEM_ERR
Definition: error.h:34
ldns_struct_lookup_table::name
const char * name
Definition: util.h:158
LDNS_STATUS_EXISTS_ERR
Definition: error.h:121
ldns_status
enum ldns_enum_status ldns_status
Definition: error.h:131
LDNS_STATUS_DDD_OVERFLOW
Definition: error.h:31
ldns_struct_lookup_table
A general purpose lookup table.
Definition: util.h:156
LDNS_STATUS_RDATA_OVERFLOW
Definition: error.h:129
LDNS_STATUS_DANE_UNKNOWN_TRANSPORT
Definition: error.h:111
LDNS_STATUS_SYNTAX_ERR
Definition: error.h:97
LDNS_STATUS_SYNTAX_EMPTY
Definition: error.h:91
LDNS_STATUS_EMPTY_LABEL
Definition: error.h:27
LDNS_STATUS_CRYPTO_TSIG_ERR
Definition: error.h:65
LDNS_STATUS_DOMAINNAME_OVERFLOW
Definition: error.h:29
ldns_error_str
ldns_lookup_table ldns_error_str[]
Definition: error.c:15
LDNS_STATUS_CRYPTO_NO_DS
Definition: error.h:57
LDNS_STATUS_INVALID_STR
Definition: error.h:41
LDNS_STATUS_TYPE_NOT_IN_BITMAP
Definition: error.h:127
LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR
Definition: error.h:67
LDNS_STATUS_CRYPTO_NO_TRUSTED_DS
Definition: error.h:58
LDNS_STATUS_INVALID_B32_EXT
Definition: error.h:42
LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED_WITHIN_MARGIN
Definition: error.h:105
LDNS_STATUS_SYNTAX_ALG_ERR
Definition: error.h:86
LDNS_STATUS_WIRE_INCOMPLETE_HEADER
Definition: error.h:72
ldns_get_errorstr_by_id
const char * ldns_get_errorstr_by_id(ldns_status err)
look up a descriptive text by each error.
Definition: error.c:150
LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW
Definition: error.h:94
LDNS_STATUS_MISSING_RDATA_FIELDS_KEY
Definition: error.h:103
LDNS_STATUS_DANE_MISSING_EXTRA_CERTS
Definition: error.h:112
LDNS_STATUS_INTERNAL_ERR
Definition: error.h:35
LDNS_STATUS_SYNTAX_CLASS_ERR
Definition: error.h:80
LDNS_STATUS_PACKET_OVERFLOW
Definition: error.h:32
LDNS_STATUS_DNSSEC_EXISTENCE_DENIED
Definition: error.h:98
LDNS_STATUS_ERR
Definition: error.h:37
config.h
LDNS_STATUS_ENGINE_KEY_NOT_LOADED
Definition: error.h:68
LDNS_STATUS_DANE_EXTRA_CERTS_NOT_USED
Definition: error.h:113