1258945Sroberto/* 2280849Scy * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") 3258945Sroberto * Copyright (C) 1998-2001 Internet Software Consortium. 4258945Sroberto * 5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any 6258945Sroberto * purpose with or without fee is hereby granted, provided that the above 7258945Sroberto * copyright notice and this permission notice appear in all copies. 8258945Sroberto * 9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11258945Sroberto * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15258945Sroberto * PERFORMANCE OF THIS SOFTWARE. 16258945Sroberto */ 17258945Sroberto 18280849Scy/* $Id: error.h,v 1.22 2009/09/29 23:48:04 tbox Exp $ */ 19258945Sroberto 20258945Sroberto#ifndef ISC_ERROR_H 21258945Sroberto#define ISC_ERROR_H 1 22258945Sroberto 23258945Sroberto/*! \file isc/error.h */ 24258945Sroberto 25258945Sroberto#include <stdarg.h> 26258945Sroberto 27258945Sroberto#include <isc/formatcheck.h> 28258945Sroberto#include <isc/lang.h> 29280849Scy#include <isc/platform.h> 30258945Sroberto 31258945SrobertoISC_LANG_BEGINDECLS 32258945Sroberto 33258945Srobertotypedef void (*isc_errorcallback_t)(const char *, int, const char *, va_list); 34258945Sroberto 35258945Sroberto/*% set unexpected error */ 36258945Srobertovoid 37258945Srobertoisc_error_setunexpected(isc_errorcallback_t); 38258945Sroberto 39258945Sroberto/*% set fatal error */ 40258945Srobertovoid 41258945Srobertoisc_error_setfatal(isc_errorcallback_t); 42258945Sroberto 43258945Sroberto/*% unexpected error */ 44258945Srobertovoid 45258945Srobertoisc_error_unexpected(const char *, int, const char *, ...) 46258945Sroberto ISC_FORMAT_PRINTF(3, 4); 47258945Sroberto 48258945Sroberto/*% fatal error */ 49280849ScyISC_PLATFORM_NORETURN_PRE void 50258945Srobertoisc_error_fatal(const char *, int, const char *, ...) 51280849ScyISC_FORMAT_PRINTF(3, 4) ISC_PLATFORM_NORETURN_POST; 52258945Sroberto 53258945Sroberto/*% runtimecheck error */ 54258945Srobertovoid 55258945Srobertoisc_error_runtimecheck(const char *, int, const char *); 56258945Sroberto 57258945Sroberto#define ISC_ERROR_RUNTIMECHECK(cond) \ 58258945Sroberto ((void) ((cond) || \ 59258945Sroberto ((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0))) 60258945Sroberto 61258945SrobertoISC_LANG_ENDDECLS 62258945Sroberto 63258945Sroberto#endif /* ISC_ERROR_H */ 64