PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/bind9/bin/named/include/named/sortlist.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 87 lines | 23 code | 12 blank | 52 comment | 0 complexity | 5362cc311b7f20e2d3f56506e02a3197 MD5 | raw file
 1/*
 2 * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
 3 * Copyright (C) 2000, 2001  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: sortlist.h,v 1.11 2007/06/19 23:46:59 tbox Exp $ */
19
20#ifndef NAMED_SORTLIST_H
21#define NAMED_SORTLIST_H 1
22
23/*! \file */
24
25#include <isc/types.h>
26
27#include <dns/types.h>
28
29/*%
30 * Type for callback functions that rank addresses.
31 */
32typedef int 
33(*dns_addressorderfunc_t)(const isc_netaddr_t *address, const void *arg);
34
35/*%
36 * Return value type for setup_sortlist.
37 */
38typedef enum {
39	NS_SORTLISTTYPE_NONE,
40	NS_SORTLISTTYPE_1ELEMENT,
41	NS_SORTLISTTYPE_2ELEMENT
42} ns_sortlisttype_t;
43
44ns_sortlisttype_t
45ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr,
46		  const void **argp);
47/*%<
48 * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any.
49 *
50 * If a 1-element sortlist item applies, return NS_SORTLISTTYPE_1ELEMENT and
51 * make '*argp' point to the matching subelement.
52 *
53 * If a 2-element sortlist item applies, return NS_SORTLISTTYPE_2ELEMENT and
54 * make '*argp' point to ACL that forms the second element.
55 *
56 * If no sortlist item applies, return NS_SORTLISTTYPE_NONE and set '*argp'
57 * to NULL.
58 */
59
60int
61ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg);
62/*%<
63 * Find the sort order of 'addr' in 'arg', the matching element
64 * of a 1-element top-level sortlist statement.
65 */
66
67int
68ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg);
69/*%<
70 * Find the sort order of 'addr' in 'arg', a topology-like
71 * ACL forming the second element in a 2-element top-level
72 * sortlist statement.
73 */
74
75void
76ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, isc_netaddr_t *client_addr,
77			dns_addressorderfunc_t *orderp,
78			const void **argp);
79/*%<
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.
85 */
86
87#endif /* NAMED_SORTLIST_H */