xref: /netbsd-src/external/mpl/dhcp/bind/dist/lib/dns/include/dns/order.h (revision 4afad4b7fa6d4a0d3dedf41d1587a7250710ae54)
1 /*	$NetBSD: order.h,v 1.1 2024/02/18 20:57:37 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #ifndef DNS_ORDER_H
17 #define DNS_ORDER_H 1
18 
19 /*! \file dns/order.h */
20 
21 #include <isc/lang.h>
22 #include <isc/types.h>
23 
24 #include <dns/types.h>
25 
26 ISC_LANG_BEGINDECLS
27 
28 isc_result_t
29 dns_order_create(isc_mem_t *mctx, dns_order_t **orderp);
30 /*%<
31  * Create a order object.
32  *
33  * Requires:
34  * \li	'orderp' to be non NULL and '*orderp == NULL'.
35  *\li	'mctx' to be valid.
36  *
37  * Returns:
38  *\li	ISC_R_SUCCESS
39  *\li	ISC_R_NOMEMORY
40  */
41 
42 isc_result_t
43 dns_order_add(dns_order_t *order, const dns_name_t *name,
44 	      dns_rdatatype_t rdtype, dns_rdataclass_t rdclass,
45 	      unsigned int mode);
46 /*%<
47  * Add a entry to the end of the order list.
48  *
49  * Requires:
50  * \li	'order' to be valid.
51  *\li	'name' to be valid.
52  *\li	'mode' to be one of #DNS_RDATASETATTR_RANDOMIZE,
53  *		#DNS_RDATASETATTR_FIXEDORDER or zero (#DNS_RDATASETATTR_CYCLIC).
54  *
55  * Returns:
56  *\li	#ISC_R_SUCCESS
57  *\li	#ISC_R_NOMEMORY
58  */
59 
60 unsigned int
61 dns_order_find(dns_order_t *order, const dns_name_t *name,
62 	       dns_rdatatype_t rdtype, dns_rdataclass_t rdclass);
63 /*%<
64  * Find the first matching entry on the list.
65  *
66  * Requires:
67  *\li	'order' to be valid.
68  *\li	'name' to be valid.
69  *
70  * Returns the mode set by dns_order_add() or zero.
71  */
72 
73 void
74 dns_order_attach(dns_order_t *source, dns_order_t **target);
75 /*%<
76  * Attach to the 'source' object.
77  *
78  * Requires:
79  * \li	'source' to be valid.
80  *\li	'target' to be non NULL and '*target == NULL'.
81  */
82 
83 void
84 dns_order_detach(dns_order_t **orderp);
85 /*%<
86  * Detach from the object.  Clean up if last this was the last
87  * reference.
88  *
89  * Requires:
90  *\li	'*orderp' to be valid.
91  */
92 
93 ISC_LANG_ENDDECLS
94 
95 #endif /* DNS_ORDER_H */
96