"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/dns/include/dns/dyndb.h" (7 Sep 2020, 4834 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


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 "dyndb.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 DNS_DYNDB_H
   13 #define DNS_DYNDB_H
   14 
   15 #include <stdbool.h>
   16 
   17 #include <isc/types.h>
   18 
   19 #include <dns/types.h>
   20 
   21 ISC_LANG_BEGINDECLS
   22 
   23 /*!
   24  * \brief
   25  * Context for initializing a dyndb module.
   26  *
   27  * This structure passes global server data to which a dyndb
   28  * module will need access -- the server memory context, hash
   29  * initializer, log context, etc.  The structure doesn't persist
   30  * beyond configuring the dyndb module. The module's register function
   31  * should attach to all reference-counted variables and its destroy
   32  * function should detach from them.
   33  */
   34 struct dns_dyndbctx {
   35     unsigned int    magic;
   36     const void  *hashinit;
   37     isc_mem_t   *mctx;
   38     isc_log_t   *lctx;
   39     dns_view_t  *view;
   40     dns_zonemgr_t   *zmgr;
   41     isc_task_t  *task;
   42     isc_timermgr_t  *timermgr;
   43     bool    *refvar;
   44 };
   45 
   46 #define DNS_DYNDBCTX_MAGIC  ISC_MAGIC('D', 'd', 'b', 'c')
   47 #define DNS_DYNDBCTX_VALID(d)   ISC_MAGIC_VALID(d, DNS_DYNDBCTX_MAGIC)
   48 
   49 /*
   50  * API version
   51  *
   52  * When the API changes, increment DNS_DYNDB_VERSION. If the
   53  * change is backward-compatible (e.g., adding a new function call
   54  * but not changing or removing an old one), increment DNS_DYNDB_AGE;
   55  * if not, set DNS_DYNDB_AGE to 0.
   56  */
   57 #ifndef DNS_DYNDB_VERSION
   58 #define DNS_DYNDB_VERSION 1
   59 #define DNS_DYNDB_AGE 0
   60 #endif
   61 
   62 typedef isc_result_t dns_dyndb_register_t(isc_mem_t *mctx,
   63                       const char *name,
   64                       const char *parameters,
   65                       const char *file,
   66                       unsigned long line,
   67                       const dns_dyndbctx_t *dctx,
   68                       void **instp);
   69 /*%
   70  * Called when registering a new driver instance. 'name' must be unique.
   71  * 'parameters' contains the driver configuration text. 'dctx' is the
   72  * initialization context set up in dns_dyndb_createctx().
   73  *
   74  * '*instp' must be set to the driver instance handle if the function
   75  * is successful.
   76  *
   77  * Returns:
   78  *\li   #ISC_R_SUCCESS
   79  *\li   #ISC_R_NOMEMORY
   80  *\li   Other errors are possible
   81  */
   82 
   83 typedef void dns_dyndb_destroy_t(void **instp);
   84 /*%
   85  * Destroy a driver instance. Dereference any reference-counted
   86  * variables passed in 'dctx' and 'inst' in the register function.
   87  *
   88  * \c *instp must be set to \c NULL by the function before it returns.
   89  */
   90 
   91 typedef int dns_dyndb_version_t(unsigned int *flags);
   92 /*%
   93  * Return the API version number a dyndb module was compiled with.
   94  *
   95  * If the returned version number is no greater than than
   96  * DNS_DYNDB_VERSION, and no less than DNS_DYNDB_VERSION - DNS_DYNDB_AGE,
   97  * then the module is API-compatible with named.
   98  *
   99  * 'flags' is currently unused and may be NULL, but could be used in
  100  * the future to pass back driver capabilities or other information.
  101  */
  102 
  103 isc_result_t
  104 dns_dyndb_load(const char *libname, const char *name, const char *parameters,
  105            const char *file, unsigned long line, isc_mem_t *mctx,
  106            const dns_dyndbctx_t *dctx);
  107 /*%
  108  * Load a dyndb module.
  109  *
  110  * This loads a dyndb module using dlopen() or equivalent, calls its register
  111  * function (see dns_dyndb_register_t above), and if successful, adds
  112  * the instance handle to a list of dyndb instances so it can be cleaned
  113  * up later.
  114  *
  115  * 'file' and 'line' can be used to indicate the name of the file and
  116  * the line number from which the parameters were taken, so that logged
  117  * error messages, if any, will display the correct locations.
  118  *
  119  * Returns:
  120  *\li   #ISC_R_SUCCESS
  121  *\li   #ISC_R_NOMEMORY
  122  *\li   Other errors are possible
  123  */
  124 
  125 void
  126 dns_dyndb_cleanup(bool exiting);
  127 /*%
  128  * Shut down and destroy all running dyndb modules.
  129  *
  130  * 'exiting' indicates whether the server is shutting down,
  131  * as opposed to merely being reconfigured.
  132  */
  133 
  134 isc_result_t
  135 dns_dyndb_createctx(isc_mem_t *mctx, const void *hashinit, isc_log_t *lctx,
  136             dns_view_t *view, dns_zonemgr_t *zmgr, isc_task_t *task,
  137             isc_timermgr_t *tmgr, dns_dyndbctx_t **dctxp);
  138 /*%
  139  * Create a dyndb initialization context structure, with
  140  * pointers to structures in the server that the dyndb module will
  141  * need to access (view, zone manager, memory context, hash initializer,
  142  * etc). This structure is expected to last only until all dyndb
  143  * modules have been loaded and initialized; after that it will be
  144  * destroyed with dns_dyndb_destroyctx().
  145  *
  146  * Returns:
  147  *\li   #ISC_R_SUCCESS
  148  *\li   #ISC_R_NOMEMORY
  149  *\li   Other errors are possible
  150  */
  151 
  152 void
  153 dns_dyndb_destroyctx(dns_dyndbctx_t **dctxp);
  154 /*%
  155  * Destroys a dyndb initialization context structure; all
  156  * reference-counted members are detached and the structure is freed.
  157  */
  158 
  159 ISC_LANG_ENDDECLS
  160 
  161 #endif /* DNS_DYNDB_H */