xref: /netbsd-src/external/mpl/bind/dist/bin/rndc/util.h (revision 33881f779a77dce6440bdc44610d94de75bebefe)
1 /*	$NetBSD: util.h,v 1.2 2018/08/12 13:02:28 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 
15 #ifndef RNDC_UTIL_H
16 #define RNDC_UTIL_H 1
17 
18 /*! \file */
19 
20 #include <isc/lang.h>
21 #include <isc/platform.h>
22 
23 #include <isc/formatcheck.h>
24 
25 #define NS_CONTROL_PORT		953
26 
27 #undef DO
28 #define DO(name, function) \
29 	do { \
30 		result = function; \
31 		if (result != ISC_R_SUCCESS) \
32 			fatal("%s: %s", name, isc_result_totext(result)); \
33 		else \
34 			notify("%s", name); \
35 	} while (/*CONSTCOND*/0)
36 
37 ISC_LANG_BEGINDECLS
38 
39 void
40 notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
41 
42 ISC_PLATFORM_NORETURN_PRE void
43 fatal(const char *format, ...)
44 ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
45 
46 ISC_LANG_ENDDECLS
47 
48 #endif /* RNDC_UTIL_H */
49