1 /*
2   Error codes for Linux DNS client library implementation
3 
4   Copyright (C) 2006 Krishna Ganugapati <krishnag@centeris.com>
5   Copyright (C) 2006 Gerald Carter <jerry@samba.org>
6 
7      ** NOTE! The following LGPL license applies to the libaddns
8      ** library. This does NOT imply that all of Samba is released
9      ** under the LGPL
10 
11   This library is free software; you can redistribute it and/or
12   modify it under the terms of the GNU Lesser General Public
13   License as published by the Free Software Foundation; either
14   version 2.1 of the License, or (at your option) any later version.
15 
16   This library is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19   Lesser General Public License for more details.
20 
21   You should have received a copy of the GNU Lesser General Public
22   License along with this library; if not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 #ifndef _DNSERR_H
26 #define _DNSERR_H
27 
28 
29 /* The Splint code analysis tool (http://www.splint.org.) doesn't
30    like immediate structures. */
31 
32 #ifdef _SPLINT_
33 #undef HAVE_IMMEDIATE_STRUCTURES
34 #endif
35 
36 /* Setup the DNS_ERROR typedef.  Technique takes from nt_status.h */
37 
38 #if defined(HAVE_IMMEDIATE_STRUCTURES)
39 typedef struct {uint32_t v;} DNS_ERROR;
40 #define ERROR_DNS(x) ((DNS_ERROR) { x })
41 #define ERROR_DNS_V(x) ((x).v)
42 #else
43 typedef uint32_t DNS_ERROR;
44 #define ERROR_DNS(x) (x)
45 #define ERROR_DNS_V(x) (x)
46 #endif
47 
48 #define ERR_DNS_IS_OK(x)   (ERROR_DNS_V(x) == 0)
49 #define ERR_DNS_EQUAL(x,y) (ERROR_DNS_V(x) == ERROR_DNS_V(y))
50 
51 /*************************************************
52  * Define the error codes here
53  *************************************************/
54 
55 #define ERROR_DNS_SUCCESS		ERROR_DNS(0)
56 #define ERROR_DNS_RECORD_NOT_FOUND	ERROR_DNS(1)
57 #define ERROR_DNS_BAD_RESPONSE		ERROR_DNS(2)
58 #define ERROR_DNS_INVALID_PARAMETER	ERROR_DNS(3)
59 #define ERROR_DNS_NO_MEMORY		ERROR_DNS(4)
60 #define ERROR_DNS_INVALID_NAME_SERVER	ERROR_DNS(5)
61 #define ERROR_DNS_CONNECTION_FAILED	ERROR_DNS(6)
62 #define ERROR_DNS_GSS_ERROR		ERROR_DNS(7)
63 #define ERROR_DNS_INVALID_NAME		ERROR_DNS(8)
64 #define ERROR_DNS_INVALID_MESSAGE	ERROR_DNS(9)
65 #define ERROR_DNS_SOCKET_ERROR		ERROR_DNS(10)
66 #define ERROR_DNS_UPDATE_FAILED		ERROR_DNS(11)
67 
68 /*
69  * About to be removed, transitional error
70  */
71 #define ERROR_DNS_UNSUCCESSFUL		ERROR_DNS(999)
72 
73 
74 #define ERROR_BAD_RESPONSE		1
75 #define ERROR_RECORD_NOT_FOUND		2
76 #define ERROR_OUTOFMEMORY		8
77 #if !defined(ERROR_INVALID_PARAMETER)
78 #define ERROR_INVALID_PARAMETER         87
79 #endif
80 
81 /*
82  * About to be removed, transitional error
83  */
84 #define ERROR_UNSUCCESSFUL 999
85 
86 #endif	/* _DNSERR_H */
87 
88