1135446Strhodes/*
2254897Serwin * Copyright (C) 2004-2007, 2011  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 1999-2002  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18254897Serwin/* $Id: callbacks.h,v 1.26 2011/12/09 23:47:05 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef DNS_CALLBACKS_H
21135446Strhodes#define DNS_CALLBACKS_H 1
22135446Strhodes
23193149Sdougb/*! \file dns/callbacks.h */
24170222Sdougb
25135446Strhodes/***
26135446Strhodes ***	Imports
27135446Strhodes ***/
28135446Strhodes
29135446Strhodes#include <isc/lang.h>
30135446Strhodes
31135446Strhodes#include <dns/types.h>
32135446Strhodes
33135446StrhodesISC_LANG_BEGINDECLS
34135446Strhodes
35135446Strhodes/***
36135446Strhodes ***	Types
37135446Strhodes ***/
38135446Strhodes
39135446Strhodesstruct dns_rdatacallbacks {
40170222Sdougb	/*%
41135446Strhodes	 * dns_load_master calls this when it has rdatasets to commit.
42135446Strhodes	 */
43135446Strhodes	dns_addrdatasetfunc_t add;
44254897Serwin
45170222Sdougb	/*%
46254897Serwin	 * dns_master_load*() call this when loading a raw zonefile,
47254897Serwin	 * to pass back information obtained from the file header
48254897Serwin	 */
49254897Serwin	dns_rawdatafunc_t rawdata;
50254897Serwin	dns_zone_t *zone;
51254897Serwin
52254897Serwin	/*%
53135446Strhodes	 * dns_load_master / dns_rdata_fromtext call this to issue a error.
54135446Strhodes	 */
55135446Strhodes	void	(*error)(struct dns_rdatacallbacks *, const char *, ...);
56170222Sdougb	/*%
57135446Strhodes	 * dns_load_master / dns_rdata_fromtext call this to issue a warning.
58135446Strhodes	 */
59135446Strhodes	void	(*warn)(struct dns_rdatacallbacks *, const char *, ...);
60170222Sdougb	/*%
61135446Strhodes	 * Private data handles for use by the above callback functions.
62135446Strhodes	 */
63135446Strhodes	void	*add_private;
64135446Strhodes	void	*error_private;
65135446Strhodes	void	*warn_private;
66135446Strhodes};
67135446Strhodes
68135446Strhodes/***
69135446Strhodes ***	Initialization
70135446Strhodes ***/
71135446Strhodes
72135446Strhodesvoid
73135446Strhodesdns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks);
74170222Sdougb/*%<
75135446Strhodes * Initialize 'callbacks'.
76170222Sdougb *
77170222Sdougb *
78170222Sdougb * \li	'error' and 'warn' are set to default callbacks that print the
79135446Strhodes *	error message through the DNS library log context.
80135446Strhodes *
81170222Sdougb *\li	All other elements are initialized to NULL.
82135446Strhodes *
83135446Strhodes * Requires:
84170222Sdougb *  \li    'callbacks' is a valid dns_rdatacallbacks_t,
85135446Strhodes */
86135446Strhodes
87135446Strhodesvoid
88135446Strhodesdns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t *callbacks);
89170222Sdougb/*%<
90135446Strhodes * Like dns_rdatacallbacks_init, but logs to stdio.
91135446Strhodes */
92135446Strhodes
93135446StrhodesISC_LANG_ENDDECLS
94135446Strhodes
95135446Strhodes#endif /* DNS_CALLBACKS_H */
96