Sophie

Sophie

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

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: validator/val_kcache.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_d2a455e92b602458a2b0ed9b207bdda1.html">validator</a>
  </div>
</div>
<div class="contents">
<h1>val_kcache.h File Reference</h1>This file contains functions for caching validated key entries.  
<a href="#_details">More...</a>
<p>
<code>#include &quot;<a class="el" href="slabhash_8h.html">util/storage/slabhash.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="structkey__cache.html">key_cache</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Key cache.  <a href="structkey__cache.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">struct <a class="el" href="structkey__cache.html">key_cache</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="val__kcache_8h.html#d1f7237c63af556a6f715f339ab57860">key_cache_create</a> (struct <a class="el" href="structconfig__file.html">config_file</a> *cfg)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create the key cache.  <a href="#d1f7237c63af556a6f715f339ab57860"></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="val__kcache_8h.html#573c67a81fe4883654359b3f0d9ec785">key_cache_delete</a> (struct <a class="el" href="structkey__cache.html">key_cache</a> *kcache)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete the key cache.  <a href="#573c67a81fe4883654359b3f0d9ec785"></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="val__kcache_8h.html#7f715598528de31291f933fa353d8383">key_cache_insert</a> (struct <a class="el" href="structkey__cache.html">key_cache</a> *kcache, struct <a class="el" href="structkey__entry__key.html">key_entry_key</a> *kkey)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Insert or update a key cache <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a>.  <a href="#7f715598528de31291f933fa353d8383"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structkey__entry__key.html">key_entry_key</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="val__kcache_8h.html#4b959e26d8780b741d69928cbb2f25e6">key_cache_obtain</a> (struct <a class="el" href="structkey__cache.html">key_cache</a> *kcache, uint8_t *name, size_t namelen, uint16_t key_class, struct <a class="el" href="structregional.html">regional</a> *region, uint32_t now)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Lookup key <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a> in the cache.  <a href="#4b959e26d8780b741d69928cbb2f25e6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="val__kcache_8h.html#12bec4d0ff8b70bc3402db9b1b45288e">key_cache_get_mem</a> (struct <a class="el" href="structkey__cache.html">key_cache</a> *kcache)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get memory in use by the key cache.  <a href="#12bec4d0ff8b70bc3402db9b1b45288e"></a><br></td></tr>
</table>
<hr><h2>Detailed Description</h2>
This file contains functions for caching validated key entries. 
<p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="d1f7237c63af556a6f715f339ab57860"></a><!-- doxytag: member="val_kcache.h::key_cache_create" ref="d1f7237c63af556a6f715f339ab57860" args="(struct config_file *cfg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structkey__cache.html">key_cache</a>* key_cache_create           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structconfig__file.html">config_file</a> *&nbsp;</td>
          <td class="paramname"> <em>cfg</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create the key 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>cfg,:</em>&nbsp;</td><td>config settings for the key cache. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>new key cache or NULL on malloc failure. </dd></dl>

<p>References <a class="el" href="lruhash_8h_source.html#l00114">HASH_DEFAULT_STARTARRAY</a>, <a class="el" href="config__file_8h_source.html#l00224">config_file::key_cache_size</a>, <a class="el" href="config__file_8h_source.html#l00226">config_file::key_cache_slabs</a>, <a class="el" href="val__kentry_8c_source.html#l00062">key_entry_compfunc()</a>, <a class="el" href="val__kentry_8c_source.html#l00086">key_entry_deldatafunc()</a>, <a class="el" href="val__kentry_8c_source.html#l00075">key_entry_delkeyfunc()</a>, <a class="el" href="val__kentry_8c_source.html#l00050">key_entry_sizefunc()</a>, <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="val__kcache_8h_source.html#l00055">key_cache::slab</a>, and <a class="el" href="slabhash_8c_source.html#l00048">slabhash_create()</a>.</p>

<p>Referenced by <a class="el" href="validator_8c_source.html#l00101">val_apply_cfg()</a>.</p>

</div>
</div><p>
<a class="anchor" name="573c67a81fe4883654359b3f0d9ec785"></a><!-- doxytag: member="val_kcache.h::key_cache_delete" ref="573c67a81fe4883654359b3f0d9ec785" args="(struct key_cache *kcache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void key_cache_delete           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structkey__cache.html">key_cache</a> *&nbsp;</td>
          <td class="paramname"> <em>kcache</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Delete the key 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>kcache,:</em>&nbsp;</td><td>to delete </td></tr>
  </table>
</dl>

<p>References <a class="el" href="val__kcache_8h_source.html#l00055">key_cache::slab</a>, and <a class="el" href="slabhash_8c_source.html#l00087">slabhash_delete()</a>.</p>

<p>Referenced by <a class="el" href="validator_8c_source.html#l00172">val_deinit()</a>.</p>

</div>
</div><p>
<a class="anchor" name="7f715598528de31291f933fa353d8383"></a><!-- doxytag: member="val_kcache.h::key_cache_insert" ref="7f715598528de31291f933fa353d8383" args="(struct key_cache *kcache, struct key_entry_key *kkey)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void key_cache_insert           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structkey__cache.html">key_cache</a> *&nbsp;</td>
          <td class="paramname"> <em>kcache</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structkey__entry__key.html">key_entry_key</a> *&nbsp;</td>
          <td class="paramname"> <em>kkey</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Insert or update a key cache <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a>. 
<p>
Note that the insert may silently fail if there is not enough memory.<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>kcache,:</em>&nbsp;</td><td>the key cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>kkey,:</em>&nbsp;</td><td>key <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a> key, assumed malloced in a region, is copied to perform update or insertion. Its data pointer is also copied. </td></tr>
  </table>
</dl>

<p>References <a class="el" href="lruhash_8h_source.html#l00222">lruhash_entry::data</a>, <a class="el" href="val__kentry_8h_source.html#l00057">key_entry_key::entry</a>, <a class="el" href="lruhash_8h_source.html#l00218">lruhash_entry::hash</a>, <a class="el" href="val__kentry_8c_source.html#l00136">key_entry_copy()</a>, <a class="el" href="val__kentry_8c_source.html#l00094">key_entry_hash()</a>, <a class="el" href="val__kcache_8h_source.html#l00055">key_cache::slab</a>, and <a class="el" href="slabhash_8c_source.html#l00116">slabhash_insert()</a>.</p>

<p>Referenced by <a class="el" href="validator_8c_source.html#l02045">primeResponseToKE()</a>, and <a class="el" href="validator_8c_source.html#l02358">process_dnskey_response()</a>.</p>

</div>
</div><p>
<a class="anchor" name="4b959e26d8780b741d69928cbb2f25e6"></a><!-- doxytag: member="val_kcache.h::key_cache_obtain" ref="4b959e26d8780b741d69928cbb2f25e6" args="(struct key_cache *kcache, uint8_t *name, size_t namelen, uint16_t key_class, struct regional *region, uint32_t now)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structkey__entry__key.html">key_entry_key</a>* key_cache_obtain           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structkey__cache.html">key_cache</a> *&nbsp;</td>
          <td class="paramname"> <em>kcache</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>namelen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>key_class</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">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><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Lookup key <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a> in the cache. 
<p>
Looks up the closest key <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a> above the given name. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>kcache,:</em>&nbsp;</td><td>the key cache. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>name,:</em>&nbsp;</td><td>for what name to look; uncompressed wireformat </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>namelen,:</em>&nbsp;</td><td>length of the name. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>key_class,:</em>&nbsp;</td><td>class of the key. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>region,:</em>&nbsp;</td><td>a copy of the key_entry is allocated in this region. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>now,:</em>&nbsp;</td><td>current time. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to a newly allocated key_entry copy in the region, if a key <a class="el" href="structentry.html" title="data structure to keep the canned queries in.">entry</a> could be found, and allocation succeeded and TTL was OK. Otherwise, NULL is returned. </dd></dl>

<p>References <a class="el" href="lruhash_8h_source.html#l00222">lruhash_entry::data</a>, <a class="el" href="dname_8c_source.html#l00605">dname_is_root()</a>, <a class="el" href="dname_8c_source.html#l00615">dname_remove_label()</a>, <a class="el" href="val__kentry_8h_source.html#l00057">key_entry_key::entry</a>, <a class="el" href="val__kcache_8c_source.html#l00104">key_cache_search()</a>, <a class="el" href="val__kentry_8c_source.html#l00103">key_entry_copy_toregion()</a>, <a class="el" href="lruhash_8h_source.html#l00210">lruhash_entry::lock</a>, and <a class="el" href="val__kentry_8h_source.html#l00078">key_entry_data::ttl</a>.</p>

<p>Referenced by <a class="el" href="validator_8c_source.html#l01158">processInit()</a>.</p>

</div>
</div><p>
<a class="anchor" name="12bec4d0ff8b70bc3402db9b1b45288e"></a><!-- doxytag: member="val_kcache.h::key_cache_get_mem" ref="12bec4d0ff8b70bc3402db9b1b45288e" args="(struct key_cache *kcache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t key_cache_get_mem           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structkey__cache.html">key_cache</a> *&nbsp;</td>
          <td class="paramname"> <em>kcache</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get memory in use by the key 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>kcache,:</em>&nbsp;</td><td>the key cache. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>memory in use in bytes. </dd></dl>

<p>References <a class="el" href="val__kcache_8h_source.html#l00055">key_cache::slab</a>, and <a class="el" href="slabhash_8c_source.html#l00156">slabhash_get_mem()</a>.</p>

<p>Referenced by <a class="el" href="validator_8c_source.html#l02582">val_get_mem()</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Oct 13 06:46:33 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>