client.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009, 2013, 2014  Internet Systems Consortium, Inc. ("ISC")
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00009  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00010  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00011  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00012  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00013  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00014  * PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 
00017 /* $Id: client.h,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
00018 
00019 #ifndef DNS_CLIENT_H
00020 #define DNS_CLIENT_H 1
00021 
00022 /*****
00023  ***** Module Info
00024  *****/
00025 
00026 /*! \file
00027  *
00028  * \brief
00029  * The DNS client module provides convenient programming interfaces to various
00030  * DNS services, such as name resolution with or without DNSSEC validation or
00031  * dynamic DNS update.  This module is primarily expected to be used by other
00032  * applications than BIND9-related ones that need such advanced DNS features.
00033  *
00034  * MP:
00035  *\li   In the typical usage of this module, application threads will not share
00036  *      the same data structures created and manipulated in this module.
00037  *      However, the module still ensures appropriate synchronization of such
00038  *      data structures.
00039  *
00040  * Resources:
00041  *\li   TBS
00042  *
00043  * Security:
00044  *\li   This module does not handle any low-level data directly, and so no
00045  *      security issue specific to this module is anticipated.
00046  */
00047 
00048 #include <isc/event.h>
00049 #include <isc/sockaddr.h>
00050 
00051 #include <dns/tsig.h>
00052 #include <dns/types.h>
00053 
00054 #include <dst/dst.h>
00055 
00056 typedef enum {
00057         updateop_none = 0,
00058         updateop_add = 1,
00059         updateop_delete = 2,
00060         updateop_exist = 3,
00061         updateop_notexist = 4,
00062         updateop_max = 5
00063 } dns_client_updateop_t;
00064 
00065 ISC_LANG_BEGINDECLS
00066 
00067 /***
00068  *** Types
00069  ***/
00070 
00071 /*%
00072  * Optional flags for dns_client_create(x).
00073  */
00074 /*%< Enable caching resolution results (experimental). */
00075 #define DNS_CLIENTCREATEOPT_USECACHE    0x8000
00076 
00077 /*%
00078  * Optional flags for dns_client_(start)resolve.
00079  */
00080 /*%< Do not return DNSSEC data (e.g. RRSIGS) with response. */
00081 #define DNS_CLIENTRESOPT_NODNSSEC       0x01
00082 /*%< Allow running external context. */
00083 #define DNS_CLIENTRESOPT_ALLOWRUN       0x02
00084 /*%< Don't validate responses. */
00085 #define DNS_CLIENTRESOPT_NOVALIDATE     0x04
00086 /*%< Don't set the CD flag on upstream queries. */
00087 #define DNS_CLIENTRESOPT_NOCDFLAG       0x08
00088 /*%< Use TCP transport. */
00089 #define DNS_CLIENTRESOPT_TCP            0x10
00090 
00091 /*%
00092  * Optional flags for dns_client_(start)request.
00093  */
00094 /*%< Allow running external context. */
00095 #define DNS_CLIENTREQOPT_ALLOWRUN       0x01
00096 /*%< Use TCP transport. */
00097 #define DNS_CLIENTREQOPT_TCP            0x02
00098 
00099 /*%
00100  * Optional flags for dns_client_(start)update.
00101  */
00102 /*%< Allow running external context. */
00103 #define DNS_CLIENTUPDOPT_ALLOWRUN       0x01
00104 /*%< Use TCP transport. */
00105 #define DNS_CLIENTUPDOPT_TCP            0x02
00106 
00107 /*%
00108  * A dns_clientresevent_t is sent when name resolution performed by a client
00109  * completes.  'result' stores the result code of the entire resolution
00110  * procedure.  'vresult' specifically stores the result code of DNSSEC
00111  * validation if it is performed.  When name resolution successfully completes,
00112  * 'answerlist' is typically non empty, containing answer names along with
00113  * RRsets.  It is the receiver's responsibility to free this list by calling
00114  * dns_client_freeresanswer() before freeing the event structure.
00115  */
00116 typedef struct dns_clientresevent {
00117         ISC_EVENT_COMMON(struct dns_clientresevent);
00118         isc_result_t    result;
00119         isc_result_t    vresult;
00120         dns_namelist_t  answerlist;
00121 } dns_clientresevent_t;         /* too long? */
00122 
00123 /*%
00124  * Status of a dynamic update procedure.
00125  */
00126 typedef enum {
00127         dns_clientupdatestate_prepare,  /*%< no updates have been sent */
00128         dns_clientupdatestate_sent,     /*%< updates were sent, no response */
00129         dns_clientupdatestate_done      /*%< update was sent and succeeded */
00130 } dns_clientupdatestate_t;
00131 
00132 /*%
00133  * A dns_clientreqevent_t is sent when a DNS request is completed by a client.
00134  * 'result' stores the result code of the entire transaction.
00135  * If the transaction is successfully completed but the response packet cannot
00136  * be parsed, 'result' will store the result code of dns_message_parse().
00137  * If the response packet is received, 'rmessage' will contain the response
00138  * message, whether it is successfully parsed or not.
00139  */
00140 typedef struct dns_clientreqevent {
00141         ISC_EVENT_COMMON(struct dns_clientreqevent);
00142         isc_result_t    result;
00143         dns_message_t   *rmessage;
00144 } dns_clientreqevent_t;         /* too long? */
00145 
00146 /*%
00147  * A dns_clientupdateevent_t is sent when dynamic update performed by a client
00148  * completes.  'result' stores the result code of the entire update procedure.
00149  * 'state' specifies the status of the update procedure when this event is
00150  * sent.  This can be used as a hint by the receiver to determine whether
00151  * the update attempt was ever made.  In particular, if the state is
00152  * dns_clientupdatestate_prepare, the receiver can be sure that the requested
00153  * update was not applied.
00154  */
00155 typedef struct dns_clientupdateevent {
00156         ISC_EVENT_COMMON(struct dns_clientupdateevent);
00157         isc_result_t            result;
00158         dns_clientupdatestate_t state;
00159 } dns_clientupdateevent_t;      /* too long? */
00160 
00161 isc_result_t
00162 dns_client_create(dns_client_t **clientp, unsigned int options);
00163 
00164 isc_result_t
00165 dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
00166                    isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr,
00167                    unsigned int options, dns_client_t **clientp);
00168 
00169 isc_result_t
00170 dns_client_createx2(isc_mem_t *mctx, isc_appctx_t *actx,
00171            isc_taskmgr_t *taskmgr, isc_socketmgr_t *socketmgr,
00172            isc_timermgr_t *timermgr, unsigned int options,
00173            dns_client_t **clientp,
00174            isc_sockaddr_t *localaddr4, isc_sockaddr_t *localaddr6);
00175 /*%<
00176  * Create a DNS client.  These functions create a new client object with
00177  * minimal internal resources such as the default 'view' for the IN class and
00178  * IPv4/IPv6 dispatches for the view.
00179  *
00180  * dns_client_createx() takes 'manager' arguments so that the caller can
00181  * control the behavior of the client through the underlying event framework.
00182  * On the other hand, dns_client_create() simplifies the interface and creates
00183  * the managers internally.  A DNS client object created via
00184  * dns_client_create() is expected to be used by an application that only needs
00185  * simple synchronous services or by a thread-based application.
00186  *
00187  * dns_client_createx2 takes two additional parameters, 'localaddr4' and
00188  * 'localaddr6', to specify the local address to use for each family. If
00189  * both are set to NULL, then wildcard addresses will be used for both
00190  * families. If only one is NULL, then the other address will be used
00191  * as the local address, and the other protocol family will not be used.
00192  *
00193  * If the DNS_CLIENTCREATEOPT_USECACHE flag is set in 'options',
00194  * dns_client_create(x) will create a cache database with the view.
00195  *
00196  * Requires:
00197  *
00198  *\li   'mctx' is a valid memory context.
00199  *
00200  *\li   'actx' is a valid application context.
00201  *
00202  *\li   'taskmgr' is a valid task manager.
00203  *
00204  *\li   'socketmgr' is a valid socket manager.
00205  *
00206  *\li   'timermgr' is a valid timer manager.
00207  *
00208  *\li   clientp != NULL && *clientp == NULL.
00209  *
00210  * Returns:
00211  *
00212  *\li   #ISC_R_SUCCESS                          On success.
00213  *
00214  *\li   Anything else                           Failure.
00215  */
00216 
00217 void
00218 dns_client_destroy(dns_client_t **clientp);
00219 /*%<
00220  * Destroy 'client'.
00221  *
00222  * Requires:
00223  *
00224  *\li   '*clientp' is a valid client.
00225  *
00226  * Ensures:
00227  *
00228  *\li   *clientp == NULL.
00229  */
00230 
00231 isc_result_t
00232 dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
00233                       dns_name_t *namespace, isc_sockaddrlist_t *addrs);
00234 /*%<
00235  * Specify a list of addresses of recursive name servers that the client will
00236  * use for name resolution.  A view for the 'rdclass' class must be created
00237  * beforehand.  If 'namespace' is non NULL, the specified server will be used
00238  * if and only if the query name is a subdomain of 'namespace'.  When servers
00239  * for multiple 'namespace's are provided, and a query name is covered by
00240  * more than one 'namespace', the servers for the best (longest) matching
00241  * namespace will be used.  If 'namespace' is NULL, it works as if
00242  * dns_rootname (.) were specified.
00243  *
00244  * Requires:
00245  *
00246  *\li   'client' is a valid client.
00247  *
00248  *\li   'namespace' is NULL or a valid name.
00249  *
00250  *\li   'addrs' != NULL.
00251  *
00252  * Returns:
00253  *
00254  *\li   #ISC_R_SUCCESS                          On success.
00255  *
00256  *\li   Anything else                           Failure.
00257  */
00258 
00259 isc_result_t
00260 dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
00261                         dns_name_t *namespace);
00262 /*%<
00263  * Remove configured recursive name servers for the 'rdclass' and 'namespace'
00264  * from the client.  See the description of dns_client_setservers() for
00265  * the requirements about 'rdclass' and 'namespace'.
00266  *
00267  * Requires:
00268  *
00269  *\li   'client' is a valid client.
00270  *
00271  *\li   'namespace' is NULL or a valid name.
00272  *
00273  * Returns:
00274  *
00275  *\li   #ISC_R_SUCCESS                          On success.
00276  *
00277  *\li   Anything else                           Failure.
00278  */
00279 
00280 isc_result_t
00281 dns_client_setdlv(dns_client_t *client, dns_rdataclass_t rdclass,
00282                   const char *dlvname);
00283 /*%<
00284  * Specify a name to use for DNSSEC lookaside validation (e.g.,
00285  * "dlv.isc.org"). If a trusted key has been added for that name,
00286  * then DLV will be used during validation.  If 'dlvname' is NULL,
00287  * then DLV will no longer be used for this client.
00288  *
00289  * Requires:
00290  *
00291  *\li   'client' is a valid client.
00292  *
00293  * Returns:
00294  *
00295  *\li   #ISC_R_SUCCESS                          On success.
00296  *
00297  *\li   Anything else                           Failure.
00298  */
00299 
00300 isc_result_t
00301 dns_client_resolve(dns_client_t *client, dns_name_t *name,
00302                    dns_rdataclass_t rdclass, dns_rdatatype_t type,
00303                    unsigned int options, dns_namelist_t *namelist);
00304 
00305 isc_result_t
00306 dns_client_startresolve(dns_client_t *client, dns_name_t *name,
00307                         dns_rdataclass_t rdclass, dns_rdatatype_t type,
00308                         unsigned int options, isc_task_t *task,
00309                         isc_taskaction_t action, void *arg,
00310                         dns_clientrestrans_t **transp);
00311 /*%<
00312  * Perform name resolution for 'name', 'rdclass', and 'type'.
00313  *
00314  * If any trusted keys are configured and the query name is considered to
00315  * belong to a secure zone, these functions also validate the responses
00316  * using DNSSEC by default.  If the DNS_CLIENTRESOPT_NOVALIDATE flag is set
00317  * in 'options', DNSSEC validation is disabled regardless of the configured
00318  * trusted keys or the query name. With DNS_CLIENTRESOPT_NODNSSEC
00319  * DNSSEC data is not returned with response. DNS_CLIENTRESOPT_NOCDFLAG
00320  * disables the CD flag on queries, DNS_CLIENTRESOPT_TCP switches to
00321  * the TCP (vs. UDP) transport.
00322  *
00323  * dns_client_resolve() provides a synchronous service.  This function starts
00324  * name resolution internally and blocks until it completes.  On success,
00325  * 'namelist' will contain a list of answer names, each of which has
00326  * corresponding RRsets.  The caller must provide a valid empty list, and
00327  * is responsible for freeing the list content via dns_client_freeresanswer().
00328  * If the name resolution fails due to an error in DNSSEC validation,
00329  * dns_client_resolve() returns the result code indicating the validation
00330  * error. Otherwise, it returns the result code of the entire resolution
00331  * process, either success or failure.
00332  *
00333  * It is typically expected that the client object passed to
00334  * dns_client_resolve() was created via dns_client_create() and has its own
00335  * managers and contexts.  However, if the DNS_CLIENTRESOPT_ALLOWRUN flag is
00336  * set in 'options', this function performs the synchronous service even if
00337  * it does not have its own manager and context structures.
00338  *
00339  * dns_client_startresolve() is an asynchronous version of dns_client_resolve()
00340  * and does not block.  When name resolution is completed, 'action' will be
00341  * called with the argument of a 'dns_clientresevent_t' object, which contains
00342  * the resulting list of answer names (on success).  On return, '*transp' is
00343  * set to an opaque transaction ID so that the caller can cancel this
00344  * resolution process.
00345  *
00346  * Requires:
00347  *
00348  *\li   'client' is a valid client.
00349  *
00350  *\li   'addrs' != NULL.
00351  *
00352  *\li   'name' is a valid name.
00353  *
00354  *\li   'namelist' != NULL and is not empty.
00355  *
00356  *\li   'task' is a valid task.
00357  *
00358  *\li   'transp' != NULL && *transp == NULL;
00359  *
00360  * Returns:
00361  *
00362  *\li   #ISC_R_SUCCESS                          On success.
00363  *
00364  *\li   Anything else                           Failure.
00365  */
00366 
00367 void
00368 dns_client_cancelresolve(dns_clientrestrans_t *trans);
00369 /*%<
00370  * Cancel an ongoing resolution procedure started via
00371  * dns_client_startresolve().
00372  *
00373  * Notes:
00374  *
00375  *\li   If the resolution procedure has not completed, post its CLIENTRESDONE
00376  *      event with a result code of #ISC_R_CANCELED.
00377  *
00378  * Requires:
00379  *
00380  *\li   'trans' is a valid transaction ID.
00381  */
00382 
00383 void
00384 dns_client_destroyrestrans(dns_clientrestrans_t **transp);
00385 /*%<
00386  * Destroy name resolution transaction state identified by '*transp'.
00387  *
00388  * Requires:
00389  *
00390  *\li   '*transp' is a valid transaction ID.
00391  *
00392  *\li   The caller has received the CLIENTRESDONE event (either because the
00393  *      resolution completed or because dns_client_cancelresolve() was called).
00394  *
00395  * Ensures:
00396  *
00397  *\li   *transp == NULL.
00398  */
00399 
00400 void
00401 dns_client_freeresanswer(dns_client_t *client, dns_namelist_t *namelist);
00402 /*%<
00403  * Free resources allocated for the content of 'namelist'.
00404  *
00405  * Requires:
00406  *
00407  *\li   'client' is a valid client.
00408  *
00409  *\li   'namelist' != NULL.
00410  */
00411 
00412 isc_result_t
00413 dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
00414                          dns_name_t *keyname, isc_buffer_t *keydatabuf);
00415 /*%<
00416  * Add a DNSSEC trusted key for the 'rdclass' class.  A view for the 'rdclass'
00417  * class must be created beforehand.  'keyname' is the DNS name of the key,
00418  * and 'keydatabuf' stores the resource data of the key.
00419  *
00420  * Requires:
00421  *
00422  *\li   'client' is a valid client.
00423  *
00424  *\li   'keyname' is a valid name.
00425  *
00426  *\li   'keydatabuf' is a valid buffer.
00427  *
00428  * Returns:
00429  *
00430  *\li   #ISC_R_SUCCESS                          On success.
00431  *
00432  *\li   Anything else                           Failure.
00433  */
00434 
00435 isc_result_t
00436 dns_client_request(dns_client_t *client, dns_message_t *qmessage,
00437                    dns_message_t *rmessage, isc_sockaddr_t *server,
00438                    unsigned int options, unsigned int parseoptions,
00439                    dns_tsec_t *tsec, unsigned int timeout,
00440                    unsigned int udptimeout, unsigned int udpretries);
00441 
00442 isc_result_t
00443 dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
00444                         dns_message_t *rmessage, isc_sockaddr_t *server,
00445                         unsigned int options, unsigned int parseoptions,
00446                         dns_tsec_t *tsec, unsigned int timeout,
00447                         unsigned int udptimeout, unsigned int udpretries,
00448                         isc_task_t *task, isc_taskaction_t action, void *arg,
00449                         dns_clientreqtrans_t **transp);
00450 
00451 /*%<
00452  * Send a DNS request containig a query message 'query' to 'server'.
00453  *
00454  * 'parseoptions' will be used when the response packet is parsed, and will be
00455  * passed to dns_message_parse() via dns_request_getresponse().  See
00456  * dns_message_parse() for more details.
00457  *
00458  * 'tsec' is a transaction security object containing, e.g. a TSIG key for
00459  * authenticating the request/response transaction.  This is optional and can
00460  * be NULL, in which case this library performs the transaction  without any
00461  * transaction authentication.
00462  *
00463  * 'timeout', 'udptimeout', and 'udpretries' are passed to
00464  * dns_request_createvia3().  See dns_request_createvia3() for more details.
00465  *
00466  * dns_client_request() provides a synchronous service.  This function sends
00467  * the request and blocks until a response is received.  On success,
00468  * 'rmessage' will contain the response message.  The caller must provide a
00469  * valid initialized message.
00470  *
00471  * It is usually expected that the client object passed to
00472  * dns_client_request() was created via dns_client_create() and has its own
00473  * managers and contexts.  However, if the DNS_CLIENTREQOPT_ALLOWRUN flag is
00474  * set in 'options', this function performs the synchronous service even if
00475  * it does not have its own manager and context structures.
00476  *
00477  * dns_client_startrequest() is an asynchronous version of dns_client_request()
00478  * and does not block.  When the transaction is completed, 'action' will be
00479  * called with the argument of a 'dns_clientreqevent_t' object, which contains
00480  * the response message (on success).  On return, '*transp' is set to an opaque
00481  * transaction ID so that the caller can cancel this request.
00482  *
00483  * DNS_CLIENTREQOPT_TCP switches to the TCP (vs. UDP) transport.
00484  *
00485  * Requires:
00486  *
00487  *\li   'client' is a valid client.
00488  *
00489  *\li   'qmessage' and 'rmessage' are valid initialized message.
00490  *
00491  *\li   'server' is a valid socket address structure.
00492  *
00493  *\li   'task' is a valid task.
00494  *
00495  *\li   'transp' != NULL && *transp == NULL;
00496  *
00497  * Returns:
00498  *
00499  *\li   #ISC_R_SUCCESS                          On success.
00500  *
00501  *\li   Anything else                           Failure.
00502  *
00503  *\li   Any result that dns_message_parse() can return.
00504  */
00505 
00506 void
00507 dns_client_cancelrequest(dns_clientreqtrans_t *transp);
00508 /*%<
00509  * Cancel an ongoing DNS request procedure started via
00510  * dns_client_startrequest().
00511  *
00512  * Notes:
00513  *
00514  *\li   If the request procedure has not completed, post its CLIENTREQDONE
00515  *      event with a result code of #ISC_R_CANCELED.
00516  *
00517  * Requires:
00518  *
00519  *\li   'trans' is a valid transaction ID.
00520  */
00521 
00522 void
00523 dns_client_destroyreqtrans(dns_clientreqtrans_t **transp);
00524 /*%
00525  * Destroy DNS request transaction state identified by '*transp'.
00526  *
00527  * Requires:
00528  *
00529  *\li   '*transp' is a valid transaction ID.
00530  *
00531  *\li   The caller has received the CLIENTREQDONE event (either because the
00532  *      request completed or because dns_client_cancelrequest() was called).
00533  *
00534  * Ensures:
00535  *
00536  *\li   *transp == NULL.
00537  */
00538 
00539 isc_result_t
00540 dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
00541                   dns_name_t *zonename, dns_namelist_t *prerequisites,
00542                   dns_namelist_t *updates, isc_sockaddrlist_t *servers,
00543                   dns_tsec_t *tsec, unsigned int options);
00544 
00545 isc_result_t
00546 dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
00547                        dns_name_t *zonename, dns_namelist_t *prerequisites,
00548                        dns_namelist_t *updates, isc_sockaddrlist_t *servers,
00549                        dns_tsec_t *tsec, unsigned int options,
00550                        isc_task_t *task, isc_taskaction_t action, void *arg,
00551                        dns_clientupdatetrans_t **transp);
00552 /*%<
00553  * Perform DNS dynamic update for 'updates' of the 'rdclass' class with
00554  * optional 'prerequisites'.
00555  *
00556  * 'updates' are a list of names with associated RRsets to be updated.
00557  *
00558  * 'prerequisites' are a list of names with associated RRsets corresponding to
00559  * the prerequisites of the updates.  This is optional and can be NULL, in
00560  * which case the prerequisite section of the update message will be empty.
00561  *
00562  * Both 'updates' and 'prerequisites' must be constructed as specified in
00563  * RFC2136.
00564  *
00565  * 'zonename' is the name of the zone in which the updated names exist.
00566  * This is optional and can be NULL.  In this case, these functions internally
00567  * identify the appropriate zone through some queries for the SOA RR starting
00568  * with the first name in prerequisites or updates.
00569  *
00570  * 'servers' is a list of authoritative servers to which the update message
00571  * should be sent.  This is optional and can be NULL.  In this case, these
00572  * functions internally identify the appropriate primary server name and its
00573  * addresses through some queries for the SOA RR (like the case of zonename)
00574  * and supplemental A/AAAA queries for the server name.
00575  * Note: The client module generally assumes the given addresses are of the
00576  * primary server of the corresponding zone.  It will work even if a secondary
00577  * server address is specified as long as the server allows update forwarding,
00578  * it is generally discouraged to include secondary server addresses unless
00579  * there's strong reason to do so.
00580  *
00581  * 'tsec' is a transaction security object containing, e.g. a TSIG key for
00582  * authenticating the update transaction (and the supplemental query/response
00583  * transactions if the server is specified).  This is optional and can be
00584  * NULL, in which case the library tries the update without any transaction
00585  * authentication.
00586  *
00587  * It is typically expected that the client object passed to
00588  * dns_client_update() was created via dns_client_create() and has its own
00589  * managers and contexts.  However, if the DNS_CLIENTUPDOPT_ALLOWRUN flag is
00590  * set in 'options', this function performs the synchronous service even if
00591  * it does not have its own manager and context structures.
00592  *
00593  * dns_client_update() provides a synchronous service.  This function blocks
00594  * until the entire update procedure completes, including the additional
00595  * queries when necessary.
00596  *
00597  * dns_client_startupdate() is an asynchronous version of dns_client_update().
00598  * It immediately returns (typically with *transp being set to a non-NULL
00599  * pointer), and performs the update procedure through a set of internal
00600  * events.  All transactions including the additional query exchanges are
00601  * performed as a separate event, so none of these events cause blocking
00602  * operation.  When the update procedure completes, the specified function
00603  * 'action' will be called with the argument of a 'dns_clientupdateevent_t'
00604  * structure.  On return, '*transp' is set to an opaque transaction ID so that
00605  * the caller can cancel this update process.
00606  *
00607  * DNS_CLIENTUPDOPT_TCP switches to the TCP (vs. UDP) transport.
00608  *
00609  * Requires:
00610  *
00611  *\li   'client' is a valid client.
00612  *
00613  *\li   'updates' != NULL.
00614  *
00615  *\li   'task' is a valid task.
00616  *
00617  *\li   'transp' != NULL && *transp == NULL;
00618  *
00619  * Returns:
00620  *
00621  *\li   #ISC_R_SUCCESS                          On success.
00622  *
00623  *\li   Anything else                           Failure.
00624  */
00625 
00626 void
00627 dns_client_cancelupdate(dns_clientupdatetrans_t *trans);
00628 /*%<
00629  * Cancel an ongoing dynamic update procedure started via
00630  * dns_client_startupdate().
00631  *
00632  * Notes:
00633  *
00634  *\li   If the update procedure has not completed, post its UPDATEDONE
00635  *      event with a result code of #ISC_R_CANCELED.
00636  *
00637  * Requires:
00638  *
00639  *\li   'trans' is a valid transaction ID.
00640  */
00641 
00642 void
00643 dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp);
00644 /*%<
00645  * Destroy dynamic update transaction identified by '*transp'.
00646  *
00647  * Requires:
00648  *
00649  *\li   '*transp' is a valid transaction ID.
00650  *
00651  *\li   The caller has received the UPDATEDONE event (either because the
00652  *      update completed or because dns_client_cancelupdate() was called).
00653  *
00654  * Ensures:
00655  *
00656  *\li   *transp == NULL.
00657  */
00658 
00659 isc_result_t
00660 dns_client_updaterec(dns_client_updateop_t op, dns_name_t *owner,
00661                      dns_rdatatype_t type, dns_rdata_t *source,
00662                      dns_ttl_t ttl, dns_name_t *target,
00663                      dns_rdataset_t *rdataset, dns_rdatalist_t *rdatalist,
00664                      dns_rdata_t *rdata, isc_mem_t *mctx);
00665 /*%<
00666  * TBD
00667  */
00668 
00669 void
00670 dns_client_freeupdate(dns_name_t **namep);
00671 /*%<
00672  * TBD
00673  */
00674 
00675 isc_mem_t *
00676 dns_client_mctx(dns_client_t *client);
00677 
00678 ISC_LANG_ENDDECLS
00679 
00680 #endif /* DNS_CLIENT_H */

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