]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/bind9/lib/dns/include/dns/callbacks.h
MFC r363988:
[FreeBSD/stable/9.git] / contrib / bind9 / lib / dns / include / dns / callbacks.h
1 /*
2  * Copyright (C) 2004-2007, 2011  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2002  Internet Software Consortium.
4  *
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.
8  *
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.
16  */
17
18 /* $Id: callbacks.h,v 1.26 2011/12/09 23:47:05 tbox Exp $ */
19
20 #ifndef DNS_CALLBACKS_H
21 #define DNS_CALLBACKS_H 1
22
23 /*! \file dns/callbacks.h */
24
25 /***
26  ***    Imports
27  ***/
28
29 #include <isc/lang.h>
30
31 #include <dns/types.h>
32
33 ISC_LANG_BEGINDECLS
34
35 /***
36  ***    Types
37  ***/
38
39 struct dns_rdatacallbacks {
40         /*%
41          * dns_load_master calls this when it has rdatasets to commit.
42          */
43         dns_addrdatasetfunc_t add;
44
45         /*%
46          * dns_master_load*() call this when loading a raw zonefile,
47          * to pass back information obtained from the file header
48          */
49         dns_rawdatafunc_t rawdata;
50         dns_zone_t *zone;
51
52         /*%
53          * dns_load_master / dns_rdata_fromtext call this to issue a error.
54          */
55         void    (*error)(struct dns_rdatacallbacks *, const char *, ...);
56         /*%
57          * dns_load_master / dns_rdata_fromtext call this to issue a warning.
58          */
59         void    (*warn)(struct dns_rdatacallbacks *, const char *, ...);
60         /*%
61          * Private data handles for use by the above callback functions.
62          */
63         void    *add_private;
64         void    *error_private;
65         void    *warn_private;
66 };
67
68 /***
69  ***    Initialization
70  ***/
71
72 void
73 dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks);
74 /*%<
75  * Initialize 'callbacks'.
76  *
77  *
78  * \li  'error' and 'warn' are set to default callbacks that print the
79  *      error message through the DNS library log context.
80  *
81  *\li   All other elements are initialized to NULL.
82  *
83  * Requires:
84  *  \li    'callbacks' is a valid dns_rdatacallbacks_t,
85  */
86
87 void
88 dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t *callbacks);
89 /*%<
90  * Like dns_rdatacallbacks_init, but logs to stdio.
91  */
92
93 ISC_LANG_ENDDECLS
94
95 #endif /* DNS_CALLBACKS_H */