util.h revision debd489a44363870f96f75818e89ec27d3cab736
1ccbfca64ae86ace521053773001cb995352f96fBob Halley/*
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
1ccbfca64ae86ace521053773001cb995352f96fBob Halley * Permission to use, copy, modify, and/or distribute this software for any
1ccbfca64ae86ace521053773001cb995352f96fBob Halley * purpose with or without fee is hereby granted, provided that the above
1ccbfca64ae86ace521053773001cb995352f96fBob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
15a44745412679c30a6d022733925af70a38b715David Lawrence * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15a44745412679c30a6d022733925af70a38b715David Lawrence * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15a44745412679c30a6d022733925af70a38b715David Lawrence * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15a44745412679c30a6d022733925af70a38b715David Lawrence * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PERFORMANCE OF THIS SOFTWARE.
15a44745412679c30a6d022733925af70a38b715David Lawrence */
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley/* $Id: util.h,v 1.4 2009/09/29 15:06:05 fdupont Exp $ */
f604b5ab0bd90515230a334503b7c51dcbca0c53David Lawrence
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence#ifndef RNDC_UTIL_H
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#define RNDC_UTIL_H 1
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley/*! \file */
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley#include <isc/lang.h>
1ccbfca64ae86ace521053773001cb995352f96fBob Halley#include <isc/platform.h>
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <isc/formatcheck.h>
364a82f7c25b62967678027043425201a5e5171aBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley#define NS_CONTROL_PORT 953
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson#undef DO
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley#define DO(name, function) \
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff do { \
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley result = function; \
b20ee662a7c847c9ef7b96ab9e5e34543efe5c0dMark Andrews if (result != ISC_R_SUCCESS) \
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley fatal("%s: %s", name, isc_result_totext(result)); \
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley else \
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley notify("%s", name); \
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley } while (0)
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob HalleyISC_LANG_BEGINDECLS
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graffvoid
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrewsnotify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob HalleyISC_PLATFORM_NORETURN_PRE void
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleyfatal(const char *format, ...)
62837b832f6a9999976d607eb0a9125bbbbb138bBob HalleyISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob HalleyISC_LANG_ENDDECLS
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#endif /* RNDC_UTIL_H */
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley