1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 2002  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18234010Sdougb/* $Id: order.h,v 1.9 2007/06/19 23:47:17 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef DNS_ORDER_H
21135446Strhodes#define DNS_ORDER_H 1
22135446Strhodes
23193149Sdougb/*! \file dns/order.h */
24170222Sdougb
25135446Strhodes#include <isc/lang.h>
26135446Strhodes#include <isc/types.h>
27135446Strhodes
28135446Strhodes#include <dns/types.h>
29135446Strhodes
30135446StrhodesISC_LANG_BEGINDECLS
31135446Strhodes
32135446Strhodesisc_result_t
33135446Strhodesdns_order_create(isc_mem_t *mctx, dns_order_t **orderp);
34170222Sdougb/*%<
35135446Strhodes * Create a order object.
36135446Strhodes *
37135446Strhodes * Requires:
38170222Sdougb * \li	'orderp' to be non NULL and '*orderp == NULL'.
39170222Sdougb *\li	'mctx' to be valid.
40135446Strhodes *
41135446Strhodes * Returns:
42170222Sdougb *\li	ISC_R_SUCCESS
43170222Sdougb *\li	ISC_R_NOMEMORY
44135446Strhodes */
45135446Strhodes
46135446Strhodesisc_result_t
47135446Strhodesdns_order_add(dns_order_t *order, dns_name_t *name,
48135446Strhodes	      dns_rdatatype_t rdtype, dns_rdataclass_t rdclass,
49135446Strhodes	      unsigned int mode);
50170222Sdougb/*%<
51135446Strhodes * Add a entry to the end of the order list.
52135446Strhodes *
53135446Strhodes * Requires:
54170222Sdougb * \li	'order' to be valid.
55170222Sdougb *\li	'name' to be valid.
56170222Sdougb *\li	'mode' to be one of #DNS_RDATASERATTR_RANDOMIZE,
57170222Sdougb *		#DNS_RDATASERATTR_RANDOMIZE or zero (#DNS_RDATASERATTR_CYCLIC).
58135446Strhodes *
59135446Strhodes * Returns:
60170222Sdougb *\li	#ISC_R_SUCCESS
61170222Sdougb *\li	#ISC_R_NOMEMORY
62135446Strhodes */
63135446Strhodes
64135446Strhodesunsigned int
65135446Strhodesdns_order_find(dns_order_t *order, dns_name_t *name,
66135446Strhodes	       dns_rdatatype_t rdtype, dns_rdataclass_t rdclass);
67170222Sdougb/*%<
68135446Strhodes * Find the first matching entry on the list.
69135446Strhodes *
70135446Strhodes * Requires:
71170222Sdougb *\li	'order' to be valid.
72170222Sdougb *\li	'name' to be valid.
73135446Strhodes *
74135446Strhodes * Returns the mode set by dns_order_add() or zero.
75135446Strhodes */
76135446Strhodes
77135446Strhodesvoid
78135446Strhodesdns_order_attach(dns_order_t *source, dns_order_t **target);
79170222Sdougb/*%<
80135446Strhodes * Attach to the 'source' object.
81135446Strhodes *
82135446Strhodes * Requires:
83170222Sdougb * \li	'source' to be valid.
84170222Sdougb *\li	'target' to be non NULL and '*target == NULL'.
85135446Strhodes */
86135446Strhodes
87135446Strhodesvoid
88135446Strhodesdns_order_detach(dns_order_t **orderp);
89170222Sdougb/*%<
90135446Strhodes * Detach from the object.  Clean up if last this was the last
91135446Strhodes * reference.
92135446Strhodes *
93135446Strhodes * Requires:
94170222Sdougb *\li	'*orderp' to be valid.
95135446Strhodes */
96135446Strhodes
97135446StrhodesISC_LANG_ENDDECLS
98135446Strhodes
99135446Strhodes#endif /* DNS_ORDER_H */
100