result.c revision a21c415687a855f84fbf10db91671b1341e8b990
/*
* Copyright (C) 2004, 2005, 2007, 2008, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*! \file */
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <isc/resultclass.h>
typedef struct resulttable {
unsigned int base;
unsigned int last;
const char ** text;
int set;
} resulttable;
static const char *description[ISC_R_NRESULTS] = {
"success", /*%< 0 */
"out of memory", /*%< 1 */
"timed out", /*%< 2 */
"no available threads", /*%< 3 */
"address not available", /*%< 4 */
"address in use", /*%< 5 */
"permission denied", /*%< 6 */
"no pending connections", /*%< 7 */
"network unreachable", /*%< 8 */
"host unreachable", /*%< 9 */
"network down", /*%< 10 */
"host down", /*%< 11 */
"connection refused", /*%< 12 */
"not enough free resources", /*%< 13 */
"end of file", /*%< 14 */
"socket already bound", /*%< 15 */
"reload", /*%< 16 */
"lock busy", /*%< 17 */
"already exists", /*%< 18 */
"ran out of space", /*%< 19 */
"operation canceled", /*%< 20 */
"socket is not bound", /*%< 21 */
"shutting down", /*%< 22 */
"not found", /*%< 23 */
"unexpected end of input", /*%< 24 */
"failure", /*%< 25 */
"I/O error", /*%< 26 */
"not implemented", /*%< 27 */
"unbalanced parentheses", /*%< 28 */
"no more", /*%< 29 */
"invalid file", /*%< 30 */
"bad base64 encoding", /*%< 31 */
"unexpected token", /*%< 32 */
"quota reached", /*%< 33 */
"unexpected error", /*%< 34 */
"already running", /*%< 35 */
"ignore", /*%< 36 */
"address mask not contiguous", /*%< 37 */
"file not found", /*%< 38 */
"file already exists", /*%< 39 */
"socket is not connected", /*%< 40 */
"out of range", /*%< 41 */
"out of entropy", /*%< 42 */
"invalid use of multicast address", /*%< 43 */
"not a file", /*%< 44 */
"not a directory", /*%< 45 */
"queue is full", /*%< 46 */
"address family mismatch", /*%< 47 */
"address family not supported", /*%< 48 */
"bad hex encoding", /*%< 49 */
"too many open files", /*%< 50 */
"not blocking", /*%< 51 */
"unbalanced quotes", /*%< 52 */
"operation in progress", /*%< 53 */
"connection reset", /*%< 54 */
"soft quota reached", /*%< 55 */
"not a valid number", /*%< 56 */
"disabled", /*%< 57 */
"max size", /*%< 58 */
"invalid address format", /*%< 59 */
"bad base32 encoding", /*%< 60 */
"unset", /*%< 61 */
"multiple", /*%< 62 */
"would block", /*%< 63 */
};
static const char *identifier[ISC_R_NRESULTS] = {
"ISC_R_SUCCESS",
"ISC_R_NOMEMORY",
"ISC_R_TIMEDOUT",
"ISC_R_NOTHREADS",
"ISC_R_ADDRNOTAVAIL",
"ISC_R_ADDRINUSE",
"ISC_R_NOPERM",
"ISC_R_NOCONN",
"ISC_R_NETUNREACH",
"ISC_R_HOSTUNREACH",
"ISC_R_NETDOWN",
"ISC_R_HOSTDOWN",
"ISC_R_CONNREFUSED",
"ISC_R_NORESOURCES",
"ISC_R_EOF",
"ISC_R_BOUND",
"ISC_R_RELOAD",
"ISC_R_LOCKBUSY",
"ISC_R_EXISTS",
"ISC_R_NOSPACE",
"ISC_R_CANCELED",
"ISC_R_NOTBOUND",
"ISC_R_SHUTTINGDOWN",
"ISC_R_NOTFOUND",
"ISC_R_UNEXPECTEDEND",
"ISC_R_FAILURE",
"ISC_R_IOERROR",
"ISC_R_NOTIMPLEMENTED",
"ISC_R_UNBALANCED",
"ISC_R_NOMORE",
"ISC_R_INVALIDFILE",
"ISC_R_BADBASE64",
"ISC_R_UNEXPECTEDTOKEN",
"ISC_R_QUOTA",
"ISC_R_UNEXPECTED",
"ISC_R_ALREADYRUNNING",
"ISC_R_IGNORE",
"ISC_R_MASKNONCONTIG",
"ISC_R_FILENOTFOUND",
"ISC_R_FILEEXISTS",
"ISC_R_NOTCONNECTED",
"ISC_R_RANGE",
"ISC_R_NOENTROPY",
"ISC_R_MULTICAST",
"ISC_R_NOTFILE",
"ISC_R_NOTDIRECTORY",
"ISC_R_QUEUEFULL",
"ISC_R_FAMILYMISMATCH",
"ISC_R_FAMILYNOSUPPORT",
"ISC_R_BADHEX",
"ISC_R_TOOMANYOPENFILES",
"ISC_R_NOTBLOCKING",
"ISC_R_UNBALANCEDQUOTES",
"ISC_R_INPROGRESS",
"ISC_R_CONNECTIONRESET",
"ISC_R_SOFTQUOTA",
"ISC_R_BADNUMBER",
"ISC_R_DISABLED",
"ISC_R_MAXSIZE",
"ISC_R_BADADDRESSFORM",
"ISC_R_BADBASE32",
"ISC_R_UNSET",
"ISC_R_MULTIPLE",
"ISC_R_WOULDBLOCK",
};
#define ISC_RESULT_RESULTSET 2
#define ISC_RESULT_UNAVAILABLESET 3
static resulttable_list_t description_tables;
static resulttable_list_t identifier_tables;
static isc_mutex_t lock;
static isc_result_t
{
/*
* We use malloc() here because we we want to be able to use
* isc_result_totext() even if there is no memory context.
*/
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
}
static void
initialize_action(void) {
if (result != ISC_R_SUCCESS)
"register_table() %s: %u",
ISC_MSG_FAILED, "failed"),
result);
if (result != ISC_R_SUCCESS)
"register_table() %s: %u",
ISC_MSG_FAILED, "failed"),
result);
}
static void
initialize(void) {
}
static const char *
const char *text, *default_text;
int index;
initialize();
/*
* Note: we use 'index + 1' as the message number
* instead of index because isc_msgcat_get() requires
* the message number to be > 0.
*/
break;
}
}
1, "(result code text not available)");
return (text);
}
const char *
}
const char *
}
{
initialize();
}
{
initialize();
}