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