1105464Sphk/* 2105464Sphk * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") 3105464Sphk * 4105464Sphk * Permission to use, copy, modify, and/or distribute this software for any 5105464Sphk * purpose with or without fee is hereby granted, provided that the above 6105464Sphk * copyright notice and this permission notice appear in all copies. 7105464Sphk * 8105464Sphk * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9105464Sphk * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10105464Sphk * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11105464Sphk * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12105464Sphk * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13105464Sphk * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14105464Sphk * PERFORMANCE OF THIS SOFTWARE. 15105464Sphk */ 16105464Sphk 17105464Sphk/* $Id: util.h,v 1.4 2009/09/29 15:06:05 fdupont Exp $ */ 18105464Sphk 19105464Sphk#ifndef RNDC_UTIL_H 20105464Sphk#define RNDC_UTIL_H 1 21105464Sphk 22105464Sphk/*! \file */ 23105464Sphk 24105464Sphk#include <isc/lang.h> 25105464Sphk#include <isc/platform.h> 26105464Sphk 27105464Sphk#include <isc/formatcheck.h> 28105464Sphk 29105464Sphk#define NS_CONTROL_PORT 953 30105464Sphk 31105464Sphk#undef DO 32105464Sphk#define DO(name, function) \ 33139778Simp do { \ 34139778Simp result = function; \ 35105464Sphk if (result != ISC_R_SUCCESS) \ 36105464Sphk fatal("%s: %s", name, isc_result_totext(result)); \ 37105464Sphk else \ 38105464Sphk notify("%s", name); \ 39105464Sphk } while (0) 40105464Sphk 41105464SphkISC_LANG_BEGINDECLS 42105464Sphk 43105464Sphkvoid 44105464Sphknotify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2); 45105464Sphk 46105464SphkISC_PLATFORM_NORETURN_PRE void 47105464Sphkfatal(const char *format, ...) 48105464SphkISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; 49105464Sphk 50105464SphkISC_LANG_ENDDECLS 51105464Sphk 52105464Sphk#endif /* RNDC_UTIL_H */ 53105464Sphk