adb.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2008, 2011, 2013, 2014  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2003  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: adb.h,v 1.88 2011/12/05 17:10:51 each Exp $ */
00019 
00020 #ifndef DNS_ADB_H
00021 #define DNS_ADB_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/adb.h
00028  *\brief
00029  * DNS Address Database
00030  *
00031  * This module implements an address database (ADB) for mapping a name
00032  * to an isc_sockaddr_t. It also provides statistical information on
00033  * how good that address might be.
00034  *
00035  * A client will pass in a dns_name_t, and the ADB will walk through
00036  * the rdataset looking up addresses associated with the name.  If it
00037  * is found on the internal lists, a structure is filled in with the
00038  * address information and stats for found addresses.
00039  *
00040  * If the name cannot be found on the internal lists, a new entry will
00041  * be created for a name if all the information needed can be found
00042  * in the zone table or cache.  This new address will then be returned.
00043  *
00044  * If a request must be made to remote servers to satisfy a name lookup,
00045  * this module will start fetches to try to complete these addresses.  When
00046  * at least one more completes, an event is sent to the caller.  If none of
00047  * them resolve before the fetch times out, an event indicating this is
00048  * sent instead.
00049  *
00050  * Records are stored internally until a timer expires. The timer is the
00051  * smaller of the TTL or signature validity period.
00052  *
00053  * Lameness is stored per <qname,qtype> tuple, and this data hangs off each
00054  * address field.  When an address is marked lame for a given tuple the address
00055  * will not be returned to a caller.
00056  *
00057  *
00058  * MP:
00059  *
00060  *\li   The ADB takes care of all necessary locking.
00061  *
00062  *\li   Only the task which initiated the name lookup can cancel the lookup.
00063  *
00064  *
00065  * Security:
00066  *
00067  *\li   None, since all data stored is required to be pre-filtered.
00068  *      (Cache needs to be sane, fetches return bounds-checked and sanity-
00069  *       checked data, caller passes a good dns_name_t for the zone, etc)
00070  */
00071 
00072 /***
00073  *** Imports
00074  ***/
00075 
00076 #include <isc/lang.h>
00077 #include <isc/magic.h>
00078 #include <isc/mem.h>
00079 #include <isc/sockaddr.h>
00080 
00081 #include <dns/types.h>
00082 #include <dns/view.h>
00083 
00084 ISC_LANG_BEGINDECLS
00085 
00086 /***
00087  *** Magic number checks
00088  ***/
00089 
00090 #define DNS_ADBFIND_MAGIC         ISC_MAGIC('a','d','b','H')
00091 #define DNS_ADBFIND_VALID(x)      ISC_MAGIC_VALID(x, DNS_ADBFIND_MAGIC)
00092 #define DNS_ADBADDRINFO_MAGIC     ISC_MAGIC('a','d','A','I')
00093 #define DNS_ADBADDRINFO_VALID(x)  ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC)
00094 
00095 
00096 /***
00097  *** TYPES
00098  ***/
00099 
00100 typedef struct dns_adbname              dns_adbname_t;
00101 
00102 /*!
00103  *\brief
00104  * Represents a lookup for a single name.
00105  *
00106  * On return, the client can safely use "list", and can reorder the list.
00107  * Items may not be _deleted_ from this list, however, or added to it
00108  * other than by using the dns_adb_*() API.
00109  */
00110 struct dns_adbfind {
00111         /* Public */
00112         unsigned int                    magic;          /*%< RO: magic */
00113         dns_adbaddrinfolist_t           list;           /*%< RO: list of addrs */
00114         unsigned int                    query_pending;  /*%< RO: partial list */
00115         unsigned int                    partial_result; /*%< RO: addrs missing */
00116         unsigned int                    options;        /*%< RO: options */
00117         isc_result_t                    result_v4;      /*%< RO: v4 result */
00118         isc_result_t                    result_v6;      /*%< RO: v6 result */
00119         ISC_LINK(dns_adbfind_t)         publink;        /*%< RW: client use */
00120 
00121         /* Private */
00122         isc_mutex_t                     lock;           /* locks all below */
00123         in_port_t                       port;
00124         int                             name_bucket;
00125         unsigned int                    flags;
00126         dns_adbname_t                  *adbname;
00127         dns_adb_t                      *adb;
00128         isc_event_t                     event;
00129         ISC_LINK(dns_adbfind_t)         plink;
00130 };
00131 
00132 /*
00133  * _INET:
00134  * _INET6:
00135  *      return addresses of that type.
00136  *
00137  * _EMPTYEVENT:
00138  *      Only schedule an event if no addresses are known.
00139  *      Must set _WANTEVENT for this to be meaningful.
00140  *
00141  * _WANTEVENT:
00142  *      An event is desired.  Check this bit in the returned find to see
00143  *      if one will actually be generated.
00144  *
00145  * _AVOIDFETCHES:
00146  *      If set, fetches will not be generated unless no addresses are
00147  *      available in any of the address families requested.
00148  *
00149  * _STARTATZONE:
00150  *      Fetches will start using the closest zone data or use the root servers.
00151  *      This is useful for reestablishing glue that has expired.
00152  *
00153  * _GLUEOK:
00154  * _HINTOK:
00155  *      Glue or hints are ok.  These are used when matching names already
00156  *      in the adb, and when dns databases are searched.
00157  *
00158  * _RETURNLAME:
00159  *      Return lame servers in a find, so that all addresses are returned.
00160  *
00161  * _LAMEPRUNED:
00162  *      At least one address was omitted from the list because it was lame.
00163  *      This bit will NEVER be set if _RETURNLAME is set in the createfind().
00164  */
00165 /*% Return addresses of type INET. */
00166 #define DNS_ADBFIND_INET                0x00000001
00167 /*% Return addresses of type INET6. */
00168 #define DNS_ADBFIND_INET6               0x00000002
00169 #define DNS_ADBFIND_ADDRESSMASK         0x00000003
00170 /*%
00171  *      Only schedule an event if no addresses are known.
00172  *      Must set _WANTEVENT for this to be meaningful.
00173  */
00174 #define DNS_ADBFIND_EMPTYEVENT          0x00000004
00175 /*%
00176  *      An event is desired.  Check this bit in the returned find to see
00177  *      if one will actually be generated.
00178  */
00179 #define DNS_ADBFIND_WANTEVENT           0x00000008
00180 /*%
00181  *      If set, fetches will not be generated unless no addresses are
00182  *      available in any of the address families requested.
00183  */
00184 #define DNS_ADBFIND_AVOIDFETCHES        0x00000010
00185 /*%
00186  *      Fetches will start using the closest zone data or use the root servers.
00187  *      This is useful for reestablishing glue that has expired.
00188  */
00189 #define DNS_ADBFIND_STARTATZONE         0x00000020
00190 /*%
00191  *      Glue or hints are ok.  These are used when matching names already
00192  *      in the adb, and when dns databases are searched.
00193  */
00194 #define DNS_ADBFIND_GLUEOK              0x00000040
00195 /*%
00196  *      Glue or hints are ok.  These are used when matching names already
00197  *      in the adb, and when dns databases are searched.
00198  */
00199 #define DNS_ADBFIND_HINTOK              0x00000080
00200 /*%
00201  *      Return lame servers in a find, so that all addresses are returned.
00202  */
00203 #define DNS_ADBFIND_RETURNLAME          0x00000100
00204 /*%
00205  *      Only schedule an event if no addresses are known.
00206  *      Must set _WANTEVENT for this to be meaningful.
00207  */
00208 #define DNS_ADBFIND_LAMEPRUNED          0x00000200
00209 
00210 /*%
00211  * The answers to queries come back as a list of these.
00212  */
00213 struct dns_adbaddrinfo {
00214         unsigned int                    magic;          /*%< private */
00215 
00216         isc_sockaddr_t                  sockaddr;       /*%< [rw] */
00217         unsigned int                    srtt;           /*%< [rw] microsecs */
00218         isc_dscp_t                      dscp;
00219 
00220         unsigned int                    flags;          /*%< [rw] */
00221         dns_adbentry_t                 *entry;          /*%< private */
00222         ISC_LINK(dns_adbaddrinfo_t)     publink;
00223 };
00224 
00225 /*!<
00226  * The event sent to the caller task is just a plain old isc_event_t.  It
00227  * contains no data other than a simple status, passed in the "type" field
00228  * to indicate that another address resolved, or all partially resolved
00229  * addresses have failed to resolve.
00230  *
00231  * "sender" is the dns_adbfind_t used to issue this query.
00232  *
00233  * This is simply a standard event, with the "type" set to:
00234  *
00235  *\li   #DNS_EVENT_ADBMOREADDRESSES   -- another address resolved.
00236  *\li   #DNS_EVENT_ADBNOMOREADDRESSES -- all pending addresses failed,
00237  *                                      were canceled, or otherwise will
00238  *                                      not be usable.
00239  *\li   #DNS_EVENT_ADBCANCELED       -- The request was canceled by a
00240  *                                      3rd party.
00241  *\li   #DNS_EVENT_ADBNAMEDELETED     -- The name was deleted, so this request
00242  *                                      was canceled.
00243  *
00244  * In each of these cases, the addresses returned by the initial call
00245  * to dns_adb_createfind() can still be used until they are no longer needed.
00246  */
00247 
00248 /****
00249  **** FUNCTIONS
00250  ****/
00251 
00252 
00253 isc_result_t
00254 dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *tmgr,
00255                isc_taskmgr_t *taskmgr, dns_adb_t **newadb);
00256 /*%<
00257  * Create a new ADB.
00258  *
00259  * Notes:
00260  *
00261  *\li   Generally, applications should not create an ADB directly, but
00262  *      should instead call dns_view_createresolver().
00263  *
00264  * Requires:
00265  *
00266  *\li   'mem' must be a valid memory context.
00267  *
00268  *\li   'view' be a pointer to a valid view.
00269  *
00270  *\li   'tmgr' be a pointer to a valid timer manager.
00271  *
00272  *\li   'taskmgr' be a pointer to a valid task manager.
00273  *
00274  *\li   'newadb' != NULL && '*newadb' == NULL.
00275  *
00276  * Returns:
00277  *
00278  *\li   #ISC_R_SUCCESS  after happiness.
00279  *\li   #ISC_R_NOMEMORY after resource allocation failure.
00280  */
00281 
00282 void
00283 dns_adb_attach(dns_adb_t *adb, dns_adb_t **adbp);
00284 /*%
00285  * Attach to an 'adb' to 'adbp'.
00286  *
00287  * Requires:
00288  *\li   'adb' to be a valid dns_adb_t, created via dns_adb_create().
00289  *\li   'adbp' to be a valid pointer to a *dns_adb_t which is initialized
00290  *      to NULL.
00291  */
00292 
00293 void
00294 dns_adb_detach(dns_adb_t **adb);
00295 /*%
00296  * Delete the ADB. Sets *ADB to NULL. Cancels any outstanding requests.
00297  *
00298  * Requires:
00299  *
00300  *\li   'adb' be non-NULL and '*adb' be a valid dns_adb_t, created via
00301  *      dns_adb_create().
00302  */
00303 
00304 void
00305 dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp);
00306 /*%
00307  * Send '*eventp' to 'task' when 'adb' has shutdown.
00308  *
00309  * Requires:
00310  *
00311  *\li   '*adb' is a valid dns_adb_t.
00312  *
00313  *\li   eventp != NULL && *eventp is a valid event.
00314  *
00315  * Ensures:
00316  *
00317  *\li   *eventp == NULL
00318  *
00319  *\li   The event's sender field is set to the value of adb when the event
00320  *      is sent.
00321  */
00322 
00323 void
00324 dns_adb_shutdown(dns_adb_t *adb);
00325 /*%<
00326  * Shutdown 'adb'.
00327  *
00328  * Requires:
00329  *
00330  * \li  '*adb' is a valid dns_adb_t.
00331  */
00332 
00333 isc_result_t
00334 dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
00335                    void *arg, dns_name_t *name, dns_name_t *qname,
00336                    dns_rdatatype_t qtype, unsigned int options,
00337                    isc_stdtime_t now, dns_name_t *target,
00338                    in_port_t port, dns_adbfind_t **find);
00339 isc_result_t
00340 dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
00341                     void *arg, dns_name_t *name, dns_name_t *qname,
00342                     dns_rdatatype_t qtype, unsigned int options,
00343                     isc_stdtime_t now, dns_name_t *target, in_port_t port,
00344                     unsigned int depth, isc_counter_t *qc,
00345                     dns_adbfind_t **find);
00346 /*%<
00347  * Main interface for clients. The adb will look up the name given in
00348  * "name" and will build up a list of found addresses, and perhaps start
00349  * internal fetches to resolve names that are unknown currently.
00350  *
00351  * If other addresses resolve after this call completes, an event will
00352  * be sent to the <task, taskaction, arg> with the sender of that event
00353  * set to a pointer to the dns_adbfind_t returned by this function.
00354  *
00355  * If no events will be generated, the *find->result_v4 and/or result_v6
00356  * members may be examined for address lookup status.  The usual #ISC_R_SUCCESS,
00357  * #ISC_R_FAILURE, #DNS_R_NXDOMAIN, and #DNS_R_NXRRSET are returned, along with
00358  * #ISC_R_NOTFOUND meaning the ADB has not _yet_ found the values.  In this
00359  * latter case, retrying may produce more addresses.
00360  *
00361  * If events will be returned, the result_v[46] members are only valid
00362  * when that event is actually returned.
00363  *
00364  * The list of addresses returned is unordered.  The caller must impose
00365  * any ordering required.  The list will not contain "known bad" addresses,
00366  * however.  For instance, it will not return hosts that are known to be
00367  * lame for the zone in question.
00368  *
00369  * The caller cannot (directly) modify the contents of the address list's
00370  * fields other than the "link" field.  All values can be read at any
00371  * time, however.
00372  *
00373  * The "now" parameter is used only for determining which entries that
00374  * have a specific time to live or expire time should be removed from
00375  * the running database.  If specified as zero, the current time will
00376  * be retrieved and used.
00377  *
00378  * If 'target' is not NULL and 'name' is an alias (i.e. the name is
00379  * CNAME'd or DNAME'd to another name), then 'target' will be updated with
00380  * the domain name that 'name' is aliased to.
00381  *
00382  * All addresses returned will have the sockaddr's port set to 'port.'
00383  * The caller may change them directly in the dns_adbaddrinfo_t since
00384  * they are copies of the internal address only.
00385  *
00386  * XXXMLG  Document options, especially the flags which control how
00387  *         events are sent.
00388  *
00389  * Requires:
00390  *
00391  *\li   *adb be a valid isc_adb_t object.
00392  *
00393  *\li   If events are to be sent, *task be a valid task,
00394  *      and isc_taskaction_t != NULL.
00395  *
00396  *\li   *name is a valid dns_name_t.
00397  *
00398  *\li   qname != NULL and *qname be a valid dns_name_t.
00399  *
00400  *\li   target == NULL or target is a valid name with a buffer.
00401  *
00402  *\li   find != NULL && *find == NULL.
00403  *
00404  * Returns:
00405  *
00406  *\li   #ISC_R_SUCCESS  Addresses might have been returned, and events will be
00407  *                      delivered for unresolved addresses.
00408  *\li   #ISC_R_NOMORE   Addresses might have been returned, but no events
00409  *                      will ever be posted for this context.  This is only
00410  *                      returned if task != NULL.
00411  *\li   #ISC_R_NOMEMORY insufficient resources
00412  *\li   #DNS_R_ALIAS    'name' is an alias for another name.
00413  *
00414  * Calls, and returns error codes from:
00415  *
00416  *\li   isc_stdtime_get()
00417  *
00418  * Notes:
00419  *
00420  *\li   No internal reference to "name" exists after this function
00421  *      returns.
00422  */
00423 
00424 void
00425 dns_adb_cancelfind(dns_adbfind_t *find);
00426 /*%<
00427  * Cancels the find, and sends the event off to the caller.
00428  *
00429  * It is an error to call dns_adb_cancelfind() on a find where
00430  * no event is wanted, or will ever be sent.
00431  *
00432  * Note:
00433  *
00434  *\li   It is possible that the real completion event was posted just
00435  *      before the dns_adb_cancelfind() call was made.  In this case,
00436  *      dns_adb_cancelfind() will do nothing.  The event callback needs
00437  *      to be prepared to find this situation (i.e. result is valid but
00438  *      the caller expects it to be canceled).
00439  *
00440  * Requires:
00441  *
00442  *\li   'find' be a valid dns_adbfind_t pointer.
00443  *
00444  *\li   events would have been posted to the task.  This can be checked
00445  *      with (find->options & DNS_ADBFIND_WANTEVENT).
00446  *
00447  * Ensures:
00448  *
00449  *\li   The event was posted to the task.
00450  */
00451 
00452 void
00453 dns_adb_destroyfind(dns_adbfind_t **find);
00454 /*%<
00455  * Destroys the find reference.
00456  *
00457  * Note:
00458  *
00459  *\li   This can only be called after the event was delivered for a
00460  *      find.  Additionally, the event MUST have been freed via
00461  *      isc_event_free() BEFORE this function is called.
00462  *
00463  * Requires:
00464  *
00465  *\li   'find' != NULL and *find be valid dns_adbfind_t pointer.
00466  *
00467  * Ensures:
00468  *
00469  *\li   No "address found" events will be posted to the originating task
00470  *      after this function returns.
00471  */
00472 
00473 void
00474 dns_adb_dump(dns_adb_t *adb, FILE *f);
00475 /*%<
00476  * This function is only used for debugging.  It will dump as much of the
00477  * state of the running system as possible.
00478  *
00479  * Requires:
00480  *
00481  *\li   adb be valid.
00482  *
00483  *\li   f != NULL, and is a file open for writing.
00484  */
00485 
00486 void
00487 dns_adb_dumpfind(dns_adbfind_t *find, FILE *f);
00488 /*%<
00489  * This function is only used for debugging.  Dump the data associated
00490  * with a find.
00491  *
00492  * Requires:
00493  *
00494  *\li   find is valid.
00495  *
00496  * \li  f != NULL, and is a file open for writing.
00497  */
00498 
00499 isc_result_t
00500 dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *qname,
00501                  dns_rdatatype_t type, isc_stdtime_t expire_time);
00502 /*%<
00503  * Mark the given address as lame for the <qname,qtype>.  expire_time should
00504  * be set to the time when the entry should expire.  That is, if it is to
00505  * expire 10 minutes in the future, it should set it to (now + 10 * 60).
00506  *
00507  * Requires:
00508  *
00509  *\li   adb be valid.
00510  *
00511  *\li   addr be valid.
00512  *
00513  *\li   qname be the qname used in the dns_adb_createfind() call.
00514  *
00515  * Returns:
00516  *
00517  *\li   #ISC_R_SUCCESS          -- all is well.
00518  *\li   #ISC_R_NOMEMORY         -- could not mark address as lame.
00519  */
00520 
00521 /*
00522  * Reasonable defaults for RTT adjustments
00523  *
00524  * (Note: these values function both as scaling factors and as
00525  * indicators of the type of RTT adjustment operation taking place.
00526  * Adjusting the scaling factors is fine, as long as they all remain
00527  * unique values.)
00528  */
00529 #define DNS_ADB_RTTADJDEFAULT           7       /*%< default scale */
00530 #define DNS_ADB_RTTADJREPLACE           0       /*%< replace with our rtt */
00531 #define DNS_ADB_RTTADJAGE               10      /*%< age this rtt */
00532 
00533 void
00534 dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
00535                    unsigned int rtt, unsigned int factor);
00536 /*%<
00537  * Mix the round trip time into the existing smoothed rtt.
00538  *
00539  * Requires:
00540  *
00541  *\li   adb be valid.
00542  *
00543  *\li   addr be valid.
00544  *
00545  *\li   0 <= factor <= 10
00546  *
00547  * Note:
00548  *
00549  *\li   The srtt in addr will be updated to reflect the new global
00550  *      srtt value.  This may include changes made by others.
00551  */
00552 
00553 void
00554 dns_adb_agesrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, isc_stdtime_t now);
00555 /*
00556  * dns_adb_agesrtt is equivalent to dns_adb_adjustsrtt with factor
00557  * equal to DNS_ADB_RTTADJAGE and the current time passed in.
00558  *
00559  * Requires:
00560  *
00561  *\li   adb be valid.
00562  *
00563  *\li   addr be valid.
00564  *
00565  * Note:
00566  *
00567  *\li   The srtt in addr will be updated to reflect the new global
00568  *      srtt value.  This may include changes made by others.
00569  */
00570 
00571 void
00572 dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
00573                     unsigned int bits, unsigned int mask);
00574 /*%
00575  * Change Flags.
00576  *
00577  * Set the flags as given by:
00578  *
00579  *\li   newflags = (oldflags & ~mask) | (bits & mask);
00580  *
00581  * Requires:
00582  *
00583  *\li   adb be valid.
00584  *
00585  *\li   addr be valid.
00586  */
00587 
00588 void
00589 dns_adb_setudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size);
00590 /*%
00591  * Update seen UDP response size.  The largest seen will be returned by
00592  * dns_adb_getudpsize().
00593  *
00594  * Requires:
00595  *
00596  *\li   adb be valid.
00597  *
00598  *\li   addr be valid.
00599  */
00600 
00601 unsigned int
00602 dns_adb_getudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
00603 /*%
00604  * Return the largest seen UDP response size.
00605  *
00606  * Requires:
00607  *
00608  *\li   adb be valid.
00609  *
00610  *\li   addr be valid.
00611  */
00612 
00613 unsigned int
00614 dns_adb_probesize(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
00615 unsigned int
00616 dns_adb_probesize2(dns_adb_t *adb, dns_adbaddrinfo_t *addr, int lookups);
00617 /*%
00618  * Return suggested EDNS UDP size based on observed responses / failures.
00619  * 'lookups' is the number of times the current lookup has been attempted.
00620  *
00621  * Requires:
00622  *
00623  *\li   adb be valid.
00624  *
00625  *\li   addr be valid.
00626  */
00627 
00628 void
00629 dns_adb_plainresponse(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
00630 /*%
00631  * Record a successful plain DNS response.
00632  *
00633  * Requires:
00634  *
00635  *\li   adb be valid.
00636  *
00637  *\li   addr be valid.
00638  */
00639 
00640 void
00641 dns_adb_timeout(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
00642 /*%
00643  * Record a plain DNS UDP query failed.
00644  *
00645  * Requires:
00646  *
00647  *\li   adb be valid.
00648  *
00649  *\li   addr be valid.
00650  */
00651 
00652 void
00653 dns_adb_ednsto(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size);
00654 /*%
00655  * Record a failed EDNS UDP response and the advertised EDNS UDP buffer size
00656  * used.
00657  *
00658  * Requires:
00659  *
00660  *\li   adb be valid.
00661  *
00662  *\li   addr be valid.
00663  */
00664 
00665 isc_boolean_t
00666 dns_adb_noedns(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
00667 /*%
00668  * Return whether EDNS should be disabled for this server.
00669  *
00670  * Requires:
00671  *
00672  *\li   adb be valid.
00673  *
00674  *\li   addr be valid.
00675  */
00676 
00677 
00678 isc_result_t
00679 dns_adb_findaddrinfo(dns_adb_t *adb, isc_sockaddr_t *sa,
00680                      dns_adbaddrinfo_t **addrp, isc_stdtime_t now);
00681 /*%<
00682  * Return a dns_adbaddrinfo_t that is associated with address 'sa'.
00683  *
00684  * Requires:
00685  *
00686  *\li   adb is valid.
00687  *
00688  *\li   sa is valid.
00689  *
00690  *\li   addrp != NULL && *addrp == NULL
00691  *
00692  * Returns:
00693  *\li   #ISC_R_SUCCESS
00694  *\li   #ISC_R_NOMEMORY
00695  *\li   #ISC_R_SHUTTINGDOWN
00696  */
00697 
00698 void
00699 dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp);
00700 /*%<
00701  * Free a dns_adbaddrinfo_t allocated by dns_adb_findaddrinfo().
00702  *
00703  * Requires:
00704  *
00705  *\li   adb is valid.
00706  *
00707  *\li   *addrp is a valid dns_adbaddrinfo_t *.
00708  */
00709 
00710 void
00711 dns_adb_flush(dns_adb_t *adb);
00712 /*%<
00713  * Flushes all cached data from the adb.
00714  *
00715  * Requires:
00716  *\li   adb is valid.
00717  */
00718 
00719 void
00720 dns_adb_setadbsize(dns_adb_t *adb, size_t size);
00721 /*%<
00722  * Set a target memory size.  If memory usage exceeds the target
00723  * size entries will be removed before they would have expired on
00724  * a random basis.
00725  *
00726  * If 'size' is 0 then memory usage is unlimited.
00727  *
00728  * Requires:
00729  *\li   'adb' is valid.
00730  */
00731 
00732 void
00733 dns_adb_flushname(dns_adb_t *adb, dns_name_t *name);
00734 /*%<
00735  * Flush 'name' from the adb cache.
00736  *
00737  * Requires:
00738  *\li   'adb' is valid.
00739  *\li   'name' is valid.
00740  */
00741 
00742 void
00743 dns_adb_flushnames(dns_adb_t *adb, dns_name_t *name);
00744 /*%<
00745  * Flush 'name' and all subdomains from the adb cache.
00746  *
00747  * Requires:
00748  *\li   'adb' is valid.
00749  *\li   'name' is valid.
00750  */
00751 
00752 void
00753 dns_adb_setsit(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
00754                const unsigned char *sit, size_t len);
00755 /*%<
00756  * Record the Source Identity Token (SIT) associated with this addresss.  If
00757  * sit is NULL or len is zero. The recorded SIT is cleared.
00758  *
00759  * Requires:
00760  *\li   'adb' is valid.
00761  *\li   'addr' is valid.
00762  */
00763 
00764 size_t
00765 dns_adb_getsit(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
00766                unsigned char *sit, size_t len);
00767 /*
00768  * Retieve the saved SIT value and store it in 'sit' which has size 'len'.
00769  *
00770  * Requires:
00771  *\li   'adb' is valid.
00772  *\li   'addr' is valid.
00773  *
00774  * Returns:
00775  *      The size of the sit token or zero if it doesn't fit in the buffer
00776  *      or it doesn't exist.
00777  */
00778 
00779 ISC_LANG_ENDDECLS
00780 
00781 #endif /* DNS_ADB_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha