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