xref: /netbsd/external/bsd/ntp/dist/lib/isc/include/isc/error.h (revision 6550d01e)
1 /*	$NetBSD: error.h,v 1.1.1.1 2009/12/13 16:54:28 kardel Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2007  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.20 2007/06/19 23:47:18 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 
32 ISC_LANG_BEGINDECLS
33 
34 typedef void (*isc_errorcallback_t)(const char *, int, const char *, va_list);
35 
36 /*% set unexpected error */
37 void
38 isc_error_setunexpected(isc_errorcallback_t);
39 
40 /*% set fatal error */
41 void
42 isc_error_setfatal(isc_errorcallback_t);
43 
44 /*% unexpected error */
45 void
46 isc_error_unexpected(const char *, int, const char *, ...)
47      ISC_FORMAT_PRINTF(3, 4);
48 
49 /*% fatal error */
50 void
51 isc_error_fatal(const char *, int, const char *, ...)
52      ISC_FORMAT_PRINTF(3, 4);
53 
54 /*% runtimecheck error */
55 void
56 isc_error_runtimecheck(const char *, int, const char *);
57 
58 #define ISC_ERROR_RUNTIMECHECK(cond) \
59 	((void) ((cond) || \
60 		 ((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0)))
61 
62 ISC_LANG_ENDDECLS
63 
64 #endif /* ISC_ERROR_H */
65