callbacks.c revision 8eaa2ef5664889df5a0855b667f6d8845cd95b50
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer/*
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer * Copyright (C) 1999 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews *
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * purpose with or without fee is hereby granted, provided that the above
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * copyright notice and this permission notice appear in all copies.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews *
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * SOFTWARE.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews */
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews
1d32b1df372d6be6bac6450739b9e5ea23819995Evan Hunt /* $Id: callbacks.c,v 1.1 1999/02/10 05:22:01 marka Exp $ */
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#include <config.h>
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#include <stdarg.h>
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
8aee18709f238406719768b8a6b843a15c5075f8Mark Andrews#include <isc/assertions.h>
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#include <dns/callbacks.h>
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Huntstatic void default_error_warn_callback(dns_rdatacallbacks_t *, char *, ...);
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt/*
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * Public.
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt */
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Huntvoid
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Huntdns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks) {
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt REQUIRE(callbacks != NULL);
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt callbacks->commit = NULL;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt callbacks->error = default_error_warn_callback;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt callbacks->warn = default_error_warn_callback;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt callbacks->commit_private = NULL;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt callbacks->error_private = NULL;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt callbacks->warn_private = NULL;
222d38735f97f771054e223b03f84c5858252332Evan Hunt}
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer/*
222d38735f97f771054e223b03f84c5858252332Evan Hunt * Private
222d38735f97f771054e223b03f84c5858252332Evan Hunt */
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
222d38735f97f771054e223b03f84c5858252332Evan Huntstatic void
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrencedefault_error_warn_callback(dns_rdatacallbacks_t *callbacks, char *fmt, ...) {
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer va_list ap;
222d38735f97f771054e223b03f84c5858252332Evan Hunt
222d38735f97f771054e223b03f84c5858252332Evan Hunt callbacks = callbacks; /*unused*/
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
222d38735f97f771054e223b03f84c5858252332Evan Hunt va_start(ap, fmt);
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence vfprintf(stderr, fmt, ap);
222d38735f97f771054e223b03f84c5858252332Evan Hunt va_end(ap);
222d38735f97f771054e223b03f84c5858252332Evan Hunt}
222d38735f97f771054e223b03f84c5858252332Evan Hunt