1 /* 2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 3 * 4 * This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 7 * 8 * See the COPYRIGHT file distributed with this work for additional 9 * information regarding copyright ownership. 10 */ 11 12 13 #ifndef DNS_XFRIN_H 14 #define DNS_XFRIN_H 1 15 16 /***** 17 ***** Module Info 18 *****/ 19 20 /*! \file dns/xfrin.h 21 * \brief 22 * Incoming zone transfers (AXFR + IXFR). 23 */ 24 25 /*** 26 *** Imports 27 ***/ 28 29 #include <isc/lang.h> 30 31 #include <dns/types.h> 32 33 /*** 34 *** Types 35 ***/ 36 37 /*% 38 * A transfer in progress. This is an opaque type. 39 */ 40 typedef struct dns_xfrin_ctx dns_xfrin_ctx_t; 41 42 /*** 43 *** Functions 44 ***/ 45 46 ISC_LANG_BEGINDECLS 47 48 /*% see dns_xfrin_create2() */ 49 isc_result_t 50 dns_xfrin_create(dns_zone_t *zone, dns_rdatatype_t xfrtype, 51 isc_sockaddr_t *masteraddr, dns_tsigkey_t *tsigkey, 52 isc_mem_t *mctx, isc_timermgr_t *timermgr, 53 isc_socketmgr_t *socketmgr, isc_task_t *task, 54 dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp); 55 56 isc_result_t 57 dns_xfrin_create2(dns_zone_t *zone, dns_rdatatype_t xfrtype, 58 isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, 59 dns_tsigkey_t *tsigkey, isc_mem_t *mctx, 60 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, 61 isc_task_t *task, dns_xfrindone_t done, 62 dns_xfrin_ctx_t **xfrp); 63 64 isc_result_t 65 dns_xfrin_create3(dns_zone_t *zone, dns_rdatatype_t xfrtype, 66 isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, 67 isc_dscp_t dscp, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, 68 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, 69 isc_task_t *task, dns_xfrindone_t done, 70 dns_xfrin_ctx_t **xfrp); 71 /*%< 72 * Attempt to start an incoming zone transfer of 'zone' 73 * from 'masteraddr', creating a dns_xfrin_ctx_t object to 74 * manage it. Attach '*xfrp' to the newly created object. 75 * 76 * Iff ISC_R_SUCCESS is returned, '*done' is guaranteed to be 77 * called in the context of 'task', with 'zone' and a result 78 * code as arguments when the transfer finishes. 79 * 80 * Requires: 81 *\li 'xfrtype' is dns_rdatatype_axfr, dns_rdatatype_ixfr 82 * or dns_rdatatype_soa (soa query followed by axfr if 83 * serial is greater than current serial). 84 * 85 *\li If 'xfrtype' is dns_rdatatype_ixfr or dns_rdatatype_soa, 86 * the zone has a database. 87 */ 88 89 void 90 dns_xfrin_shutdown(dns_xfrin_ctx_t *xfr); 91 /*%< 92 * If the zone transfer 'xfr' has already finished, 93 * do nothing. Otherwise, abort it and cause it to call 94 * its done callback with a status of ISC_R_CANCELED. 95 */ 96 97 void 98 dns_xfrin_detach(dns_xfrin_ctx_t **xfrp); 99 /*%< 100 * Detach a reference to a zone transfer object. 101 * Caller to maintain external locking if required. 102 */ 103 104 void 105 dns_xfrin_attach(dns_xfrin_ctx_t *source, dns_xfrin_ctx_t **target); 106 /*%< 107 * Caller to maintain external locking if required. 108 */ 109 110 ISC_LANG_ENDDECLS 111 112 #endif /* DNS_XFRIN_H */ 113