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