2 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: callbacks.c,v 1.17 2007/06/19 23:47:16 tbox Exp $ */
26 #include <dns/callbacks.h>
30 stdio_error_warn_callback(dns_rdatacallbacks_t
*, const char *, ...)
31 ISC_FORMAT_PRINTF(2, 3);
34 isclog_error_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...)
35 ISC_FORMAT_PRINTF(2, 3);
38 isclog_warn_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...)
39 ISC_FORMAT_PRINTF(2, 3);
46 stdio_error_warn_callback(dns_rdatacallbacks_t
*callbacks
,
54 vfprintf(stderr
, fmt
, ap
);
56 fprintf(stderr
, "\n");
60 isclog_error_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...) {
66 isc_log_vwrite(dns_lctx
, DNS_LOGCATEGORY_GENERAL
,
67 DNS_LOGMODULE_MASTER
, /* XXX */
68 ISC_LOG_ERROR
, fmt
, ap
);
73 isclog_warn_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...) {
80 isc_log_vwrite(dns_lctx
, DNS_LOGCATEGORY_GENERAL
,
81 DNS_LOGMODULE_MASTER
, /* XXX */
82 ISC_LOG_WARNING
, fmt
, ap
);
87 dns_rdatacallbacks_initcommon(dns_rdatacallbacks_t
*callbacks
) {
88 REQUIRE(callbacks
!= NULL
);
90 callbacks
->add
= NULL
;
91 callbacks
->add_private
= NULL
;
92 callbacks
->error_private
= NULL
;
93 callbacks
->warn_private
= NULL
;
101 dns_rdatacallbacks_init(dns_rdatacallbacks_t
*callbacks
) {
102 dns_rdatacallbacks_initcommon(callbacks
);
103 callbacks
->error
= isclog_error_callback
;
104 callbacks
->warn
= isclog_warn_callback
;
108 dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t
*callbacks
) {
109 dns_rdatacallbacks_initcommon(callbacks
);
110 callbacks
->error
= stdio_error_warn_callback
;
111 callbacks
->warn
= stdio_error_warn_callback
;