1/*	$NetBSD: xfrin.h,v 1.2.6.1 2012/06/05 21:14:57 bouyer Exp $	*/
2
3/*
4 * Copyright (C) 2004-2007, 2009  Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20/* Id: xfrin.h,v 1.30 2009/01/17 23:47:43 tbox Exp  */
21
22#ifndef DNS_XFRIN_H
23#define DNS_XFRIN_H 1
24
25/*****
26 ***** Module Info
27 *****/
28
29/*! \file dns/xfrin.h
30 * \brief
31 * Incoming zone transfers (AXFR + IXFR).
32 */
33
34/***
35 *** Imports
36 ***/
37
38#include <isc/lang.h>
39
40#include <dns/types.h>
41
42/***
43 *** Types
44 ***/
45
46/*%
47 * A transfer in progress.  This is an opaque type.
48 */
49typedef struct dns_xfrin_ctx dns_xfrin_ctx_t;
50
51/***
52 *** Functions
53 ***/
54
55ISC_LANG_BEGINDECLS
56
57/*% see dns_xfrin_create2() */
58isc_result_t
59dns_xfrin_create(dns_zone_t *zone, dns_rdatatype_t xfrtype,
60		 isc_sockaddr_t *masteraddr, dns_tsigkey_t *tsigkey,
61		 isc_mem_t *mctx, isc_timermgr_t *timermgr,
62		 isc_socketmgr_t *socketmgr, isc_task_t *task,
63		 dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp);
64
65isc_result_t
66dns_xfrin_create2(dns_zone_t *zone, dns_rdatatype_t xfrtype,
67		  isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr,
68		  dns_tsigkey_t *tsigkey, isc_mem_t *mctx,
69		  isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,
70		  isc_task_t *task, dns_xfrindone_t done,
71		  dns_xfrin_ctx_t **xfrp);
72/*%<
73 * Attempt to start an incoming zone transfer of 'zone'
74 * from 'masteraddr', creating a dns_xfrin_ctx_t object to
75 * manage it.  Attach '*xfrp' to the newly created object.
76 *
77 * Iff ISC_R_SUCCESS is returned, '*done' is guaranteed to be
78 * called in the context of 'task', with 'zone' and a result
79 * code as arguments when the transfer finishes.
80 *
81 * Requires:
82 *\li	'xfrtype' is dns_rdatatype_axfr, dns_rdatatype_ixfr
83 *	or dns_rdatatype_soa (soa query followed by axfr if
84 *	serial is greater than current serial).
85 *
86 *\li	If 'xfrtype' is dns_rdatatype_ixfr or dns_rdatatype_soa,
87 *	the zone has a database.
88 */
89
90void
91dns_xfrin_shutdown(dns_xfrin_ctx_t *xfr);
92/*%<
93 * If the zone transfer 'xfr' has already finished,
94 * do nothing.  Otherwise, abort it and cause it to call
95 * its done callback with a status of ISC_R_CANCELED.
96 */
97
98void
99dns_xfrin_detach(dns_xfrin_ctx_t **xfrp);
100/*%<
101 * Detach a reference to a zone transfer object.
102 * Caller to maintain external locking if required.
103 */
104
105void
106dns_xfrin_attach(dns_xfrin_ctx_t *source, dns_xfrin_ctx_t **target);
107/*%<
108 * Caller to maintain external locking if required.
109 */
110
111ISC_LANG_ENDDECLS
112
113#endif /* DNS_XFRIN_H */
114