"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/ns/include/ns/server.h" (4 Sep 2020, 4629 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 "server.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_SERVER_H
   13 #define NS_SERVER_H 1
   14 
   15 /*! \file */
   16 
   17 #include <inttypes.h>
   18 #include <stdbool.h>
   19 
   20 #include <isc/fuzz.h>
   21 #include <isc/log.h>
   22 #include <isc/magic.h>
   23 #include <isc/quota.h>
   24 #include <isc/random.h>
   25 #include <isc/sockaddr.h>
   26 #include <isc/types.h>
   27 
   28 #include <dns/acl.h>
   29 #include <dns/types.h>
   30 
   31 #include <ns/types.h>
   32 
   33 #define NS_EVENT_CLIENTCONTROL (ISC_EVENTCLASS_NS + 0)
   34 
   35 #define NS_SERVER_LOGQUERIES   0x00000001U /*%< log queries */
   36 #define NS_SERVER_NOAA         0x00000002U /*%< -T noaa */
   37 #define NS_SERVER_NOSOA        0x00000004U /*%< -T nosoa */
   38 #define NS_SERVER_NONEAREST    0x00000008U /*%< -T nonearest */
   39 #define NS_SERVER_NOEDNS       0x00000020U /*%< -T noedns */
   40 #define NS_SERVER_DROPEDNS     0x00000040U /*%< -T dropedns */
   41 #define NS_SERVER_NOTCP        0x00000080U /*%< -T notcp */
   42 #define NS_SERVER_DISABLE4     0x00000100U /*%< -6 */
   43 #define NS_SERVER_DISABLE6     0x00000200U /*%< -4 */
   44 #define NS_SERVER_FIXEDLOCAL   0x00000400U /*%< -T fixedlocal */
   45 #define NS_SERVER_SIGVALINSECS 0x00000800U /*%< -T sigvalinsecs */
   46 #define NS_SERVER_EDNSFORMERR  0x00001000U /*%< -T ednsformerr (STD13) */
   47 #define NS_SERVER_EDNSNOTIMP   0x00002000U /*%< -T ednsnotimp */
   48 #define NS_SERVER_EDNSREFUSED  0x00004000U /*%< -T ednsrefused */
   49 
   50 /*%
   51  * Type for callback function to get hostname.
   52  */
   53 typedef isc_result_t (*ns_hostnamecb_t)(char *buf, size_t len);
   54 
   55 /*%
   56  * Type for callback function to signal the fuzzer thread
   57  * when built with AFL.
   58  */
   59 typedef void (*ns_fuzzcb_t)(void);
   60 
   61 /*%
   62  * Type for callback function to get the view that can answer a query.
   63  */
   64 typedef isc_result_t (*ns_matchview_t)(
   65     isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr, dns_message_t *message,
   66     dns_aclenv_t *env, isc_result_t *sigresultp, dns_view_t **viewp);
   67 
   68 /*%
   69  * Server context.
   70  */
   71 struct ns_server {
   72     unsigned int magic;
   73     isc_mem_t *  mctx;
   74 
   75     isc_refcount_t references;
   76 
   77     /*% Server cookie secret and algorithm */
   78     unsigned char      secret[32];
   79     ns_cookiealg_t     cookiealg;
   80     ns_altsecretlist_t altsecrets;
   81     bool           answercookie;
   82 
   83     /*% Quotas */
   84     isc_quota_t recursionquota;
   85     isc_quota_t tcpquota;
   86     isc_quota_t xfroutquota;
   87 
   88     /*% Test options and other configurables */
   89     uint32_t options;
   90 
   91     dns_acl_t *    blackholeacl;
   92     dns_acl_t *    keepresporder;
   93     uint16_t       udpsize;
   94     uint16_t       transfer_tcp_message_size;
   95     bool           interface_auto;
   96     dns_tkeyctx_t *tkeyctx;
   97 
   98     /*% Server id for NSID */
   99     char *      server_id;
  100     ns_hostnamecb_t gethostname;
  101 
  102     /*% Fuzzer callback */
  103     isc_fuzztype_t fuzztype;
  104     ns_fuzzcb_t    fuzznotify;
  105 
  106     /*% Callback to find a matching view for a query */
  107     ns_matchview_t matchingview;
  108 
  109     /*% Stats counters */
  110     ns_stats_t * nsstats;
  111     dns_stats_t *rcvquerystats;
  112     dns_stats_t *opcodestats;
  113     dns_stats_t *rcodestats;
  114 
  115     isc_stats_t *udpinstats4;
  116     isc_stats_t *udpoutstats4;
  117     isc_stats_t *udpinstats6;
  118     isc_stats_t *udpoutstats6;
  119 
  120     isc_stats_t *tcpinstats4;
  121     isc_stats_t *tcpoutstats4;
  122     isc_stats_t *tcpinstats6;
  123     isc_stats_t *tcpoutstats6;
  124 };
  125 
  126 struct ns_altsecret {
  127     ISC_LINK(ns_altsecret_t) link;
  128     unsigned char secret[32];
  129 };
  130 
  131 isc_result_t
  132 ns_server_create(isc_mem_t *mctx, ns_matchview_t matchingview,
  133          ns_server_t **sctxp);
  134 /*%<
  135  * Create a server context object with default settings.
  136  */
  137 
  138 void
  139 ns_server_attach(ns_server_t *src, ns_server_t **dest);
  140 /*%<
  141  * Attach a server context.
  142  *
  143  * Requires:
  144  *\li   'src' is valid.
  145  */
  146 
  147 void
  148 ns_server_detach(ns_server_t **sctxp);
  149 /*%<
  150  * Detach from a server context.  If its reference count drops to zero, destroy
  151  * it, freeing its memory.
  152  *
  153  * Requires:
  154  *\li   '*sctxp' is valid.
  155  * Ensures:
  156  *\li   '*sctxp' is NULL on return.
  157  */
  158 
  159 isc_result_t
  160 ns_server_setserverid(ns_server_t *sctx, const char *serverid);
  161 /*%<
  162  * Set sctx->server_id to 'serverid'. If it was set previously, free the memory.
  163  *
  164  * Requires:
  165  *\li   'sctx' is valid.
  166  */
  167 
  168 void
  169 ns_server_setoption(ns_server_t *sctx, unsigned int option, bool value);
  170 /*%<
  171  *  Set the given options on (if 'value' == #true)
  172  *  or off (if 'value' == #false).
  173  *
  174  * Requires:
  175  *\li   'sctx' is valid
  176  */
  177 
  178 bool
  179 ns_server_getoption(ns_server_t *sctx, unsigned int option);
  180 /*%<
  181  *  Returns the current value of the specified server option.
  182  *
  183  * Requires:
  184  *\li   'sctx' is valid.
  185  */
  186 #endif /* NS_SERVER_H */