1 /* $NetBSD: util.h,v 1.6 2022/09/23 12:15:23 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 #ifndef RNDC_UTIL_H 17 #define RNDC_UTIL_H 1 18 19 /*! \file */ 20 21 #include <isc/formatcheck.h> 22 #include <isc/lang.h> 23 #include <isc/platform.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 (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