351b62535d4c4f89883bfdba025999dd32490266Evan Hunt/*
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2009, 2016 Internet Systems Consortium, Inc. ("ISC")
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt */
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
debd489a44363870f96f75818e89ec27d3cab736Francis Dupont/* $Id: util.h,v 1.4 2009/09/29 15:06:05 fdupont Exp $ */
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#ifndef RNDC_UTIL_H
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#define RNDC_UTIL_H 1
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt/*! \file */
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#include <isc/lang.h>
debd489a44363870f96f75818e89ec27d3cab736Francis Dupont#include <isc/platform.h>
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#include <isc/formatcheck.h>
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#define NS_CONTROL_PORT 953
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#undef DO
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#define DO(name, function) \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt do { \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt result = function; \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt if (result != ISC_R_SUCCESS) \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt fatal("%s: %s", name, isc_result_totext(result)); \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt else \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt notify("%s", name); \
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt } while (0)
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan HuntISC_LANG_BEGINDECLS
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Huntvoid
351b62535d4c4f89883bfdba025999dd32490266Evan Huntnotify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
debd489a44363870f96f75818e89ec27d3cab736Francis DupontISC_PLATFORM_NORETURN_PRE void
debd489a44363870f96f75818e89ec27d3cab736Francis Dupontfatal(const char *format, ...)
debd489a44363870f96f75818e89ec27d3cab736Francis DupontISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan HuntISC_LANG_ENDDECLS
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt#endif /* RNDC_UTIL_H */