xref: /minix/external/bsd/bind/dist/lib/dns/include/dns/xfrin.h (revision 00b67f09)
1 /*	$NetBSD: xfrin.h,v 1.5 2014/12/10 04:37:58 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2007, 2009, 2013  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  */
49 typedef struct dns_xfrin_ctx dns_xfrin_ctx_t;
50 
51 /***
52  *** Functions
53  ***/
54 
55 ISC_LANG_BEGINDECLS
56 
57 /*% see dns_xfrin_create2() */
58 isc_result_t
59 dns_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 
65 isc_result_t
66 dns_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 isc_result_t
74 dns_xfrin_create3(dns_zone_t *zone, dns_rdatatype_t xfrtype,
75 		  isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr,
76 		  isc_dscp_t dscp, dns_tsigkey_t *tsigkey, isc_mem_t *mctx,
77 		  isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,
78 		  isc_task_t *task, dns_xfrindone_t done,
79 		  dns_xfrin_ctx_t **xfrp);
80 /*%<
81  * Attempt to start an incoming zone transfer of 'zone'
82  * from 'masteraddr', creating a dns_xfrin_ctx_t object to
83  * manage it.  Attach '*xfrp' to the newly created object.
84  *
85  * Iff ISC_R_SUCCESS is returned, '*done' is guaranteed to be
86  * called in the context of 'task', with 'zone' and a result
87  * code as arguments when the transfer finishes.
88  *
89  * Requires:
90  *\li	'xfrtype' is dns_rdatatype_axfr, dns_rdatatype_ixfr
91  *	or dns_rdatatype_soa (soa query followed by axfr if
92  *	serial is greater than current serial).
93  *
94  *\li	If 'xfrtype' is dns_rdatatype_ixfr or dns_rdatatype_soa,
95  *	the zone has a database.
96  */
97 
98 void
99 dns_xfrin_shutdown(dns_xfrin_ctx_t *xfr);
100 /*%<
101  * If the zone transfer 'xfr' has already finished,
102  * do nothing.  Otherwise, abort it and cause it to call
103  * its done callback with a status of ISC_R_CANCELED.
104  */
105 
106 void
107 dns_xfrin_detach(dns_xfrin_ctx_t **xfrp);
108 /*%<
109  * Detach a reference to a zone transfer object.
110  * Caller to maintain external locking if required.
111  */
112 
113 void
114 dns_xfrin_attach(dns_xfrin_ctx_t *source, dns_xfrin_ctx_t **target);
115 /*%<
116  * Caller to maintain external locking if required.
117  */
118 
119 ISC_LANG_ENDDECLS
120 
121 #endif /* DNS_XFRIN_H */
122