c46a9831ccc318ebc8ebcb07e4c97d4813e07b26
[sfrench/samba-autobuild/.git] / source / libaddns / dnserr.h
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, write to the Free Software
23   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
24   02110-1301  USA
25 */
26
27 #ifndef _DNSERR_H
28 #define _DNSERR_H
29
30
31 /* The Splint code analysis tool (http://www.splint.org.) doesn't 
32    like immediate structures. */
33    
34 #ifdef _SPLINT_
35 #undef HAVE_IMMEDIATE_STRUCTURES
36 #endif
37
38 /* Setup the DNS_ERROR typedef.  Technique takes from nt_status.h */
39
40 #if defined(HAVE_IMMEDIATE_STRUCTURES)
41 typedef struct {uint32 v;} DNS_ERROR;
42 #define ERROR_DNS(x) ((DNS_ERROR) { x })
43 #define ERROR_DNS_V(x) ((x).v)
44 #else
45 typedef uint32 DNS_ERROR;
46 #define ERROR_DNS(x) (x)
47 #define ERROR_DNS_V(x) (x)
48 #endif
49
50 #define ERR_DNS_IS_OK(x)   (ERROR_DNS_V(x) == 0)
51 #define ERR_DNS_EQUAL(x,y) (ERROR_DNS_V(x) == ERROR_DNS_V(y))
52
53 /*************************************************
54  * Define the error codes here
55  *************************************************/
56
57 #define ERROR_DNS_SUCCESS               ERROR_DNS(0) 
58 #define ERROR_DNS_RECORD_NOT_FOUND      ERROR_DNS(1)
59 #define ERROR_DNS_BAD_RESPONSE          ERROR_DNS(2)
60 #define ERROR_DNS_INVALID_PARAMETER     ERROR_DNS(3)
61 #define ERROR_DNS_NO_MEMORY             ERROR_DNS(4)
62 #define ERROR_DNS_INVALID_NAME_SERVER   ERROR_DNS(5)
63 #define ERROR_DNS_CONNECTION_FAILED     ERROR_DNS(6)
64 #define ERROR_DNS_GSS_ERROR             ERROR_DNS(7)
65 #define ERROR_DNS_INVALID_NAME          ERROR_DNS(8)
66 #define ERROR_DNS_INVALID_MESSAGE       ERROR_DNS(9)
67 #define ERROR_DNS_SOCKET_ERROR          ERROR_DNS(10)
68 #define ERROR_DNS_UPDATE_FAILED         ERROR_DNS(11)
69
70 /*
71  * About to be removed, transitional error
72  */
73 #define ERROR_DNS_UNSUCCESSFUL          ERROR_DNS(999)
74
75
76 #define ERROR_BAD_RESPONSE              1
77 #define ERROR_RECORD_NOT_FOUND          2
78 #define ERROR_OUTOFMEMORY               8
79 #if !defined(ERROR_INVALID_PARAMETER)
80 #define ERROR_INVALID_PARAMETER         87
81 #endif
82
83 /*
84  * About to be removed, transitional error
85  */
86 #define ERROR_UNSUCCESSFUL 999
87
88 #endif  /* _DNSERR_H */
89