Home | History | Annotate | Line # | Download | only in confgen
      1 /*	$NetBSD: util.h,v 1.8 2025/01/26 16:24:32 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 #pragma once
     17 
     18 /*! \file */
     19 
     20 #include <isc/attributes.h>
     21 #include <isc/formatcheck.h>
     22 #include <isc/lang.h>
     23 
     24 #define NS_CONTROL_PORT 953
     25 
     26 #undef DO
     27 #define DO(name, function)                                                \
     28 	do {                                                              \
     29 		result = function;                                        \
     30 		if (result != ISC_R_SUCCESS)                              \
     31 			fatal("%s: %s", name, isc_result_totext(result)); \
     32 		else                                                      \
     33 			notify("%s", name);                               \
     34 	} while (0)
     35 
     36 ISC_LANG_BEGINDECLS
     37 
     38 void
     39 notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
     40 
     41 noreturn void
     42 fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
     43 
     44 ISC_LANG_ENDDECLS
     45