Current File : //usr/share/doc/net-snmp/html/group__cache__handler.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>net-snmp: cache_handler</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">net-snmp
   &#160;<span id="projectnumber">5.4.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">cache_handler</div>  </div>
<div class="ingroups"><a class="el" href="group__utilities.html">utility_handlers</a></div></div><!--header-->
<div class="contents">

<p>Maintains a cache of data for use by lower level handlers.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga7c4ec81361b36cc73623471cb9c7ebf1">netsnmp_cache_get_head</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">get cache head  <a href="#ga7c4ec81361b36cc73623471cb9c7ebf1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga52c1f85e3f852b335595c242b7980bd8">netsnmp_cache_find_by_oid</a> (oid *rootoid, int rootoid_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">find existing cache  <a href="#ga52c1f85e3f852b335595c242b7980bd8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga6c5faadfec4598494240d8ecd31f647b">netsnmp_cache_create</a> (int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook, oid *rootoid, int rootoid_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">returns a cache  <a href="#ga6c5faadfec4598494240d8ecd31f647b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#gadf49a3dc1aa486f3336ea7eab3ae7aaa">netsnmp_cache_timer_start</a> (<a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">starts the recurring cache_load callback  <a href="#gadf49a3dc1aa486f3336ea7eab3ae7aaa"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga2299bbabdc6f2f342404c1e23b9b9ec2">netsnmp_cache_timer_stop</a> (<a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">stops the recurring cache_load callback  <a href="#ga2299bbabdc6f2f342404c1e23b9b9ec2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__handler.html#ga77f4225c0e0c1d549e634f58dba3de3d">netsnmp_mib_handler</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga88681686401ef8d1d45b60b9eaebdbf9">netsnmp_cache_handler_get</a> (<a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">returns a cache handler that can be injected into a given handler chain.  <a href="#ga88681686401ef8d1d45b60b9eaebdbf9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__handler.html#ga77f4225c0e0c1d549e634f58dba3de3d">netsnmp_mib_handler</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga5b43d9de132595501f32f826ee37daf5">netsnmp_get_cache_handler</a> (int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook, oid *rootoid, int rootoid_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">returns a cache handler that can be injected into a given handler chain.  <a href="#ga5b43d9de132595501f32f826ee37daf5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga1992834ca4eddf4499567a1119119f76">netsnmp_cache_handler_register</a> (<a class="el" href="group__handler.html#gac475ff73806c2d76ebfc78a87d921b8b">netsnmp_handler_registration</a> *reginfo, <a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">functionally the same as calling <a class="el" href="group__handler.html#gacdbdb9d74898a5bf04b0992ea0316aa4" title="register a handler, as defined by the netsnmp_handler_registration pointer.">netsnmp_register_handler()</a> but also injects a cache handler at the same time for you.  <a href="#ga1992834ca4eddf4499567a1119119f76"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#gab206126ebd47097c0543c848dbdc8f10">netsnmp_register_cache_handler</a> (<a class="el" href="group__handler.html#gac475ff73806c2d76ebfc78a87d921b8b">netsnmp_handler_registration</a> *reginfo, int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">functionally the same as calling <a class="el" href="group__handler.html#gacdbdb9d74898a5bf04b0992ea0316aa4" title="register a handler, as defined by the netsnmp_handler_registration pointer.">netsnmp_register_handler()</a> but also injects a cache handler at the same time for you.  <a href="#gab206126ebd47097c0543c848dbdc8f10"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf5de74e41cc43d867efbff73c52e1958"></a><!-- doxytag: member="cache_handler::_build_cache_name" ref="gaf5de74e41cc43d867efbff73c52e1958" args="(const char *name)" -->
NETSNMP_STATIC_INLINE char *&#160;</td><td class="memItemRight" valign="bottom"><b>_build_cache_name</b> (const char *name)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#gadcf7437ac73ef1b6f4ca75be6dd15070">netsnmp_cache_reqinfo_insert</a> (<a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache, <a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo, const char *name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert the cache information for a given request (PDU)  <a href="#gadcf7437ac73ef1b6f4ca75be6dd15070"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga58ecdafd59f4b72f1d41aa25bf088ddf">netsnmp_cache_reqinfo_extract</a> (<a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo, const char *name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract the cache information for a given request (PDU)  <a href="#ga58ecdafd59f4b72f1d41aa25bf088ddf"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga883fcf5b05d6f6cfe40fc1807f57d9dd">netsnmp_extract_cache_info</a> (<a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract the cache information for a given request (PDU)  <a href="#ga883fcf5b05d6f6cfe40fc1807f57d9dd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga143107a4bc8936250f6ebac8931ced69">netsnmp_cache_check_expired</a> (<a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if the cache timeout has passed.  <a href="#ga143107a4bc8936250f6ebac8931ced69"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#gadfd7cc2cd0b8bf3f4da307251f44faa1">netsnmp_cache_check_and_reload</a> (<a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *cache)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reload the cache if required.  <a href="#gadfd7cc2cd0b8bf3f4da307251f44faa1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#gabda646537990048988842a9c9f46c839">netsnmp_cache_is_valid</a> (<a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo, const char *name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Is the cache valid for a given request?  <a href="#gabda646537990048988842a9c9f46c839"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga8ea1279d37397441c87f8f1d8146e24f">netsnmp_is_cache_valid</a> (<a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Is the cache valid for a given request? for backwards compatability.  <a href="#ga8ea1279d37397441c87f8f1d8146e24f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#gadf6eac4e2e67de0bf8fbae2c5d6f97c0">netsnmp_cache_helper_handler</a> (<a class="el" href="group__handler.html#ga77f4225c0e0c1d549e634f58dba3de3d">netsnmp_mib_handler</a> *handler, <a class="el" href="group__handler.html#gac475ff73806c2d76ebfc78a87d921b8b">netsnmp_handler_registration</a> *reginfo, <a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo, <a class="el" href="structnetsnmp__request__info__s.html">netsnmp_request_info</a> *requests)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Implements the cache handler.  <a href="#gadf6eac4e2e67de0bf8fbae2c5d6f97c0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cache__handler.html#ga53067321af0f0fbb96dd8626bcbed94f">release_cached_resources</a> (unsigned int regNo, void *clientargs)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">run regularly to automatically release cached resources.  <a href="#ga53067321af0f0fbb96dd8626bcbed94f"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Maintains a cache of data for use by lower level handlers. </p>
<p>This helper checks to see whether the data has been loaded "recently" (according to the timeout for that particular cache) and calls the registered "load_cache" routine if necessary. The lower handlers can then work with this local cached data.</p>
<p>A timeout value of -1 will cause <a class="el" href="group__cache__handler.html#ga143107a4bc8936250f6ebac8931ced69" title="Check if the cache timeout has passed.">netsnmp_cache_check_expired()</a> to always return true, and thus the cache will be reloaded for every request.</p>
<p>To minimze resource use by the agent, a periodic callback checks for expired caches, and will call the free_cache function for any expired cache.</p>
<p>The load_cache route should return a negative number if the cache was not successfully loaded. 0 or any positive number indicates successs.</p>
<p>Several flags can be set to affect the operations on the cache.</p>
<p>If NETSNMP_CACHE_DONT_INVALIDATE_ON_SET is set, the free_cache method will not be called after a set request has processed. It is assumed that the lower mib handler using the cache has maintained cache consistency.</p>
<p>If NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD is set, the free_cache method will not be called before the load_cache method is called. It is assumed that the load_cache routine will properly deal with being called with a valid cache.</p>
<p>If NETSNMP_CACHE_DONT_FREE_EXPIRED is set, the free_cache method will not be called with the cache expires. The expired flag will be set, but the valid flag will not be cleared. It is assumed that the load_cache routine will properly deal with being called with a valid cache.</p>
<p>If NETSNMP_CACHE_PRELOAD is set when a the cache handler is created, the cache load routine will be called immediately.</p>
<p>If NETSNMP_CACHE_DONT_AUTO_RELEASE is set, the periodic callback that checks for expired caches will skip the cache. The cache will only be checked for expiration when a request triggers the cache handler. This is useful if the cache has it's own periodic callback to keep the cache fresh.</p>
<p>If NETSNMP_CACHE_AUTO_RELOAD is set, a timer will be set up to reload the cache when it expires. This is useful for keeping the cache fresh, even in the absence of incoming snmp requests.</p>
<p>Here are some suggestions for some common situations.</p>
<p>Cached File: If your table is based on a file that may periodically change, you can test the modification date to see if the file has changed since the last cache load. To get the cache helper to call the load function for every request, set the timeout to -1, which will cause the cache to always report that it is expired. This means that you will want to prevent the agent from flushing the cache when it has expired, and you will have to flush it manually if you detect that the file has changed. To accomplish this, set the following flags:</p>
<p>NETSNMP_CACHE_DONT_FREE_EXPIRED NETSNMP_CACHE_DONT_AUTO_RELEASE</p>
<p>Constant (periodic) reload: If you want the cache kept up to date regularly, even if no requests for the table are received, you can have your cache load routine called periodically. This is very useful if you need to monitor the data for changes (eg a <em>LastChanged</em> object). You will need to prevent the agent from flushing the cache when it expires. Set the cache timeout to the frequency, in seconds, that you wish to reload your cache, and set the following flags:</p>
<p>NETSNMP_CACHE_DONT_FREE_EXPIRED NETSNMP_CACHE_DONT_AUTO_RELEASE NETSNMP_CACHE_AUTO_RELOAD </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gadfd7cc2cd0b8bf3f4da307251f44faa1"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_check_and_reload" ref="gadfd7cc2cd0b8bf3f4da307251f44faa1" args="(netsnmp_cache *cache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#gadfd7cc2cd0b8bf3f4da307251f44faa1">netsnmp_cache_check_and_reload</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reload the cache if required. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00385">385</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga143107a4bc8936250f6ebac8931ced69"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_check_expired" ref="ga143107a4bc8936250f6ebac8931ced69" args="(netsnmp_cache *cache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#ga143107a4bc8936250f6ebac8931ced69">netsnmp_cache_check_expired</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Check if the cache timeout has passed. </p>
<p>Sets and return the expired flag. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00370">370</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga6c5faadfec4598494240d8ecd31f647b"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_create" ref="ga6c5faadfec4598494240d8ecd31f647b" args="(int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook, oid *rootoid, int rootoid_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a>* <a class="el" href="group__cache__handler.html#ga6c5faadfec4598494240d8ecd31f647b">netsnmp_cache_create</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NetsnmpCacheLoad *&#160;</td>
          <td class="paramname"><em>load_hook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NetsnmpCacheFree *&#160;</td>
          <td class="paramname"><em>free_hook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">oid *&#160;</td>
          <td class="paramname"><em>rootoid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rootoid_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>returns a cache </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00136">136</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga52c1f85e3f852b335595c242b7980bd8"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_find_by_oid" ref="ga52c1f85e3f852b335595c242b7980bd8" args="(oid *rootoid, int rootoid_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a>* <a class="el" href="group__cache__handler.html#ga52c1f85e3f852b335595c242b7980bd8">netsnmp_cache_find_by_oid</a> </td>
          <td>(</td>
          <td class="paramtype">oid *&#160;</td>
          <td class="paramname"><em>rootoid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rootoid_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>find existing cache </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00120">120</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga7c4ec81361b36cc73623471cb9c7ebf1"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_get_head" ref="ga7c4ec81361b36cc73623471cb9c7ebf1" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a>* <a class="el" href="group__cache__handler.html#ga7c4ec81361b36cc73623471cb9c7ebf1">netsnmp_cache_get_head</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>get cache head </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00112">112</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga88681686401ef8d1d45b60b9eaebdbf9"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_handler_get" ref="ga88681686401ef8d1d45b60b9eaebdbf9" args="(netsnmp_cache *cache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__handler.html#ga77f4225c0e0c1d549e634f58dba3de3d">netsnmp_mib_handler</a>* <a class="el" href="group__cache__handler.html#ga88681686401ef8d1d45b60b9eaebdbf9">netsnmp_cache_handler_get</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>returns a cache handler that can be injected into a given handler chain. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00247">247</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga1992834ca4eddf4499567a1119119f76"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_handler_register" ref="ga1992834ca4eddf4499567a1119119f76" args="(netsnmp_handler_registration *reginfo, netsnmp_cache *cache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#ga1992834ca4eddf4499567a1119119f76">netsnmp_cache_handler_register</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__handler.html#gac475ff73806c2d76ebfc78a87d921b8b">netsnmp_handler_registration</a> *&#160;</td>
          <td class="paramname"><em>reginfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>functionally the same as calling <a class="el" href="group__handler.html#gacdbdb9d74898a5bf04b0992ea0316aa4" title="register a handler, as defined by the netsnmp_handler_registration pointer.">netsnmp_register_handler()</a> but also injects a cache handler at the same time for you. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00295">295</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="gadf6eac4e2e67de0bf8fbae2c5d6f97c0"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_helper_handler" ref="gadf6eac4e2e67de0bf8fbae2c5d6f97c0" args="(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#gadf6eac4e2e67de0bf8fbae2c5d6f97c0">netsnmp_cache_helper_handler</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__handler.html#ga77f4225c0e0c1d549e634f58dba3de3d">netsnmp_mib_handler</a> *&#160;</td>
          <td class="paramname"><em>handler</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__handler.html#gac475ff73806c2d76ebfc78a87d921b8b">netsnmp_handler_registration</a> *&#160;</td>
          <td class="paramname"><em>reginfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *&#160;</td>
          <td class="paramname"><em>reqinfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structnetsnmp__request__info__s.html">netsnmp_request_info</a> *&#160;</td>
          <td class="paramname"><em>requests</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Implements the cache handler. </p>
<p>next handler called automatically - 'AUTO_NEXT'</p>
<p>next handler called automatically - 'AUTO_NEXT'</p>
<p>next handler called automatically - 'AUTO_NEXT' </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00420">420</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="gabda646537990048988842a9c9f46c839"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_is_valid" ref="gabda646537990048988842a9c9f46c839" args="(netsnmp_agent_request_info *reqinfo, const char *name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#gabda646537990048988842a9c9f46c839">netsnmp_cache_is_valid</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *&#160;</td>
          <td class="paramname"><em>reqinfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Is the cache valid for a given request? </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00402">402</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga58ecdafd59f4b72f1d41aa25bf088ddf"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_reqinfo_extract" ref="ga58ecdafd59f4b72f1d41aa25bf088ddf" args="(netsnmp_agent_request_info *reqinfo, const char *name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a>* <a class="el" href="group__cache__handler.html#ga58ecdafd59f4b72f1d41aa25bf088ddf">netsnmp_cache_reqinfo_extract</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *&#160;</td>
          <td class="paramname"><em>reqinfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Extract the cache information for a given request (PDU) </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00350">350</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="gadcf7437ac73ef1b6f4ca75be6dd15070"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_reqinfo_insert" ref="gadcf7437ac73ef1b6f4ca75be6dd15070" args="(netsnmp_cache *cache, netsnmp_agent_request_info *reqinfo, const char *name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group__cache__handler.html#gadcf7437ac73ef1b6f4ca75be6dd15070">netsnmp_cache_reqinfo_insert</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *&#160;</td>
          <td class="paramname"><em>reqinfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Insert the cache information for a given request (PDU) </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00333">333</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="gadf49a3dc1aa486f3336ea7eab3ae7aaa"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_timer_start" ref="gadf49a3dc1aa486f3336ea7eab3ae7aaa" args="(netsnmp_cache *cache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int <a class="el" href="group__cache__handler.html#gadf49a3dc1aa486f3336ea7eab3ae7aaa">netsnmp_cache_timer_start</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>starts the recurring cache_load callback </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00191">191</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga2299bbabdc6f2f342404c1e23b9b9ec2"></a><!-- doxytag: member="cache_handler.c::netsnmp_cache_timer_stop" ref="ga2299bbabdc6f2f342404c1e23b9b9ec2" args="(netsnmp_cache *cache)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group__cache__handler.html#ga2299bbabdc6f2f342404c1e23b9b9ec2">netsnmp_cache_timer_stop</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a> *&#160;</td>
          <td class="paramname"><em>cache</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>stops the recurring cache_load callback </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00226">226</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga883fcf5b05d6f6cfe40fc1807f57d9dd"></a><!-- doxytag: member="cache_handler.c::netsnmp_extract_cache_info" ref="ga883fcf5b05d6f6cfe40fc1807f57d9dd" args="(netsnmp_agent_request_info *reqinfo)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structnetsnmp__cache__s.html">netsnmp_cache</a>* <a class="el" href="group__cache__handler.html#ga883fcf5b05d6f6cfe40fc1807f57d9dd">netsnmp_extract_cache_info</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *&#160;</td>
          <td class="paramname"><em>reqinfo</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Extract the cache information for a given request (PDU) </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00362">362</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga5b43d9de132595501f32f826ee37daf5"></a><!-- doxytag: member="cache_handler.c::netsnmp_get_cache_handler" ref="ga5b43d9de132595501f32f826ee37daf5" args="(int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook, oid *rootoid, int rootoid_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__handler.html#ga77f4225c0e0c1d549e634f58dba3de3d">netsnmp_mib_handler</a>* <a class="el" href="group__cache__handler.html#ga5b43d9de132595501f32f826ee37daf5">netsnmp_get_cache_handler</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NetsnmpCacheLoad *&#160;</td>
          <td class="paramname"><em>load_hook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NetsnmpCacheFree *&#160;</td>
          <td class="paramname"><em>free_hook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">oid *&#160;</td>
          <td class="paramname"><em>rootoid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rootoid_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>returns a cache handler that can be injected into a given handler chain. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00276">276</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga8ea1279d37397441c87f8f1d8146e24f"></a><!-- doxytag: member="cache_handler.c::netsnmp_is_cache_valid" ref="ga8ea1279d37397441c87f8f1d8146e24f" args="(netsnmp_agent_request_info *reqinfo)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#ga8ea1279d37397441c87f8f1d8146e24f">netsnmp_is_cache_valid</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *&#160;</td>
          <td class="paramname"><em>reqinfo</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Is the cache valid for a given request? for backwards compatability. </p>
<p>for backwards compat</p>
<p><a class="el" href="group__cache__handler.html#gabda646537990048988842a9c9f46c839" title="Is the cache valid for a given request?">netsnmp_cache_is_valid()</a> is preferred. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00413">413</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="gab206126ebd47097c0543c848dbdc8f10"></a><!-- doxytag: member="cache_handler.c::netsnmp_register_cache_handler" ref="gab206126ebd47097c0543c848dbdc8f10" args="(netsnmp_handler_registration *reginfo, int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__cache__handler.html#gab206126ebd47097c0543c848dbdc8f10">netsnmp_register_cache_handler</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__handler.html#gac475ff73806c2d76ebfc78a87d921b8b">netsnmp_handler_registration</a> *&#160;</td>
          <td class="paramname"><em>reginfo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NetsnmpCacheLoad *&#160;</td>
          <td class="paramname"><em>load_hook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NetsnmpCacheFree *&#160;</td>
          <td class="paramname"><em>free_hook</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>functionally the same as calling <a class="el" href="group__handler.html#gacdbdb9d74898a5bf04b0992ea0316aa4" title="register a handler, as defined by the netsnmp_handler_registration pointer.">netsnmp_register_handler()</a> but also injects a cache handler at the same time for you. </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00308">308</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga53067321af0f0fbb96dd8626bcbed94f"></a><!-- doxytag: member="cache_handler.c::release_cached_resources" ref="ga53067321af0f0fbb96dd8626bcbed94f" args="(unsigned int regNo, void *clientargs)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group__cache__handler.html#ga53067321af0f0fbb96dd8626bcbed94f">release_cached_resources</a> </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>regNo</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>clientargs</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>run regularly to automatically release cached resources. </p>
<p>xxx - method to prevent cache from expiring while a request is being processed (e.g. delegated request). proposal: set a flag, which would be cleared when request finished (which could be acomplished by a dummy data list item in agent req info &amp; custom free function). </p>

<p>Definition at line <a class="el" href="cache__handler_8c_source.html#l00575">575</a> of file <a class="el" href="cache__handler_8c_source.html">cache_handler.c</a>.</p>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>