00001 /* 00002 * Copyright (C) 2004-2007, 2009, 2013 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-2001, 2003 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: xfrin.h,v 1.30 2009/01/17 23:47:43 tbox Exp $ */ 00019 00020 #ifndef DNS_XFRIN_H 00021 #define DNS_XFRIN_H 1 00022 00023 /***** 00024 ***** Module Info 00025 *****/ 00026 00027 /*! \file dns/xfrin.h 00028 * \brief 00029 * Incoming zone transfers (AXFR + IXFR). 00030 */ 00031 00032 /*** 00033 *** Imports 00034 ***/ 00035 00036 #include <isc/lang.h> 00037 00038 #include <dns/types.h> 00039 00040 /*** 00041 *** Types 00042 ***/ 00043 00044 /*% 00045 * A transfer in progress. This is an opaque type. 00046 */ 00047 typedef struct dns_xfrin_ctx dns_xfrin_ctx_t; 00048 00049 /*** 00050 *** Functions 00051 ***/ 00052 00053 ISC_LANG_BEGINDECLS 00054 00055 /*% see dns_xfrin_create2() */ 00056 isc_result_t 00057 dns_xfrin_create(dns_zone_t *zone, dns_rdatatype_t xfrtype, 00058 isc_sockaddr_t *masteraddr, dns_tsigkey_t *tsigkey, 00059 isc_mem_t *mctx, isc_timermgr_t *timermgr, 00060 isc_socketmgr_t *socketmgr, isc_task_t *task, 00061 dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp); 00062 00063 isc_result_t 00064 dns_xfrin_create2(dns_zone_t *zone, dns_rdatatype_t xfrtype, 00065 isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, 00066 dns_tsigkey_t *tsigkey, isc_mem_t *mctx, 00067 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, 00068 isc_task_t *task, dns_xfrindone_t done, 00069 dns_xfrin_ctx_t **xfrp); 00070 00071 isc_result_t 00072 dns_xfrin_create3(dns_zone_t *zone, dns_rdatatype_t xfrtype, 00073 isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, 00074 isc_dscp_t dscp, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, 00075 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, 00076 isc_task_t *task, dns_xfrindone_t done, 00077 dns_xfrin_ctx_t **xfrp); 00078 /*%< 00079 * Attempt to start an incoming zone transfer of 'zone' 00080 * from 'masteraddr', creating a dns_xfrin_ctx_t object to 00081 * manage it. Attach '*xfrp' to the newly created object. 00082 * 00083 * Iff ISC_R_SUCCESS is returned, '*done' is guaranteed to be 00084 * called in the context of 'task', with 'zone' and a result 00085 * code as arguments when the transfer finishes. 00086 * 00087 * Requires: 00088 *\li 'xfrtype' is dns_rdatatype_axfr, dns_rdatatype_ixfr 00089 * or dns_rdatatype_soa (soa query followed by axfr if 00090 * serial is greater than current serial). 00091 * 00092 *\li If 'xfrtype' is dns_rdatatype_ixfr or dns_rdatatype_soa, 00093 * the zone has a database. 00094 */ 00095 00096 void 00097 dns_xfrin_shutdown(dns_xfrin_ctx_t *xfr); 00098 /*%< 00099 * If the zone transfer 'xfr' has already finished, 00100 * do nothing. Otherwise, abort it and cause it to call 00101 * its done callback with a status of ISC_R_CANCELED. 00102 */ 00103 00104 void 00105 dns_xfrin_detach(dns_xfrin_ctx_t **xfrp); 00106 /*%< 00107 * Detach a reference to a zone transfer object. 00108 * Caller to maintain external locking if required. 00109 */ 00110 00111 void 00112 dns_xfrin_attach(dns_xfrin_ctx_t *source, dns_xfrin_ctx_t **target); 00113 /*%< 00114 * Caller to maintain external locking if required. 00115 */ 00116 00117 ISC_LANG_ENDDECLS 00118 00119 #endif /* DNS_XFRIN_H */