revert between 56095 -> 55830 in arch
[AROS.git] / workbench / network / stacks / AROSTCP / dhcp / omapip / toisc.c
blobda5923e652a55281123b8678e47540d4bca25e22
1 /* toisc.c
3 Convert non-ISC result codes to ISC result codes. */
5 /*
6 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 2001-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
22 * 950 Charter Street
23 * Redwood City, CA 94063
24 * <info@isc.org>
25 * http://www.isc.org/
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
35 #include <omapip/omapip_p.h>
36 #include "arpa/nameser.h"
37 #include "minires/minires.h"
39 isc_result_t ns_rcode_to_isc (int nsr)
41 switch (nsr) {
42 case ns_r_noerror:
43 return ISC_R_SUCCESS;
45 case ns_r_formerr:
46 return ISC_R_FORMERR;
48 case ns_r_servfail:
49 return ISC_R_SERVFAIL;
51 case ns_r_nxdomain:
52 return ISC_R_NXDOMAIN;
54 case ns_r_notimpl:
55 return ISC_R_NOTIMPL;
57 case ns_r_refused:
58 return ISC_R_REFUSED;
60 case ns_r_yxdomain:
61 return ISC_R_YXDOMAIN;
63 case ns_r_yxrrset:
64 return ISC_R_YXRRSET;
66 case ns_r_nxrrset:
67 return ISC_R_NXRRSET;
69 case ns_r_notauth:
70 return ISC_R_NOTAUTH;
72 case ns_r_notzone:
73 return ISC_R_NOTZONE;
75 case ns_r_badsig:
76 return ISC_R_BADSIG;
78 case ns_r_badkey:
79 return ISC_R_BADKEY;
81 case ns_r_badtime:
82 return ISC_R_BADTIME;
84 default:
87 return ISC_R_UNEXPECTED;
90 isc_result_t uerr2isc (int err)
92 switch (err) {
93 case EPERM:
94 return ISC_R_NOPERM;
96 case ENOENT:
97 return ISC_R_NOTFOUND;
99 case ESRCH:
100 return ISC_R_NOTFOUND;
102 case EIO:
103 return ISC_R_IOERROR;
105 case ENXIO:
106 return ISC_R_NOTFOUND;
108 case E2BIG:
109 return ISC_R_NOSPACE;
111 case ENOEXEC:
112 return ISC_R_FORMERR;
114 case ECHILD:
115 return ISC_R_NOTFOUND;
117 case ENOMEM:
118 return ISC_R_NOMEMORY;
120 case EACCES:
121 return ISC_R_NOPERM;
123 case EFAULT:
124 return ISC_R_INVALIDARG;
126 case EEXIST:
127 return ISC_R_EXISTS;
129 case EINVAL:
130 return ISC_R_INVALIDARG;
132 case ENOTTY:
133 return ISC_R_INVALIDARG;
135 case EFBIG:
136 return ISC_R_NOSPACE;
138 case ENOSPC:
139 return ISC_R_NOSPACE;
141 case EROFS:
142 return ISC_R_NOPERM;
144 case EMLINK:
145 return ISC_R_NOSPACE;
147 case EPIPE:
148 return ISC_R_NOTCONNECTED;
150 case EINPROGRESS:
151 return ISC_R_ALREADYRUNNING;
153 case EALREADY:
154 return ISC_R_ALREADYRUNNING;
156 case ENOTSOCK:
157 return ISC_R_INVALIDFILE;
159 case EDESTADDRREQ:
160 return ISC_R_DESTADDRREQ;
162 case EMSGSIZE:
163 return ISC_R_NOSPACE;
165 case EPROTOTYPE:
166 return ISC_R_INVALIDARG;
168 case ENOPROTOOPT:
169 return ISC_R_NOTIMPLEMENTED;
171 case EPROTONOSUPPORT:
172 return ISC_R_NOTIMPLEMENTED;
174 case ESOCKTNOSUPPORT:
175 return ISC_R_NOTIMPLEMENTED;
177 case EOPNOTSUPP:
178 return ISC_R_NOTIMPLEMENTED;
180 case EPFNOSUPPORT:
181 return ISC_R_NOTIMPLEMENTED;
183 case EAFNOSUPPORT:
184 return ISC_R_NOTIMPLEMENTED;
186 case EADDRINUSE:
187 return ISC_R_ADDRINUSE;
189 case EADDRNOTAVAIL:
190 return ISC_R_ADDRNOTAVAIL;
192 case ENETDOWN:
193 return ISC_R_NETDOWN;
195 case ENETUNREACH:
196 return ISC_R_NETUNREACH;
198 case ECONNABORTED:
199 return ISC_R_TIMEDOUT;
201 case ECONNRESET:
202 return ISC_R_CONNRESET;
204 case ENOBUFS:
205 return ISC_R_NOSPACE;
207 case EISCONN:
208 return ISC_R_ALREADYRUNNING;
210 case ENOTCONN:
211 return ISC_R_NOTCONNECTED;
213 case ESHUTDOWN:
214 return ISC_R_SHUTTINGDOWN;
216 case ETIMEDOUT:
217 return ISC_R_TIMEDOUT;
219 case ECONNREFUSED:
220 return ISC_R_CONNREFUSED;
222 case EHOSTDOWN:
223 return ISC_R_HOSTDOWN;
225 case EHOSTUNREACH:
226 return ISC_R_HOSTUNREACH;
228 #ifdef EDQUOT
229 case EDQUOT:
230 return ISC_R_QUOTA;
231 #endif
233 #ifdef EBADRPC
234 case EBADRPC:
235 return ISC_R_NOTIMPLEMENTED;
236 #endif
238 #ifdef ERPCMISMATCH
239 case ERPCMISMATCH:
240 return ISC_R_VERSIONMISMATCH;
241 #endif
243 #ifdef EPROGMISMATCH
244 case EPROGMISMATCH:
245 return ISC_R_VERSIONMISMATCH;
246 #endif
248 #ifdef EAUTH
249 case EAUTH:
250 return ISC_R_NOTAUTH;
251 #endif
253 #ifdef ENEEDAUTH
254 case ENEEDAUTH:
255 return ISC_R_NOTAUTH;
256 #endif
258 #ifdef EOVERFLOW
259 case EOVERFLOW:
260 return ISC_R_NOSPACE;
261 #endif
263 return ISC_R_UNEXPECTED;
266 ns_rcode isc_rcode_to_ns (isc_result_t isc)
268 switch (isc) {
269 case ISC_R_SUCCESS:
270 return ns_r_noerror;
272 case ISC_R_FORMERR:
273 return ns_r_formerr;
275 case ISC_R_SERVFAIL:
276 return ns_r_servfail;
278 case ISC_R_NXDOMAIN:
279 return ns_r_nxdomain;
281 case ISC_R_NOTIMPL:
282 return ns_r_notimpl;
284 case ISC_R_REFUSED:
285 return ns_r_refused;
287 case ISC_R_YXDOMAIN:
288 return ns_r_yxdomain;
290 case ISC_R_YXRRSET:
291 return ns_r_yxrrset;
293 case ISC_R_NXRRSET:
294 return ns_r_nxrrset;
296 case ISC_R_NOTAUTH:
297 return ns_r_notauth;
299 case ISC_R_NOTZONE:
300 return ns_r_notzone;
302 case ISC_R_BADSIG:
303 return ns_r_badsig;
305 case ISC_R_BADKEY:
306 return ns_r_badkey;
308 case ISC_R_BADTIME:
309 return ns_r_badtime;
311 default:
314 return ns_r_servfail;