result.c revision d6b0e99380789096d79fe4e00042b78f9207fe14
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence/*
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence * Copyright (C) 1998, 1999 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence * Permission to use, copy, modify, and distribute this software for any
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence * purpose with or without fee is hereby granted, provided that the above
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15a44745412679c30a6d022733925af70a38b715David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15a44745412679c30a6d022733925af70a38b715David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15a44745412679c30a6d022733925af70a38b715David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
15a44745412679c30a6d022733925af70a38b715David Lawrence * SOFTWARE.
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#include <config.h>
cb4a97bb1c84fcab089136f0a4686ab5fea6a07cDavid Lawrence
cb4a97bb1c84fcab089136f0a4686ab5fea6a07cDavid Lawrence#include <isc/result.h>
cb4a97bb1c84fcab089136f0a4686ab5fea6a07cDavid Lawrence
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrencestatic char *text_table[ISC_R_LASTENTRY + 1] = {
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "success", /* 0 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "out of memory", /* 1 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "timed out", /* 2 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "no available threads", /* 3 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "address not available", /* 4 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "address in use", /* 5 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "permission denied", /* 6 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "no pending connections", /* 7 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "network unreachable", /* 8 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "host unreachable", /* 9 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "network down", /* 10 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "host down", /* 11 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "connection refused", /* 12 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "not enough free resources", /* 13 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "end of file", /* 14 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "socket already bound", /* 15 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "task is done", /* 16 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "lock busy", /* 17 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "already exists", /* 18 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "ran out of space", /* 19 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "operation canceled", /* 20 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "sending events is not allowed", /* 21 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "task is shutting down", /* 22 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "not found", /* 23 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "unexpected end of input", /* 24 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "failure", /* 25 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "I/O error", /* 26 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "not implemented", /* 27 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "unbalanced parentheses", /* 28 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence "no more", /* 29 */
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence};
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrencechar *
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrenceisc_result_totext(isc_result_t result) {
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence if (result == ISC_R_UNEXPECTED)
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence return ("unexpected error");
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence if (result > ISC_R_LASTENTRY)
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence return ("unknown result code");
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence return (text_table[result]);
0c73b546ecfa49b9d1c8fdb9a48d4cd62176124aDavid Lawrence}