"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/ns/include/ns/sortlist.h" (4 Sep 2020, 2413 Bytes) of package /linux/misc/dns/bind9/9.17.5/bind-9.17.5.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sortlist.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #ifndef NS_SORTLIST_H
   13 #define NS_SORTLIST_H 1
   14 
   15 /*! \file */
   16 
   17 #include <isc/types.h>
   18 
   19 #include <dns/acl.h>
   20 #include <dns/types.h>
   21 
   22 /*%
   23  * Type for callback functions that rank addresses.
   24  */
   25 typedef int (*dns_addressorderfunc_t)(const isc_netaddr_t *address,
   26                       const void *     arg);
   27 
   28 /*%
   29  * Return value type for setup_sortlist.
   30  */
   31 typedef enum {
   32     NS_SORTLISTTYPE_NONE,
   33     NS_SORTLISTTYPE_1ELEMENT,
   34     NS_SORTLISTTYPE_2ELEMENT
   35 } ns_sortlisttype_t;
   36 
   37 ns_sortlisttype_t
   38 ns_sortlist_setup(dns_acl_t *acl, dns_aclenv_t *env, isc_netaddr_t *clientaddr,
   39           const void **argp);
   40 /*%<
   41  * Find the sortlist statement in 'acl' (for ACL environment 'env')
   42  * that applies to 'clientaddr', if any.
   43  *
   44  * If a 1-element sortlist item applies, return NS_SORTLISTTYPE_1ELEMENT and
   45  * make '*argp' point to the matching subelement.
   46  *
   47  * If a 2-element sortlist item applies, return NS_SORTLISTTYPE_2ELEMENT and
   48  * make '*argp' point to ACL that forms the second element.
   49  *
   50  * If no sortlist item applies, return NS_SORTLISTTYPE_NONE and set '*argp'
   51  * to NULL.
   52  */
   53 
   54 int
   55 ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg);
   56 /*%<
   57  * Find the sort order of 'addr' in 'arg', the matching element
   58  * of a 1-element top-level sortlist statement.
   59  */
   60 
   61 int
   62 ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg);
   63 /*%<
   64  * Find the sort order of 'addr' in 'arg', a topology-like
   65  * ACL forming the second element in a 2-element top-level
   66  * sortlist statement.
   67  */
   68 
   69 void
   70 ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, dns_aclenv_t *env,
   71             isc_netaddr_t *     client_addr,
   72             dns_addressorderfunc_t *orderp, const void **argp);
   73 /*%<
   74  * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any.
   75  * If a sortlist statement applies, return in '*orderp' a pointer to a function
   76  * for ranking network addresses based on that sortlist statement, and in
   77  * '*argp' an argument to pass to said function.  If no sortlist statement
   78  * applies, set '*orderp' and '*argp' to NULL.
   79  */
   80 
   81 #endif /* NS_SORTLIST_H */