1 | /* Copyright 1998 by the Massachusetts Institute of Technology. |
---|
2 | * |
---|
3 | * Permission to use, copy, modify, and distribute this |
---|
4 | * software and its documentation for any purpose and without |
---|
5 | * fee is hereby granted, provided that the above copyright |
---|
6 | * notice appear in all copies and that both that copyright |
---|
7 | * notice and this permission notice appear in supporting |
---|
8 | * documentation, and that the name of M.I.T. not be used in |
---|
9 | * advertising or publicity pertaining to distribution of the |
---|
10 | * software without specific, written prior permission. |
---|
11 | * M.I.T. makes no representations about the suitability of |
---|
12 | * this software for any purpose. It is provided "as is" |
---|
13 | * without express or implied warranty. |
---|
14 | */ |
---|
15 | |
---|
16 | static const char rcsid[] = "$Id: ares_strerror.c,v 1.1 1998-08-13 18:06:35 ghudson Exp $"; |
---|
17 | |
---|
18 | #include <assert.h> |
---|
19 | #include "ares.h" |
---|
20 | |
---|
21 | const char *ares_strerror(int code, char **memptr) |
---|
22 | { |
---|
23 | /* A future implementation may want to handle internationalization. |
---|
24 | * For now, just return a string literal from a table. |
---|
25 | */ |
---|
26 | const char *errtext[] = { |
---|
27 | "Successful completion", |
---|
28 | "DNS server returned answer with no data", |
---|
29 | "DNS server claims query was misformatted", |
---|
30 | "DNS server returned general failure", |
---|
31 | "Domain name not found", |
---|
32 | "DNS server does not implement requested operation", |
---|
33 | "DNS server refused query", |
---|
34 | "Misformatted DNS query", |
---|
35 | "Misformatted domain name", |
---|
36 | "Unsupported address family", |
---|
37 | "Misformatted DNS reply", |
---|
38 | "Could not contact DNS servers", |
---|
39 | "Timeout while contacting DNS servers", |
---|
40 | "End of file", |
---|
41 | "Error reading file", |
---|
42 | "Out of memory" |
---|
43 | }; |
---|
44 | |
---|
45 | assert(code >= 0 && code < (sizeof(errtext) / sizeof(*errtext))); |
---|
46 | return errtext[code]; |
---|
47 | } |
---|