result.h revision 9e804040a29b9c3066c8471b43835f30707039b7
1633838b8255282d10af15c5c84cee5a51466712Bob Halley/*
79bb5099368af0e02734e5c59f53286114fe959eTinderbox User * Copyright (C) 2004-2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * Permission to use, copy, modify, and/or distribute this software for any
1633838b8255282d10af15c5c84cee5a51466712Bob Halley * purpose with or without fee is hereby granted, provided that the above
1633838b8255282d10af15c5c84cee5a51466712Bob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
1633838b8255282d10af15c5c84cee5a51466712Bob Halley */
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews/* $Id$ */
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley#ifndef ISC_RESULT_H
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley#define ISC_RESULT_H 1
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews/*! \file isc/result.h */
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews
7aacbd685b2107670e4179689abec9cb82d972abBob Halley#include <isc/lang.h>
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley#include <isc/types.h>
7aacbd685b2107670e4179689abec9cb82d972abBob Halley
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_SUCCESS 0 /*%< success */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOMEMORY 1 /*%< out of memory */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_TIMEDOUT 2 /*%< timed out */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTHREADS 3 /*%< no available threads */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_ADDRNOTAVAIL 4 /*%< address not available */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_ADDRINUSE 5 /*%< address in use */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOPERM 6 /*%< permission denied */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOCONN 7 /*%< no pending connections */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NETUNREACH 8 /*%< network unreachable */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_HOSTUNREACH 9 /*%< host unreachable */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NETDOWN 10 /*%< network down */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_HOSTDOWN 11 /*%< host down */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_CONNREFUSED 12 /*%< connection refused */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NORESOURCES 13 /*%< not enough free resources */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_EOF 14 /*%< end of file */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_BOUND 15 /*%< socket already bound */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_RELOAD 16 /*%< reload */
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉#define ISC_R_SUSPEND ISC_R_RELOAD /*%< alias of 'reload' */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_LOCKBUSY 17 /*%< lock busy */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_EXISTS 18 /*%< already exists */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOSPACE 19 /*%< ran out of space */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_CANCELED 20 /*%< operation canceled */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTBOUND 21 /*%< socket is not bound */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_SHUTTINGDOWN 22 /*%< shutting down */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTFOUND 23 /*%< not found */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_UNEXPECTEDEND 24 /*%< unexpected end of input */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_FAILURE 25 /*%< generic failure */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_IOERROR 26 /*%< I/O error */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTIMPLEMENTED 27 /*%< not implemented */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_UNBALANCED 28 /*%< unbalanced parentheses */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOMORE 29 /*%< no more */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_INVALIDFILE 30 /*%< invalid file */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_BADBASE64 31 /*%< bad base64 encoding */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_UNEXPECTEDTOKEN 32 /*%< unexpected token */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_QUOTA 33 /*%< quota reached */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_UNEXPECTED 34 /*%< unexpected error */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_ALREADYRUNNING 35 /*%< already running */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_IGNORE 36 /*%< ignore */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_MASKNONCONTIG 37 /*%< addr mask not contiguous */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_FILENOTFOUND 38 /*%< file not found */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_FILEEXISTS 39 /*%< file already exists */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTCONNECTED 40 /*%< socket is not connected */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_RANGE 41 /*%< out of range */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOENTROPY 42 /*%< out of entropy */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_MULTICAST 43 /*%< invalid use of multicast */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTFILE 44 /*%< not a file */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTDIRECTORY 45 /*%< not a directory */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_QUEUEFULL 46 /*%< queue is full */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_FAMILYMISMATCH 47 /*%< address family mismatch */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_FAMILYNOSUPPORT 48 /*%< AF not supported */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_BADHEX 49 /*%< bad hex encoding */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_TOOMANYOPENFILES 50 /*%< too many open files */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_NOTBLOCKING 51 /*%< not blocking */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_UNBALANCEDQUOTES 52 /*%< unbalanced quotes */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_INPROGRESS 53 /*%< operation in progress */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_CONNECTIONRESET 54 /*%< connection reset */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_SOFTQUOTA 55 /*%< soft quota reached */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_BADNUMBER 56 /*%< not a valid number */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_DISABLED 57 /*%< disabled */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_MAXSIZE 58 /*%< max size */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define ISC_R_BADADDRESSFORM 59 /*%< invalid address format */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define ISC_R_BADBASE32 60 /*%< bad base32 encoding */
1bb3831e13a65afd87078c88e0285d23b1e0bcdfMark Andrews#define ISC_R_UNSET 61 /*%< unset */
c38341ec435fb78de6d12c1001201f9ac7487b68Mark Andrews#define ISC_R_MULTIPLE 62 /*%< multiple */
19872fdfb75357354a83b74932f661d4b0b6e4ddAndreas Gustafsson
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*% Not a result code: the number of results. */
c38341ec435fb78de6d12c1001201f9ac7487b68Mark Andrews#define ISC_R_NRESULTS 63
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David LawrenceISC_LANG_BEGINDECLS
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David Lawrence
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrenceconst char *
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David Lawrenceisc_result_totext(isc_result_t);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David Lawrence * Convert an isc_result_t into a string message describing the result.
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David Lawrence */
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David Lawrence
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntconst char *
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntisc_result_toid(isc_result_t);
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt/*%<
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * Convert an isc_result_t into a string identifier such as
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * "ISC_R_SUCCESS".
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt
0c33e418cb443ade8ed55f5433bc4d409c7af0b8David Lawrenceisc_result_t
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrenceisc_result_register(unsigned int base, unsigned int nresults,
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrence const char **text, isc_msgcat_t *msgcat, int set);
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntisc_result_t
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntisc_result_registerids(unsigned int base, unsigned int nresults,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt const char **ids, isc_msgcat_t *msgcat, int set);
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt
7aacbd685b2107670e4179689abec9cb82d972abBob HalleyISC_LANG_ENDDECLS
7aacbd685b2107670e4179689abec9cb82d972abBob Halley
fda0ab6a96a7edb1acbde0c77ead0542979b0f24Bob Halley#endif /* ISC_RESULT_H */