lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | |
| 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and distribute this |
| 5 | * software and its documentation for any purpose and without |
| 6 | * fee is hereby granted, provided that the above copyright |
| 7 | * notice appear in all copies and that both that copyright |
| 8 | * notice and this permission notice appear in supporting |
| 9 | * documentation, and that the name of M.I.T. not be used in |
| 10 | * advertising or publicity pertaining to distribution of the |
| 11 | * software without specific, written prior permission. |
| 12 | * M.I.T. makes no representations about the suitability of |
| 13 | * this software for any purpose. It is provided "as is" |
| 14 | * without express or implied warranty. |
| 15 | */ |
| 16 | |
| 17 | #include "ares_setup.h" |
| 18 | #include <assert.h> |
| 19 | #include "ares.h" |
| 20 | |
| 21 | const char *ares_strerror(int code) |
| 22 | { |
| 23 | /* Return a string literal from a table. */ |
| 24 | const char *errtext[] = { |
| 25 | "Successful completion", |
| 26 | "DNS server returned answer with no data", |
| 27 | "DNS server claims query was misformatted", |
| 28 | "DNS server returned general failure", |
| 29 | "Domain name not found", |
| 30 | "DNS server does not implement requested operation", |
| 31 | "DNS server refused query", |
| 32 | "Misformatted DNS query", |
| 33 | "Misformatted domain name", |
| 34 | "Unsupported address family", |
| 35 | "Misformatted DNS reply", |
| 36 | "Could not contact DNS servers", |
| 37 | "Timeout while contacting DNS servers", |
| 38 | "End of file", |
| 39 | "Error reading file", |
| 40 | "Out of memory", |
| 41 | "Channel is being destroyed", |
| 42 | "Misformatted string", |
| 43 | "Illegal flags specified", |
| 44 | "Given hostname is not numeric", |
| 45 | "Illegal hints flags specified", |
| 46 | "c-ares library initialization not yet performed", |
| 47 | "Error loading iphlpapi.dll", |
| 48 | "Could not find GetNetworkParams function", |
| 49 | "DNS query cancelled" |
| 50 | }; |
| 51 | |
| 52 | if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) |
| 53 | return errtext[code]; |
| 54 | else |
| 55 | return "unknown"; |
| 56 | } |