Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 550bbe86d83a7870fdddc73c68e5d2b2 > files > 51

libunbound-devel-1.3.4-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>unbound: services/cache/dns.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_d1ccb6fd7b4f0b6c4993c4e5b9d49242.html">services</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_b9bd6755c8df75071f1bf8c5239ee5c4.html">cache</a>
  </div>
</div>
<div class="contents">
<h1>dns.h File Reference</h1>This file contains the DNS cache.  
<a href="#_details">More...</a>
<p>
<code>#include &quot;<a class="el" href="lruhash_8h.html">util/storage/lruhash.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="msgreply_8h.html">util/data/msgreply.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structdns__msg.html">dns_msg</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Region allocated message reply.  <a href="structdns__msg.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#205efb24a2701f2b6d3da3cfedf15db7">dns_cache_store</a> (struct <a class="el" href="structmodule__env.html">module_env</a> *env, struct <a class="el" href="structquery__info.html">query_info</a> *qinf, struct <a class="el" href="structreply__info.html">reply_info</a> *rep, int is_referral)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate a <a class="el" href="structdns__msg.html" title="Region allocated message reply.">dns_msg</a> with malloc/alloc structure and store in dns cache.  <a href="#205efb24a2701f2b6d3da3cfedf15db7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#d95ee19d90afb38ad77bf0c52b251b93">dns_cache_store_msg</a> (struct <a class="el" href="structmodule__env.html">module_env</a> *env, struct <a class="el" href="structquery__info.html">query_info</a> *qinfo, <a class="el" href="lruhash_8h.html#050c9ffcb4f555022a735896cdee3795">hashvalue_t</a> hash, struct <a class="el" href="structreply__info.html">reply_info</a> *rep)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Store message in the cache.  <a href="#d95ee19d90afb38ad77bf0c52b251b93"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structdelegpt.html">delegpt</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#e9726dbda27670d8c9587898324ff5ca">dns_cache_find_delegation</a> (struct <a class="el" href="structmodule__env.html">module_env</a> *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct <a class="el" href="structregional.html">regional</a> *region, struct <a class="el" href="structdns__msg.html">dns_msg</a> **msg, uint32_t timenow)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find a delegation from the cache.  <a href="#e9726dbda27670d8c9587898324ff5ca"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structdns__msg.html">dns_msg</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#40aa4823aeeee85f89309ccdcd944451">dns_cache_lookup</a> (struct <a class="el" href="structmodule__env.html">module_env</a> *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct <a class="el" href="structregional.html">regional</a> *region, struct <a class="el" href="structregional.html">regional</a> *scratch)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find cached message.  <a href="#40aa4823aeeee85f89309ccdcd944451"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#9e6998233852d2b2221fbe0d10c11f50">cache_fill_missing</a> (struct <a class="el" href="structmodule__env.html">module_env</a> *env, uint16_t qclass, struct <a class="el" href="structregional.html">regional</a> *region, struct <a class="el" href="structdelegpt.html">delegpt</a> *dp)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">find and add A and AAAA records for missing nameservers in <a class="el" href="structdelegpt.html" title="Delegation Point.">delegpt</a>  <a href="#9e6998233852d2b2221fbe0d10c11f50"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structdns__msg.html">dns_msg</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#0e489433bcf79ad953254ea00f63e0d6">dns_msg_create</a> (uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct <a class="el" href="structregional.html">regional</a> *region, size_t capacity)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility, create new, unpacked data structure for cache response.  <a href="#0e489433bcf79ad953254ea00f63e0d6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dns_8h.html#40152b79d112fc31679d7620f1ddb857">dns_msg_authadd</a> (struct <a class="el" href="structdns__msg.html">dns_msg</a> *msg, struct <a class="el" href="structregional.html">regional</a> *region, struct <a class="el" href="structub__packed__rrset__key.html">ub_packed_rrset_key</a> *rrset, uint32_t now)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add rrset to authority section in unpacked <a class="el" href="structdns__msg.html" title="Region allocated message reply.">dns_msg</a> message.  <a href="#40152b79d112fc31679d7620f1ddb857"></a><br></td></tr>
</table>
<hr><h2>Detailed Description</h2>
This file contains the DNS cache. 
<p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="205efb24a2701f2b6d3da3cfedf15db7"></a><!-- doxytag: member="dns.h::dns_cache_store" ref="205efb24a2701f2b6d3da3cfedf15db7" args="(struct module_env *env, struct query_info *qinf, struct reply_info *rep, int is_referral)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int dns_cache_store           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structmodule__env.html">module_env</a> *&nbsp;</td>
          <td class="paramname"> <em>env</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structquery__info.html">query_info</a> *&nbsp;</td>
          <td class="paramname"> <em>qinf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structreply__info.html">reply_info</a> *&nbsp;</td>
          <td class="paramname"> <em>rep</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>is_referral</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Allocate a <a class="el" href="structdns__msg.html" title="Region allocated message reply.">dns_msg</a> with malloc/alloc structure and store in dns cache. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>env,:</em>&nbsp;</td><td>environment, with alloc structure and dns cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qinf,:</em>&nbsp;</td><td>query info, the query for which answer is stored. this is allocated in a region, and will be copied to malloc area before insertion. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rep,:</em>&nbsp;</td><td>reply in <a class="el" href="structdns__msg.html" title="Region allocated message reply.">dns_msg</a> from dns_alloc_msg for example. this is allocated in a region, and will be copied to malloc area before insertion. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>is_referral,:</em>&nbsp;</td><td>If true, then the given message to be stored is a referral. The cache implementation may use this as a hint. It will store only the RRsets, not the message. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on alloc error (out of memory). </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00194">module_env::alloc</a>, <a class="el" href="net__help_8h_source.html#l00066">BIT_AA</a>, <a class="el" href="net__help_8h_source.html#l00054">BIT_CD</a>, <a class="el" href="net__help_8h_source.html#l00068">BIT_QR</a>, <a class="el" href="net__help_8h_source.html#l00060">BIT_RA</a>, <a class="el" href="lruhash_8h_source.html#l00222">lruhash_entry::data</a>, <a class="el" href="dns_8c_source.html#l00073">dns_cache_store_msg()</a>, <a class="el" href="packed__rrset_8h_source.html#l00094">ub_packed_rrset_key::entry</a>, <a class="el" href="msgreply_8h_source.html#l00099">reply_info::flags</a>, <a class="el" href="packed__rrset_8h_source.html#l00103">ub_packed_rrset_key::id</a>, <a class="el" href="msgreply_8h_source.html#l00080">rrset_ref::id</a>, <a class="el" href="msgreply_8h_source.html#l00078">rrset_ref::key</a>, <a class="el" href="net__help_8c_source.html#l00138">memdup()</a>, <a class="el" href="module_8h_source.html#l00198">module_env::now</a>, <a class="el" href="packed__rrset_8c_source.html#l00216">packed_rrset_ttl_add()</a>, <a class="el" href="msgreply_8h_source.html#l00064">query_info::qname</a>, <a class="el" href="msgreply_8h_source.html#l00066">query_info::qname_len</a>, <a class="el" href="msgreply_8c_source.html#l00586">query_info_hash()</a>, <a class="el" href="msgreply_8c_source.html#l00652">reply_info_copy()</a>, <a class="el" href="msgreply_8c_source.html#l00482">reply_info_parsedelete()</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="rrset_8c_source.html#l00171">rrset_cache_update()</a>, <a class="el" href="msgreply_8h_source.html#l00141">reply_info::rrset_count</a>, and <a class="el" href="msgreply_8h_source.html#l00150">reply_info::rrsets</a>.</p>

<p>Referenced by <a class="el" href="iter__utils_8c_source.html#l00382">iter_dns_store()</a>, <a class="el" href="cachedump_8c_source.html#l00701">load_msg()</a>, <a class="el" href="validator_8c_source.html#l01720">processFinished()</a>, and <a class="el" href="pythonmod__utils_8c_source.html#l00056">storeQueryInCache()</a>.</p>

</div>
</div><p>
<a class="anchor" name="d95ee19d90afb38ad77bf0c52b251b93"></a><!-- doxytag: member="dns.h::dns_cache_store_msg" ref="d95ee19d90afb38ad77bf0c52b251b93" args="(struct module_env *env, struct query_info *qinfo, hashvalue_t hash, struct reply_info *rep)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void dns_cache_store_msg           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structmodule__env.html">module_env</a> *&nbsp;</td>
          <td class="paramname"> <em>env</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structquery__info.html">query_info</a> *&nbsp;</td>
          <td class="paramname"> <em>qinfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="lruhash_8h.html#050c9ffcb4f555022a735896cdee3795">hashvalue_t</a>&nbsp;</td>
          <td class="paramname"> <em>hash</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structreply__info.html">reply_info</a> *&nbsp;</td>
          <td class="paramname"> <em>rep</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Store message in the cache. 
<p>
Stores in message cache and rrset cache. Both qinfo and rep should be malloced and are put in the cache. They should not be used after this call, as they are then in shared cache. Does not return errors, they are logged and only lead to less cache.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>env,:</em>&nbsp;</td><td>module environment with the DNS cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qinfo,:</em>&nbsp;</td><td>query info </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>hash,:</em>&nbsp;</td><td>hash over qinfo. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rep,:</em>&nbsp;</td><td>reply info, together with qinfo makes up the message. Adjusts the reply info TTLs to absolute time. </td></tr>
  </table>
</dl>

<p>References <a class="el" href="module_8h_source.html#l00194">module_env::alloc</a>, <a class="el" href="msgreply_8h_source.html#l00178">msgreply_entry::entry</a>, <a class="el" href="packed__rrset_8h_source.html#l00103">ub_packed_rrset_key::id</a>, <a class="el" href="msgreply_8h_source.html#l00080">rrset_ref::id</a>, <a class="el" href="msgreply_8h_source.html#l00078">rrset_ref::key</a>, <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="module_8h_source.html#l00075">module_env::msg_cache</a>, <a class="el" href="module_8h_source.html#l00198">module_env::now</a>, <a class="el" href="msgreply_8c_source.html#l00596">query_info_entrysetup()</a>, <a class="el" href="msgreply_8h_source.html#l00168">reply_info::ref</a>, <a class="el" href="msgreply_8c_source.html#l00465">reply_info_set_ttls()</a>, <a class="el" href="msgreply_8c_source.html#l00458">reply_info_sortref()</a>, <a class="el" href="msgreply_8h_source.html#l00141">reply_info::rrset_count</a>, <a class="el" href="msgreply_8h_source.html#l00150">reply_info::rrsets</a>, <a class="el" href="slabhash_8c_source.html#l00116">slabhash_insert()</a>, <a class="el" href="dns_8c_source.html#l00059">store_rrsets()</a>, <a class="el" href="msgreply_8h_source.html#l00120">reply_info::ttl</a>, <a class="el" href="log_8h_source.html#l00058">VERB_ALGO</a>, and <a class="el" href="ldns-testpkts_8c.html#a557e5b23b2833d7c1ec0415a1bdd2b1">verbose()</a>.</p>

<p>Referenced by <a class="el" href="dns_8c_source.html#l00668">dns_cache_store()</a>.</p>

</div>
</div><p>
<a class="anchor" name="e9726dbda27670d8c9587898324ff5ca"></a><!-- doxytag: member="dns.h::dns_cache_find_delegation" ref="e9726dbda27670d8c9587898324ff5ca" args="(struct module_env *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct regional *region, struct dns_msg **msg, uint32_t timenow)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structdelegpt.html">delegpt</a>* dns_cache_find_delegation           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structmodule__env.html">module_env</a> *&nbsp;</td>
          <td class="paramname"> <em>env</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>qname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>qnamelen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qtype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qclass</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structregional.html">regional</a> *&nbsp;</td>
          <td class="paramname"> <em>region</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structdns__msg.html">dns_msg</a> **&nbsp;</td>
          <td class="paramname"> <em>msg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&nbsp;</td>
          <td class="paramname"> <em>timenow</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Find a delegation from the cache. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>env,:</em>&nbsp;</td><td>module environment with the DNS cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qname,:</em>&nbsp;</td><td>query name. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qnamelen,:</em>&nbsp;</td><td>length of qname. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qtype,:</em>&nbsp;</td><td>query type. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qclass,:</em>&nbsp;</td><td>query class. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>region,:</em>&nbsp;</td><td>where to allocate result delegation. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>msg,:</em>&nbsp;</td><td>if not NULL, delegation message is returned here, synthesized from the cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>timenow,:</em>&nbsp;</td><td>the time now, for checking if TTL on cache entries is OK. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>new delegation or NULL on error or if not found in cache. </dd></dl>

<p>References <a class="el" href="packed__rrset_8h_source.html#l00211">packed_rrset_data::count</a>, <a class="el" href="lruhash_8h_source.html#l00222">lruhash_entry::data</a>, <a class="el" href="iter__delegpt_8c_source.html#l00052">delegpt_create()</a>, <a class="el" href="iter__delegpt_8c_source.html#l00346">delegpt_rrset_add_ns()</a>, <a class="el" href="iter__delegpt_8c_source.html#l00088">delegpt_set_name()</a>, <a class="el" href="packed__rrset_8h_source.html#l00064">packed_rrset_key::dname</a>, <a class="el" href="dns_8c_source.html#l00336">dns_msg_authadd()</a>, <a class="el" href="dns_8c_source.html#l00307">dns_msg_create()</a>, <a class="el" href="packed__rrset_8h_source.html#l00094">ub_packed_rrset_key::entry</a>, <a class="el" href="dns_8c_source.html#l00172">find_add_addrs()</a>, <a class="el" href="dns_8c_source.html#l00274">find_add_ds()</a>, <a class="el" href="dns_8c_source.html#l00107">find_closest_of_type()</a>, <a class="el" href="lruhash_8h_source.html#l00210">lruhash_entry::lock</a>, <a class="el" href="log_8c_source.html#l00241">log_err()</a>, and <a class="el" href="packed__rrset_8h_source.html#l00105">ub_packed_rrset_key::rk</a>.</p>

<p>Referenced by <a class="el" href="worker_8c_source.html#l00416">answer_norec_from_cache()</a>, <a class="el" href="cachedump_8c_source.html#l00782">print_deleg_lookup()</a>, and <a class="el" href="iterator_8c_source.html#l00827">processInitRequest()</a>.</p>

</div>
</div><p>
<a class="anchor" name="40aa4823aeeee85f89309ccdcd944451"></a><!-- doxytag: member="dns.h::dns_cache_lookup" ref="40aa4823aeeee85f89309ccdcd944451" args="(struct module_env *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct regional *region, struct regional *scratch)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structdns__msg.html">dns_msg</a>* dns_cache_lookup           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structmodule__env.html">module_env</a> *&nbsp;</td>
          <td class="paramname"> <em>env</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>qname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>qnamelen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qtype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qclass</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structregional.html">regional</a> *&nbsp;</td>
          <td class="paramname"> <em>region</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structregional.html">regional</a> *&nbsp;</td>
          <td class="paramname"> <em>scratch</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Find cached message. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>env,:</em>&nbsp;</td><td>module environment with the DNS cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qname,:</em>&nbsp;</td><td>query name. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qnamelen,:</em>&nbsp;</td><td>length of qname. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qtype,:</em>&nbsp;</td><td>query type. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qclass,:</em>&nbsp;</td><td>query class. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>region,:</em>&nbsp;</td><td>where to allocate result. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>scratch,:</em>&nbsp;</td><td>where to allocate temporary data. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>new response message (alloced in region, rrsets do not have IDs). or NULL on error or if not found in cache. TTLs are made relative to the current time. </dd></dl>

<p>References <a class="el" href="lruhash_8h_source.html#l00222">lruhash_entry::data</a>, <a class="el" href="packed__rrset_8h_source.html#l00094">ub_packed_rrset_key::entry</a>, <a class="el" href="dns_8c_source.html#l00107">find_closest_of_type()</a>, <a class="el" href="lruhash_8h_source.html#l00220">lruhash_entry::key</a>, <a class="el" href="msgreply_8h_source.html#l00176">msgreply_entry::key</a>, <a class="el" href="lruhash_8h_source.html#l00210">lruhash_entry::lock</a>, <a class="el" href="module_8h_source.html#l00075">module_env::msg_cache</a>, <a class="el" href="module_8h_source.html#l00198">module_env::now</a>, <a class="el" href="msgreply_8h_source.html#l00070">query_info::qclass</a>, <a class="el" href="msgreply_8h_source.html#l00064">query_info::qname</a>, <a class="el" href="msgreply_8h_source.html#l00066">query_info::qname_len</a>, <a class="el" href="msgreply_8h_source.html#l00068">query_info::qtype</a>, <a class="el" href="msgreply_8c_source.html#l00586">query_info_hash()</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="rrset_8c_source.html#l00226">rrset_cache_lookup()</a>, <a class="el" href="dns_8c_source.html#l00470">rrset_msg()</a>, <a class="el" href="packed__rrset_8h_source.html#l00129">rrset_trust_add_AA</a>, <a class="el" href="packed__rrset_8h_source.html#l00125">rrset_trust_add_noAA</a>, <a class="el" href="slabhash_8c_source.html#l00122">slabhash_lookup()</a>, <a class="el" href="dns_8c_source.html#l00498">synth_dname_msg()</a>, <a class="el" href="dns_8c_source.html#l00422">tomsg()</a>, and <a class="el" href="packed__rrset_8h_source.html#l00215">packed_rrset_data::trust</a>.</p>

<p>Referenced by <a class="el" href="iterator_8c_source.html#l00827">processInitRequest()</a>.</p>

</div>
</div><p>
<a class="anchor" name="9e6998233852d2b2221fbe0d10c11f50"></a><!-- doxytag: member="dns.h::cache_fill_missing" ref="9e6998233852d2b2221fbe0d10c11f50" args="(struct module_env *env, uint16_t qclass, struct regional *region, struct delegpt *dp)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int cache_fill_missing           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structmodule__env.html">module_env</a> *&nbsp;</td>
          <td class="paramname"> <em>env</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qclass</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structregional.html">regional</a> *&nbsp;</td>
          <td class="paramname"> <em>region</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structdelegpt.html">delegpt</a> *&nbsp;</td>
          <td class="paramname"> <em>dp</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
find and add A and AAAA records for missing nameservers in <a class="el" href="structdelegpt.html" title="Delegation Point.">delegpt</a> 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>env,:</em>&nbsp;</td><td>module environment with rrset cache </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qclass,:</em>&nbsp;</td><td>which class to look in. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>region,:</em>&nbsp;</td><td>where to store new dp info. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>dp,:</em>&nbsp;</td><td>delegation point to fill missing entries. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>false on alloc failure. </dd></dl>

<p>References <a class="el" href="iter__delegpt_8c_source.html#l00428">delegpt_add_neg_msg()</a>, <a class="el" href="iter__delegpt_8c_source.html#l00367">delegpt_add_rrset_A()</a>, <a class="el" href="iter__delegpt_8c_source.html#l00390">delegpt_add_rrset_AAAA()</a>, <a class="el" href="msgreply_8h_source.html#l00178">msgreply_entry::entry</a>, <a class="el" href="packed__rrset_8h_source.html#l00094">ub_packed_rrset_key::entry</a>, <a class="el" href="lruhash_8h_source.html#l00210">lruhash_entry::lock</a>, <a class="el" href="net__help_8c_source.html#l00265">log_nametypeclass()</a>, <a class="el" href="dns_8c_source.html#l00148">msg_cache_lookup()</a>, <a class="el" href="iter__delegpt_8h_source.html#l00086">delegpt_ns::name</a>, <a class="el" href="iter__delegpt_8h_source.html#l00088">delegpt_ns::namelen</a>, <a class="el" href="iter__delegpt_8h_source.html#l00084">delegpt_ns::next</a>, <a class="el" href="module_8h_source.html#l00198">module_env::now</a>, <a class="el" href="iter__delegpt_8h_source.html#l00066">delegpt::nslist</a>, <a class="el" href="iter__delegpt_8h_source.html#l00095">delegpt_ns::resolved</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="rrset_8c_source.html#l00226">rrset_cache_lookup()</a>, and <a class="el" href="log_8h_source.html#l00058">VERB_ALGO</a>.</p>

<p>Referenced by <a class="el" href="iterator_8c_source.html#l01454">processQueryResponse()</a>.</p>

</div>
</div><p>
<a class="anchor" name="0e489433bcf79ad953254ea00f63e0d6"></a><!-- doxytag: member="dns.h::dns_msg_create" ref="0e489433bcf79ad953254ea00f63e0d6" args="(uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct regional *region, size_t capacity)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structdns__msg.html">dns_msg</a>* dns_msg_create           </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>qname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>qnamelen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qtype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>qclass</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structregional.html">regional</a> *&nbsp;</td>
          <td class="paramname"> <em>region</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>capacity</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Utility, create new, unpacked data structure for cache response. 
<p>
QR bit set, no AA. Query set as indicated. Space for number of rrsets. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>qname,:</em>&nbsp;</td><td>query section name </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qnamelen,:</em>&nbsp;</td><td>len of qname </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qtype,:</em>&nbsp;</td><td>query section type </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>qclass,:</em>&nbsp;</td><td>query section class </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>region,:</em>&nbsp;</td><td>where to alloc. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>capacity,:</em>&nbsp;</td><td>number of rrsets space to create in the array. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>new <a class="el" href="structdns__msg.html" title="Region allocated message reply.">dns_msg</a> struct or NULL on mem fail. </dd></dl>

<p>References <a class="el" href="net__help_8h_source.html#l00068">BIT_QR</a>, <a class="el" href="msgreply_8h_source.html#l00099">reply_info::flags</a>, <a class="el" href="msgreply_8h_source.html#l00070">query_info::qclass</a>, <a class="el" href="msgreply_8h_source.html#l00113">reply_info::qdcount</a>, <a class="el" href="dns_8h_source.html#l00057">dns_msg::qinfo</a>, <a class="el" href="msgreply_8h_source.html#l00064">query_info::qname</a>, <a class="el" href="msgreply_8h_source.html#l00066">query_info::qname_len</a>, <a class="el" href="msgreply_8h_source.html#l00068">query_info::qtype</a>, <a class="el" href="regional_8c_source.html#l00116">regional_alloc()</a>, <a class="el" href="regional_8c_source.html#l00146">regional_alloc_init()</a>, <a class="el" href="regional_8c_source.html#l00155">regional_alloc_zero()</a>, <a class="el" href="dns_8h_source.html#l00059">dns_msg::rep</a>, and <a class="el" href="msgreply_8h_source.html#l00150">reply_info::rrsets</a>.</p>

<p>Referenced by <a class="el" href="dns_8c_source.html#l00347">dns_cache_find_delegation()</a>, <a class="el" href="val__neg_8c_source.html#l01232">neg_nsec3_proof_ds()</a>, and <a class="el" href="val__neg_8c_source.html#l01315">val_neg_getmsg()</a>.</p>

</div>
</div><p>
<a class="anchor" name="40152b79d112fc31679d7620f1ddb857"></a><!-- doxytag: member="dns.h::dns_msg_authadd" ref="40152b79d112fc31679d7620f1ddb857" args="(struct dns_msg *msg, struct regional *region, struct ub_packed_rrset_key *rrset, uint32_t now)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int dns_msg_authadd           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structdns__msg.html">dns_msg</a> *&nbsp;</td>
          <td class="paramname"> <em>msg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structregional.html">regional</a> *&nbsp;</td>
          <td class="paramname"> <em>region</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structub__packed__rrset__key.html">ub_packed_rrset_key</a> *&nbsp;</td>
          <td class="paramname"> <em>rrset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&nbsp;</td>
          <td class="paramname"> <em>now</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add rrset to authority section in unpacked <a class="el" href="structdns__msg.html" title="Region allocated message reply.">dns_msg</a> message. 
<p>
Must have enough space left, does not grow the array. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>msg,:</em>&nbsp;</td><td>msg to put it in. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>region,:</em>&nbsp;</td><td>region to alloc in </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rrset,:</em>&nbsp;</td><td>to add in authority section </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>now,:</em>&nbsp;</td><td>now. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>true if worked, false on fail </dd></dl>

<p>References <a class="el" href="msgreply_8h_source.html#l00136">reply_info::ns_numrrsets</a>, <a class="el" href="packed__rrset_8c_source.html#l00268">packed_rrset_copy_region()</a>, <a class="el" href="dns_8h_source.html#l00059">dns_msg::rep</a>, <a class="el" href="msgreply_8h_source.html#l00141">reply_info::rrset_count</a>, and <a class="el" href="msgreply_8h_source.html#l00150">reply_info::rrsets</a>.</p>

<p>Referenced by <a class="el" href="dns_8c_source.html#l00347">dns_cache_find_delegation()</a>, <a class="el" href="val__neg_8c_source.html#l01232">neg_nsec3_proof_ds()</a>, and <a class="el" href="val__neg_8c_source.html#l01315">val_neg_getmsg()</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Oct 13 06:46:31 2009 for unbound by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>