source: vendor/current/lib/addns/error.c

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 2.0 KB
Line 
1/*
2 Linux DNS client library implementation
3 Copyright (C) 2010 Guenther Deschner
4
5 ** NOTE! The following LGPL license applies to the libaddns
6 ** library. This does NOT imply that all of Samba is released
7 ** under the LGPL
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include "dns.h"
24#include "dnserr.h"
25
26typedef struct {
27 const char *dns_errstr;
28 DNS_ERROR dns_errcode;
29} dns_err_code_struct;
30
31static const dns_err_code_struct dns_errs[] =
32{
33 { "ERROR_DNS_SUCCESS", ERROR_DNS_SUCCESS },
34 { "ERROR_DNS_RECORD_NOT_FOUND", ERROR_DNS_RECORD_NOT_FOUND },
35 { "ERROR_DNS_BAD_RESPONSE", ERROR_DNS_BAD_RESPONSE },
36 { "ERROR_DNS_INVALID_PARAMETER", ERROR_DNS_INVALID_PARAMETER },
37 { "ERROR_DNS_NO_MEMORY", ERROR_DNS_NO_MEMORY },
38 { "ERROR_DNS_INVALID_NAME_SERVER", ERROR_DNS_INVALID_NAME_SERVER },
39 { "ERROR_DNS_CONNECTION_FAILED", ERROR_DNS_CONNECTION_FAILED },
40 { "ERROR_DNS_GSS_ERROR", ERROR_DNS_GSS_ERROR },
41 { "ERROR_DNS_INVALID_NAME", ERROR_DNS_INVALID_NAME },
42 { "ERROR_DNS_INVALID_MESSAGE", ERROR_DNS_INVALID_MESSAGE },
43 { "ERROR_DNS_SOCKET_ERROR", ERROR_DNS_SOCKET_ERROR },
44 { "ERROR_DNS_UPDATE_FAILED", ERROR_DNS_UPDATE_FAILED },
45 { NULL, ERROR_DNS_SUCCESS },
46};
47
48const char *dns_errstr(DNS_ERROR err)
49{
50 int i;
51
52 for (i=0; dns_errs[i].dns_errstr != NULL; i++) {
53 if (ERR_DNS_EQUAL(err, dns_errs[i].dns_errcode)) {
54 return dns_errs[i].dns_errstr;
55 }
56 }
57
58 return NULL;
59}
Note: See TracBrowser for help on using the repository browser.