Blame ares_strerror.c

Packit 514978
Packit 514978
/* Copyright 1998 by the Massachusetts Institute of Technology.
Packit 514978
 *
Packit 514978
 * Permission to use, copy, modify, and distribute this
Packit 514978
 * software and its documentation for any purpose and without
Packit 514978
 * fee is hereby granted, provided that the above copyright
Packit 514978
 * notice appear in all copies and that both that copyright
Packit 514978
 * notice and this permission notice appear in supporting
Packit 514978
 * documentation, and that the name of M.I.T. not be used in
Packit 514978
 * advertising or publicity pertaining to distribution of the
Packit 514978
 * software without specific, written prior permission.
Packit 514978
 * M.I.T. makes no representations about the suitability of
Packit 514978
 * this software for any purpose.  It is provided "as is"
Packit 514978
 * without express or implied warranty.
Packit 514978
 */
Packit 514978
Packit 514978
#include "ares_setup.h"
Packit 514978
#include <assert.h>
Packit 514978
#include "ares.h"
Packit 514978
Packit 514978
const char *ares_strerror(int code)
Packit 514978
{
Packit 514978
  /* Return a string literal from a table. */
Packit 514978
  const char *errtext[] = {
Packit 514978
    "Successful completion",
Packit 514978
    "DNS server returned answer with no data",
Packit 514978
    "DNS server claims query was misformatted",
Packit 514978
    "DNS server returned general failure",
Packit 514978
    "Domain name not found",
Packit 514978
    "DNS server does not implement requested operation",
Packit 514978
    "DNS server refused query",
Packit 514978
    "Misformatted DNS query",
Packit 514978
    "Misformatted domain name",
Packit 514978
    "Unsupported address family",
Packit 514978
    "Misformatted DNS reply",
Packit 514978
    "Could not contact DNS servers",
Packit 514978
    "Timeout while contacting DNS servers",
Packit 514978
    "End of file",
Packit 514978
    "Error reading file",
Packit 514978
    "Out of memory",
Packit 514978
    "Channel is being destroyed",
Packit 514978
    "Misformatted string",
Packit 514978
    "Illegal flags specified",
Packit 514978
    "Given hostname is not numeric",
Packit 514978
    "Illegal hints flags specified",
Packit 514978
    "c-ares library initialization not yet performed",
Packit 514978
    "Error loading iphlpapi.dll",
Packit 514978
    "Could not find GetNetworkParams function",
Packit 514978
    "DNS query cancelled"
Packit 514978
  };
Packit 514978
Packit 514978
  if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)))
Packit 514978
    return errtext[code];
Packit 514978
  else
Packit 514978
    return "unknown";
Packit 514978
}