00001 /* 00002 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 2000, 2001 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: lookup.h,v 1.14 2009/01/17 23:47:43 tbox Exp $ */ 00019 00020 #ifndef DNS_LOOKUP_H 00021 #define DNS_LOOKUP_H 1 00022 00023 /***** 00024 ***** Module Info 00025 *****/ 00026 00027 /*! \file dns/lookup.h 00028 * \brief 00029 * The lookup module performs simple DNS lookups. It implements 00030 * the full resolver algorithm, both looking for local data and 00031 * resolving external names as necessary. 00032 * 00033 * MP: 00034 *\li The module ensures appropriate synchronization of data structures it 00035 * creates and manipulates. 00036 * 00037 * Reliability: 00038 *\li No anticipated impact. 00039 * 00040 * Resources: 00041 *\li TBS 00042 * 00043 * Security: 00044 *\li No anticipated impact. 00045 * 00046 * Standards: 00047 *\li RFCs: 1034, 1035, 2181, TBS 00048 *\li Drafts: TBS 00049 */ 00050 00051 #include <isc/lang.h> 00052 #include <isc/event.h> 00053 00054 #include <dns/types.h> 00055 00056 ISC_LANG_BEGINDECLS 00057 00058 /*% 00059 * A 'dns_lookupevent_t' is returned when a lookup completes. 00060 * The sender field will be set to the lookup that completed. If 'result' 00061 * is ISC_R_SUCCESS, then 'names' will contain a list of names associated 00062 * with the address. The recipient of the event must not change the list 00063 * and must not refer to any of the name data after the event is freed. 00064 */ 00065 typedef struct dns_lookupevent { 00066 ISC_EVENT_COMMON(struct dns_lookupevent); 00067 isc_result_t result; 00068 dns_name_t *name; 00069 dns_rdataset_t *rdataset; 00070 dns_rdataset_t *sigrdataset; 00071 dns_db_t *db; 00072 dns_dbnode_t *node; 00073 } dns_lookupevent_t; 00074 00075 isc_result_t 00076 dns_lookup_create(isc_mem_t *mctx, dns_name_t *name, dns_rdatatype_t type, 00077 dns_view_t *view, unsigned int options, isc_task_t *task, 00078 isc_taskaction_t action, void *arg, dns_lookup_t **lookupp); 00079 /*%< 00080 * Finds the rrsets matching 'name' and 'type'. 00081 * 00082 * Requires: 00083 * 00084 *\li 'mctx' is a valid mctx. 00085 * 00086 *\li 'name' is a valid name. 00087 * 00088 *\li 'view' is a valid view which has a resolver. 00089 * 00090 *\li 'task' is a valid task. 00091 * 00092 *\li lookupp != NULL && *lookupp == NULL 00093 * 00094 * Returns: 00095 * 00096 *\li ISC_R_SUCCESS 00097 *\li ISC_R_NOMEMORY 00098 * 00099 *\li Any resolver-related error (e.g. ISC_R_SHUTTINGDOWN) may also be 00100 * returned. 00101 */ 00102 00103 void 00104 dns_lookup_cancel(dns_lookup_t *lookup); 00105 /*%< 00106 * Cancel 'lookup'. 00107 * 00108 * Notes: 00109 * 00110 *\li If 'lookup' has not completed, post its LOOKUPDONE event with a 00111 * result code of ISC_R_CANCELED. 00112 * 00113 * Requires: 00114 * 00115 *\li 'lookup' is a valid lookup. 00116 */ 00117 00118 void 00119 dns_lookup_destroy(dns_lookup_t **lookupp); 00120 /*%< 00121 * Destroy 'lookup'. 00122 * 00123 * Requires: 00124 * 00125 *\li '*lookupp' is a valid lookup. 00126 * 00127 *\li The caller has received the LOOKUPDONE event (either because the 00128 * lookup completed or because dns_lookup_cancel() was called). 00129 * 00130 * Ensures: 00131 * 00132 *\li *lookupp == NULL. 00133 */ 00134 00135 ISC_LANG_ENDDECLS 00136 00137 #endif /* DNS_LOOKUP_H */