callbacks.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2007, 2011-2013  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2002  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: callbacks.h,v 1.26.40.1 2012/02/07 00:44:16 each Exp $ */
00019 
00020 #ifndef DNS_CALLBACKS_H
00021 #define DNS_CALLBACKS_H 1
00022 
00023 /*! \file dns/callbacks.h */
00024 
00025 /***
00026  ***    Imports
00027  ***/
00028 
00029 #include <isc/lang.h>
00030 #include <isc/magic.h>
00031 
00032 #include <dns/types.h>
00033 
00034 ISC_LANG_BEGINDECLS
00035 
00036 /***
00037  ***    Types
00038  ***/
00039 
00040 #define DNS_CALLBACK_MAGIC      ISC_MAGIC('C','L','L','B')
00041 #define DNS_CALLBACK_VALID(cb)  ISC_MAGIC_VALID(cb, DNS_CALLBACK_MAGIC)
00042 
00043 struct dns_rdatacallbacks {
00044         unsigned int magic;
00045 
00046         /*%
00047          * dns_load_master calls this when it has rdatasets to commit.
00048          */
00049         dns_addrdatasetfunc_t add;
00050 
00051         /*%
00052          * This is called when reading in a database image from a 'map'
00053          * format zone file.
00054          */
00055         dns_deserializefunc_t deserialize;
00056 
00057         /*%
00058          * dns_master_load*() call this when loading a raw zonefile,
00059          * to pass back information obtained from the file header
00060          */
00061         dns_rawdatafunc_t rawdata;
00062         dns_zone_t *zone;
00063 
00064         /*%
00065          * dns_load_master / dns_rdata_fromtext call this to issue a error.
00066          */
00067         void    (*error)(struct dns_rdatacallbacks *, const char *, ...);
00068         /*%
00069          * dns_load_master / dns_rdata_fromtext call this to issue a warning.
00070          */
00071         void    (*warn)(struct dns_rdatacallbacks *, const char *, ...);
00072         /*%
00073          * Private data handles for use by the above callback functions.
00074          */
00075         void    *add_private;
00076         void    *deserialize_private;
00077         void    *error_private;
00078         void    *warn_private;
00079 };
00080 
00081 /***
00082  ***    Initialization
00083  ***/
00084 
00085 void
00086 dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks);
00087 /*%<
00088  * Initialize 'callbacks'.
00089  *
00090  * \li  'magic' is set to DNS_CALLBACK_MAGIC
00091  *
00092  * \li  'error' and 'warn' are set to default callbacks that print the
00093  *      error message through the DNS library log context.
00094  *
00095  *\li   All other elements are initialized to NULL.
00096  *
00097  * Requires:
00098  *  \li    'callbacks' is a valid dns_rdatacallbacks_t,
00099  */
00100 
00101 void
00102 dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t *callbacks);
00103 /*%<
00104  * Like dns_rdatacallbacks_init, but logs to stdio.
00105  */
00106 
00107 ISC_LANG_ENDDECLS
00108 
00109 #endif /* DNS_CALLBACKS_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha