2 * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and 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.
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.
18 /* $Id: sortlist.h,v 1.5.18.4 2006/03/02 00:37:21 marka Exp $ */
20 #ifndef NAMED_SORTLIST_H
21 #define NAMED_SORTLIST_H 1
25 #include <isc/types.h>
27 #include <dns/types.h>
30 * Type for callback functions that rank addresses.
33 (*dns_addressorderfunc_t)(const isc_netaddr_t *address, const void *arg);
36 * Return value type for setup_sortlist.
40 NS_SORTLISTTYPE_1ELEMENT,
41 NS_SORTLISTTYPE_2ELEMENT
45 ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr,
48 * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any.
50 * If a 1-element sortlist item applies, return NS_SORTLISTTYPE_1ELEMENT and
51 * make '*argp' point to the matching subelement.
53 * If a 2-element sortlist item applies, return NS_SORTLISTTYPE_2ELEMENT and
54 * make '*argp' point to ACL that forms the second element.
56 * If no sortlist item applies, return NS_SORTLISTTYPE_NONE and set '*argp'
61 ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg);
63 * Find the sort order of 'addr' in 'arg', the matching element
64 * of a 1-element top-level sortlist statement.
68 ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg);
70 * Find the sort order of 'addr' in 'arg', a topology-like
71 * ACL forming the second element in a 2-element top-level
76 ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, isc_netaddr_t *client_addr,
77 dns_addressorderfunc_t *orderp,
80 * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any.
81 * If a sortlist statement applies, return in '*orderp' a pointer to a function
82 * for ranking network addresses based on that sortlist statement, and in
83 * '*argp' an argument to pass to said function. If no sortlist statement
84 * applies, set '*orderp' and '*argp' to NULL.
87 #endif /* NAMED_SORTLIST_H */