xref: /minix/external/bsd/bind/dist/lib/dns/include/dns/order.h (revision 00b67f09)
1 /*	$NetBSD: order.h,v 1.4 2014/12/10 04:37:58 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 2002  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: order.h,v 1.9 2007/06/19 23:47:17 tbox Exp  */
21 
22 #ifndef DNS_ORDER_H
23 #define DNS_ORDER_H 1
24 
25 /*! \file dns/order.h */
26 
27 #include <isc/lang.h>
28 #include <isc/types.h>
29 
30 #include <dns/types.h>
31 
32 ISC_LANG_BEGINDECLS
33 
34 isc_result_t
35 dns_order_create(isc_mem_t *mctx, dns_order_t **orderp);
36 /*%<
37  * Create a order object.
38  *
39  * Requires:
40  * \li	'orderp' to be non NULL and '*orderp == NULL'.
41  *\li	'mctx' to be valid.
42  *
43  * Returns:
44  *\li	ISC_R_SUCCESS
45  *\li	ISC_R_NOMEMORY
46  */
47 
48 isc_result_t
49 dns_order_add(dns_order_t *order, dns_name_t *name,
50 	      dns_rdatatype_t rdtype, dns_rdataclass_t rdclass,
51 	      unsigned int mode);
52 /*%<
53  * Add a entry to the end of the order list.
54  *
55  * Requires:
56  * \li	'order' to be valid.
57  *\li	'name' to be valid.
58  *\li	'mode' to be one of #DNS_RDATASERATTR_RANDOMIZE,
59  *		#DNS_RDATASERATTR_RANDOMIZE or zero (#DNS_RDATASERATTR_CYCLIC).
60  *
61  * Returns:
62  *\li	#ISC_R_SUCCESS
63  *\li	#ISC_R_NOMEMORY
64  */
65 
66 unsigned int
67 dns_order_find(dns_order_t *order, dns_name_t *name,
68 	       dns_rdatatype_t rdtype, dns_rdataclass_t rdclass);
69 /*%<
70  * Find the first matching entry on the list.
71  *
72  * Requires:
73  *\li	'order' to be valid.
74  *\li	'name' to be valid.
75  *
76  * Returns the mode set by dns_order_add() or zero.
77  */
78 
79 void
80 dns_order_attach(dns_order_t *source, dns_order_t **target);
81 /*%<
82  * Attach to the 'source' object.
83  *
84  * Requires:
85  * \li	'source' to be valid.
86  *\li	'target' to be non NULL and '*target == NULL'.
87  */
88 
89 void
90 dns_order_detach(dns_order_t **orderp);
91 /*%<
92  * Detach from the object.  Clean up if last this was the last
93  * reference.
94  *
95  * Requires:
96  *\li	'*orderp' to be valid.
97  */
98 
99 ISC_LANG_ENDDECLS
100 
101 #endif /* DNS_ORDER_H */
102