0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1998-2001, 2003-2005, 2007, 2008, 2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_SUCCESS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOMEMORY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_TIMEDOUT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTHREADS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_ADDRNOTAVAIL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_ADDRINUSE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOPERM",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOCONN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NETUNREACH",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_HOSTUNREACH",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NETDOWN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_HOSTDOWN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_CONNREFUSED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NORESOURCES",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_EOF",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_BOUND",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_RELOAD",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_LOCKBUSY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_EXISTS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOSPACE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_CANCELED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTBOUND",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_SHUTTINGDOWN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTFOUND",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_UNEXPECTEDEND",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_FAILURE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_IOERROR",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTIMPLEMENTED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_UNBALANCED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOMORE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_INVALIDFILE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_BADBASE64",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_UNEXPECTEDTOKEN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_QUOTA",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_UNEXPECTED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_ALREADYRUNNING",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_IGNORE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_MASKNONCONTIG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_FILENOTFOUND",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_FILEEXISTS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTCONNECTED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_RANGE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOENTROPY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_MULTICAST",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTFILE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTDIRECTORY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_QUEUEFULL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_FAMILYMISMATCH",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_FAMILYNOSUPPORT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_BADHEX",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_TOOMANYOPENFILES",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_NOTBLOCKING",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_UNBALANCEDQUOTES",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_INPROGRESS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_CONNECTIONRESET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_SOFTQUOTA",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_BADNUMBER",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_DISABLED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_MAXSIZE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_BADADDRESSFORM",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_BADBASE32",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_UNSET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "ISC_R_MULTIPLE",
a21c415687a855f84fbf10db91671b1341e8b990Mark Andrews "ISC_R_WOULDBLOCK",
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntregister_table(resulttable_list_t *tables, unsigned int base,
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley * We use malloc() here because we we want to be able to use
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley * isc_result_totext() even if there is no memory context.
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
9cd6d409b78a6f833b681c13a68fbdc7c024fe66David Lawrence "register_table() %s: %u",
9cd6d409b78a6f833b681c13a68fbdc7c024fe66David Lawrence isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "register_table() %s: %u",
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntstatic const char *
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntisc_result_tomany_helper(resulttable_list_t *tables, isc_result_t result) {
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley if (result >= table->base && result <= table->last) {
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley * Note: we use 'index + 1' as the message number
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley * instead of index because isc_msgcat_get() requires
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley * the message number to be > 0.
5804af97ab0875fafd233f486aa1c1899ed5c00aBob Halley text = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt return (isc_result_tomany_helper(&description_tables, result));
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt return (isc_result_tomany_helper(&identifier_tables, result));
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrenceisc_result_register(unsigned int base, unsigned int nresults,
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrence const char **text, isc_msgcat_t *msgcat, int set)
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt return (register_table(&description_tables, base, nresults, text,
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntisc_result_registerids(unsigned int base, unsigned int nresults,