Initial vendor import of ldns-1.6.4 into contrib.
[dragonfly.git] / contrib / ldns / ldns / error.h
1 /**
2  * \file error.h
3  *
4  * Defines error numbers and functions to translate those to a readable string.
5  *
6  */
7  
8 /**
9  * a Net::DNS like library for C
10  *
11  * (c) NLnet Labs, 2005-2006
12  *
13  * See the file LICENSE for the license
14  */
15
16 #ifndef LDNS_ERROR_H
17 #define LDNS_ERROR_H
18
19 #include <ldns/util.h>
20
21 enum ldns_enum_status {
22         LDNS_STATUS_OK, 
23         LDNS_STATUS_EMPTY_LABEL,
24         LDNS_STATUS_LABEL_OVERFLOW,
25         LDNS_STATUS_DOMAINNAME_OVERFLOW,
26         LDNS_STATUS_DOMAINNAME_UNDERFLOW,
27         LDNS_STATUS_DDD_OVERFLOW,
28         LDNS_STATUS_PACKET_OVERFLOW,
29         LDNS_STATUS_INVALID_POINTER,
30         LDNS_STATUS_MEM_ERR,
31         LDNS_STATUS_INTERNAL_ERR,
32         LDNS_STATUS_SSL_ERR,
33         LDNS_STATUS_ERR,
34         LDNS_STATUS_INVALID_INT,
35         LDNS_STATUS_INVALID_IP4,
36         LDNS_STATUS_INVALID_IP6,
37         LDNS_STATUS_INVALID_STR,
38         LDNS_STATUS_INVALID_B32_EXT,
39         LDNS_STATUS_INVALID_B64,
40         LDNS_STATUS_INVALID_HEX,
41         LDNS_STATUS_INVALID_TIME,
42         LDNS_STATUS_NETWORK_ERR,
43         LDNS_STATUS_ADDRESS_ERR,
44         LDNS_STATUS_FILE_ERR,
45         LDNS_STATUS_UNKNOWN_INET,
46         LDNS_STATUS_NOT_IMPL,
47         LDNS_STATUS_NULL,
48         LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, 
49         LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL,       
50         LDNS_STATUS_CRYPTO_NO_RRSIG,
51         LDNS_STATUS_CRYPTO_NO_DNSKEY,
52         LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY,
53         LDNS_STATUS_CRYPTO_NO_DS,
54         LDNS_STATUS_CRYPTO_NO_TRUSTED_DS,
55         LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY,
56         LDNS_STATUS_CRYPTO_VALIDATED,
57         LDNS_STATUS_CRYPTO_BOGUS,
58         LDNS_STATUS_CRYPTO_SIG_EXPIRED,
59         LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED,
60         LDNS_STATUS_CRYPTO_TSIG_BOGUS,
61         LDNS_STATUS_CRYPTO_TSIG_ERR,
62         LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION,
63         LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR,
64         LDNS_STATUS_ENGINE_KEY_NOT_LOADED,
65         LDNS_STATUS_NSEC3_ERR,
66         LDNS_STATUS_RES_NO_NS,
67         LDNS_STATUS_RES_QUERY,
68         LDNS_STATUS_WIRE_INCOMPLETE_HEADER,
69         LDNS_STATUS_WIRE_INCOMPLETE_QUESTION,
70         LDNS_STATUS_WIRE_INCOMPLETE_ANSWER,
71         LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY,
72         LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL,
73         LDNS_STATUS_NO_DATA,
74         LDNS_STATUS_CERT_BAD_ALGORITHM,
75         LDNS_STATUS_SYNTAX_TYPE_ERR,
76         LDNS_STATUS_SYNTAX_CLASS_ERR,
77         LDNS_STATUS_SYNTAX_TTL_ERR,
78         LDNS_STATUS_SYNTAX_RDATA_ERR,
79         LDNS_STATUS_SYNTAX_DNAME_ERR,
80         LDNS_STATUS_SYNTAX_VERSION_ERR,
81         LDNS_STATUS_SYNTAX_ALG_ERR,
82         LDNS_STATUS_SYNTAX_KEYWORD_ERR,
83         LDNS_STATUS_SYNTAX_TTL,
84         LDNS_STATUS_SYNTAX_ORIGIN,
85         LDNS_STATUS_SYNTAX_EMPTY,
86         LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW,
87         LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR,
88         LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW,
89         LDNS_STATUS_SYNTAX_BAD_ESCAPE,
90         LDNS_STATUS_SOCKET_ERROR,
91         LDNS_STATUS_SYNTAX_ERR,
92         LDNS_STATUS_DNSSEC_EXISTENCE_DENIED,
93         LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED,
94         LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED,
95         LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND
96 };
97 typedef enum ldns_enum_status ldns_status;
98
99 extern ldns_lookup_table ldns_error_str[];
100
101 /**
102  * look up a descriptive text by each error. This function
103  * could use a better name
104  * \param[in] err ldns_status number
105  * \return the string for that error
106  */
107 const char *ldns_get_errorstr_by_id(ldns_status err);
108
109 #endif /* LDNS_ERROR_H */