4 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2001 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: callbacks.c,v 1.17 2007/06/19 23:47:16 tbox Exp */
28 #include <dns/callbacks.h>
32 stdio_error_warn_callback(dns_rdatacallbacks_t
*, const char *, ...)
33 ISC_FORMAT_PRINTF(2, 3);
36 isclog_error_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...)
37 ISC_FORMAT_PRINTF(2, 3);
40 isclog_warn_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...)
41 ISC_FORMAT_PRINTF(2, 3);
48 stdio_error_warn_callback(dns_rdatacallbacks_t
*callbacks
,
56 vfprintf(stderr
, fmt
, ap
);
58 fprintf(stderr
, "\n");
62 isclog_error_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...) {
68 isc_log_vwrite(dns_lctx
, DNS_LOGCATEGORY_GENERAL
,
69 DNS_LOGMODULE_MASTER
, /* XXX */
70 ISC_LOG_ERROR
, fmt
, ap
);
75 isclog_warn_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
, ...) {
82 isc_log_vwrite(dns_lctx
, DNS_LOGCATEGORY_GENERAL
,
83 DNS_LOGMODULE_MASTER
, /* XXX */
84 ISC_LOG_WARNING
, fmt
, ap
);
89 dns_rdatacallbacks_initcommon(dns_rdatacallbacks_t
*callbacks
) {
90 REQUIRE(callbacks
!= NULL
);
92 callbacks
->add
= NULL
;
93 callbacks
->add_private
= NULL
;
94 callbacks
->error_private
= NULL
;
95 callbacks
->warn_private
= NULL
;
103 dns_rdatacallbacks_init(dns_rdatacallbacks_t
*callbacks
) {
104 dns_rdatacallbacks_initcommon(callbacks
);
105 callbacks
->error
= isclog_error_callback
;
106 callbacks
->warn
= isclog_warn_callback
;
110 dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t
*callbacks
) {
111 dns_rdatacallbacks_initcommon(callbacks
);
112 callbacks
->error
= stdio_error_warn_callback
;
113 callbacks
->warn
= stdio_error_warn_callback
;