order.h revision 135446
1202719Sgabor/*
2202719Sgabor * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3202719Sgabor * Copyright (C) 2002  Internet Software Consortium.
4202719Sgabor *
5202719Sgabor * Permission to use, copy, modify, and distribute this software for any
6202719Sgabor * purpose with or without fee is hereby granted, provided that the above
7202719Sgabor * copyright notice and this permission notice appear in all copies.
8202719Sgabor *
9202719Sgabor * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10202719Sgabor * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11202719Sgabor * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12202719Sgabor * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13202719Sgabor * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14202719Sgabor * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15202719Sgabor * PERFORMANCE OF THIS SOFTWARE.
16202719Sgabor */
17202719Sgabor
18202719Sgabor/* $Id: order.h,v 1.2.202.3 2004/03/08 09:04:37 marka Exp $ */
19202719Sgabor
20202719Sgabor#ifndef DNS_ORDER_H
21202719Sgabor#define DNS_ORDER_H 1
22202719Sgabor
23202719Sgabor#include <isc/lang.h>
24202719Sgabor#include <isc/types.h>
25202719Sgabor
26202719Sgabor#include <dns/types.h>
27202719Sgabor
28202719SgaborISC_LANG_BEGINDECLS
29202719Sgabor
30202719Sgaborisc_result_t
31202719Sgabordns_order_create(isc_mem_t *mctx, dns_order_t **orderp);
32202719Sgabor/*
33202719Sgabor * Create a order object.
34202719Sgabor *
35202719Sgabor * Requires:
36202719Sgabor * 	'orderp' to be non NULL and '*orderp == NULL'.
37202719Sgabor *	'mctx' to be valid.
38202719Sgabor *
39202719Sgabor * Returns:
40202719Sgabor *	ISC_R_SUCCESS
41202719Sgabor *	ISC_R_NOMEMORY
42202719Sgabor */
43202719Sgabor
44202719Sgaborisc_result_t
45202719Sgabordns_order_add(dns_order_t *order, dns_name_t *name,
46202719Sgabor	      dns_rdatatype_t rdtype, dns_rdataclass_t rdclass,
47202719Sgabor	      unsigned int mode);
48202719Sgabor/*
49202719Sgabor * Add a entry to the end of the order list.
50202719Sgabor *
51202719Sgabor * Requires:
52202719Sgabor * 	'order' to be valid.
53202719Sgabor *	'name' to be valid.
54202719Sgabor *	'mode' to be one of DNS_RDATASERATTR_RANDOMIZE,
55202719Sgabor *		DNS_RDATASERATTR_RANDOMIZE or zero (DNS_RDATASERATTR_CYCLIC).
56202719Sgabor *
57202719Sgabor * Returns:
58202719Sgabor *	ISC_R_SUCCESS
59202719Sgabor *	ISC_R_NOMEMORY
60202719Sgabor */
61202719Sgabor
62202719Sgaborunsigned int
63202719Sgabordns_order_find(dns_order_t *order, dns_name_t *name,
64202719Sgabor	       dns_rdatatype_t rdtype, dns_rdataclass_t rdclass);
65202719Sgabor/*
66202719Sgabor * Find the first matching entry on the list.
67202719Sgabor *
68202719Sgabor * Requires:
69202719Sgabor *	'order' to be valid.
70202719Sgabor *	'name' to be valid.
71202719Sgabor *
72202719Sgabor * Returns the mode set by dns_order_add() or zero.
73202719Sgabor */
74202719Sgabor
75202719Sgaborvoid
76202719Sgabordns_order_attach(dns_order_t *source, dns_order_t **target);
77202719Sgabor/*
78202719Sgabor * Attach to the 'source' object.
79202719Sgabor *
80202719Sgabor * Requires:
81202719Sgabor * 	'source' to be valid.
82202719Sgabor *	'target' to be non NULL and '*target == NULL'.
83202719Sgabor */
84202719Sgabor
85202719Sgaborvoid
86202719Sgabordns_order_detach(dns_order_t **orderp);
87202719Sgabor/*
88202719Sgabor * Detach from the object.  Clean up if last this was the last
89202719Sgabor * reference.
90202719Sgabor *
91202719Sgabor * Requires:
92202719Sgabor *	'*orderp' to be valid.
93202719Sgabor */
94202719Sgabor
95202719SgaborISC_LANG_ENDDECLS
96202719Sgabor
97202719Sgabor#endif /* DNS_ORDER_H */
98202719Sgabor