1 /* $NetBSD: error.h,v 1.4 2014/12/10 04:38:00 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 1998-2001 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* Id: error.h,v 1.22 2009/09/29 23:48:04 tbox Exp */ 21 22 #ifndef ISC_ERROR_H 23 #define ISC_ERROR_H 1 24 25 /*! \file isc/error.h */ 26 27 #include <stdarg.h> 28 29 #include <isc/formatcheck.h> 30 #include <isc/lang.h> 31 #include <isc/platform.h> 32 33 ISC_LANG_BEGINDECLS 34 35 typedef void (*isc_errorcallback_t)(const char *, int, const char *, va_list); 36 37 /*% set unexpected error */ 38 void 39 isc_error_setunexpected(isc_errorcallback_t); 40 41 /*% set fatal error */ 42 void 43 isc_error_setfatal(isc_errorcallback_t); 44 45 /*% unexpected error */ 46 void 47 isc_error_unexpected(const char *, int, const char *, ...) 48 ISC_FORMAT_PRINTF(3, 4); 49 50 /*% fatal error */ 51 ISC_PLATFORM_NORETURN_PRE void 52 isc_error_fatal(const char *, int, const char *, ...) 53 ISC_FORMAT_PRINTF(3, 4) ISC_PLATFORM_NORETURN_POST; 54 55 /*% runtimecheck error */ 56 void 57 isc_error_runtimecheck(const char *, int, const char *); 58 59 #define ISC_ERROR_RUNTIMECHECK(cond) \ 60 ((void) ((cond) || \ 61 ((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0))) 62 63 ISC_LANG_ENDDECLS 64 65 #endif /* ISC_ERROR_H */ 66