bulk__to__next_8c-source.html from net-snmp at Krugle
Show bulk__to__next_8c-source.html syntax highlighted
<!--#set var="section" value="development" -->
<!--#include virtual="/page-top.html" -->
<!-- CONTENT START -->
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex">
<a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class=
"qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class=
"qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="pages.html">Related Pages</a> | <a class=
"qindex" href="examples.html">Examples</a>
</div>
<div class="nav">
<a class="el" href="dir_000003.html">agent</a> / <a class="el" href="dir_000004.html">helpers</a>
</div>
<h1>bulk_to_next.c</h1>
<div class="fragment">
<pre class="fragment">
00001 <span class="preprocessor">#include <net-snmp/net-snmp-config.h></span>
00002
00003 <span class="preprocessor">#if HAVE_STRING_H</span>
00004 <span class="preprocessor">#include <string.h></span>
00005 <span class="preprocessor">#else</span>
00006 <span class="preprocessor">#include <strings.h></span>
00007 <span class="preprocessor">#endif</span>
00008
00009 <span class="preprocessor">#include <net-snmp/net-snmp-includes.h></span>
00010 <span class="preprocessor">#include <net-snmp/agent/net-snmp-agent-includes.h></span>
00011
00012 <span class="preprocessor">#include <net-snmp/agent/bulk_to_next.h></span>
00013
00025 <a class="code" href="structnetsnmp__mib__handler__s.html">netsnmp_mib_handler</a> *
<a name="l00026" id="l00026"></a><a class="code" href="group__bulk__to__next.html#ga0">00026</a> <a class="code" href=
"group__bulk__to__next.html#ga0">netsnmp_get_bulk_to_next_handler</a>(<span class="keywordtype">void</span>)
00027 {
00028 <a class="code" href="structnetsnmp__mib__handler__s.html">netsnmp_mib_handler</a> *handler =
00029 <a class="code" href="group__handler.html#ga7">netsnmp_create_handler</a>(<span class=
"stringliteral">"bulk_to_next"</span>,
00030 netsnmp_bulk_to_next_helper);
00031
00032 <span class="keywordflow">if</span> (NULL != handler)
00033 handler-><a class="code" href="structnetsnmp__mib__handler__s.html#o2">flags</a> |= MIB_HANDLER_AUTO_NEXT;
00034
00035 <span class="keywordflow">return</span> handler;
00036 }
00037
00040 <span class="keywordtype">void</span>
<a name="l00041" id="l00041"></a><a class="code" href="group__bulk__to__next.html#ga1">00041</a> <a class="code" href=
"group__bulk__to__next.html#ga1">netsnmp_bulk_to_next_fix_requests</a>(<a class="code" href=
"structnetsnmp__request__info__s.html">netsnmp_request_info</a> *requests)
00042 {
00043 <a class="code" href="structnetsnmp__request__info__s.html">netsnmp_request_info</a> *request;
00044 <span class="comment">/*</span>
00045 <span class="comment"> * update the varbinds for the next request series </span>
00046 <span class="comment"> */</span>
00047 <span class="keywordflow">for</span> (request = requests; request; request = request-><a class="code" href=
"structnetsnmp__request__info__s.html#o13">next</a>) {
00048 <span class="keywordflow">if</span> (request-><a class="code" href=
"structnetsnmp__request__info__s.html#o10">repeat</a> > 0 &&
00049 request-><a class="code" href="structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code"
href="structvariable__list.html#o3">type</a> != ASN_NULL &&
00050 request-><a class="code" href="structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code"
href="structvariable__list.html#o3">type</a> != ASN_PRIV_RETRY &&
00051 request-><a class="code" href="structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code"
href="structvariable__list.html#o0">next_variable</a> ) {
00052 request-><a class="code" href="structnetsnmp__request__info__s.html#o10">repeat</a>--;
00053 snmp_set_var_objid(request-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code" href=
"structvariable__list.html#o0">next_variable</a>,
00054 request-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code" href="structvariable__list.html#o1">name</a>,
00055 request-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code" href="structvariable__list.html#o2">name_length</a>);
00056 request-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a> = request-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code" href=
"structvariable__list.html#o0">next_variable</a>;
00057 request-><a class="code" href="structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code"
href="structvariable__list.html#o3">type</a> = ASN_PRIV_RETRY;
00058 }
00059 }
00060 }
00061
00063 <span class="keywordtype">int</span>
00064 netsnmp_bulk_to_next_helper(<a class="code" href="structnetsnmp__mib__handler__s.html">netsnmp_mib_handler</a> *handler,
00065 <a class="code" href=
"structnetsnmp__handler__registration__s.html">netsnmp_handler_registration</a> *reginfo,
00066 <a class="code" href=
"structnetsnmp__agent__request__info__s.html">netsnmp_agent_request_info</a> *reqinfo,
00067 <a class="code" href="structnetsnmp__request__info__s.html">netsnmp_request_info</a> *requests)
00068 {
00069
00070 <span class="keywordtype">int</span> ret = SNMP_ERR_NOERROR;
00071
00072 <span class="comment">/*</span>
00073 <span class="comment"> * this code depends on AUTO_NEXT being set</span>
00074 <span class="comment"> */</span>
00075 netsnmp_assert(handler-><a class="code" href=
"structnetsnmp__mib__handler__s.html#o2">flags</a> & MIB_HANDLER_AUTO_NEXT);
00076
00077 <span class="comment">/*</span>
00078 <span class="comment"> * don't do anything for any modes besides GETBULK. Just return, and</span>
00079 <span class="comment"> * the agent will call the next handler (AUTO_NEXT).</span>
00080 <span class="comment"> *</span>
00081 <span class="comment"> * for GETBULK, we munge the mode, call the next handler ourselves</span>
00082 <span class="comment"> * (setting AUTO_NEXT_OVERRRIDE so the agent knows what we did),</span>
00083 <span class="comment"> * restore the mode and fix up the requests.</span>
00084 <span class="comment"> */</span>
00085 <span class="keywordflow">if</span>(MODE_GETBULK == reqinfo-><a class="code" href=
"structnetsnmp__agent__request__info__s.html#o0">mode</a>) {
00086
00087 DEBUGIF(<span class="stringliteral">"bulk_to_next"</span>) {
00088 <a class="code" href="structnetsnmp__request__info__s.html">netsnmp_request_info</a> *req = requests;
00089 <span class="keywordflow">while</span>(req) {
00090 DEBUGMSGTL((<span class="stringliteral">"bulk_to_next"</span>, <span class=
"stringliteral">"Got request: "</span>));
00091 DEBUGMSGOID((<span class="stringliteral">"bulk_to_next"</span>, req-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code" href="structvariable__list.html#o1">name</a>,
00092 req-><a class="code" href=
"structnetsnmp__request__info__s.html#o0">requestvb</a>-><a class="code" href=
"structvariable__list.html#o2">name_length</a>));
00093 DEBUGMSG((<span class="stringliteral">"bulk_to_next"</span>, <span class="stringliteral">"\n"</span>));
00094 req = req-><a class="code" href="structnetsnmp__request__info__s.html#o13">next</a>;
00095 }
00096 }
00097
00098 reqinfo-><a class="code" href="structnetsnmp__agent__request__info__s.html#o0">mode</a> = MODE_GETNEXT;
00099 ret =
00100 <a class="code" href=
"group__handler.html#ga17">netsnmp_call_next_handler</a>(handler, reginfo, reqinfo, requests);
00101 reqinfo-><a class="code" href="structnetsnmp__agent__request__info__s.html#o0">mode</a> = MODE_GETBULK;
00102
00103 <span class="comment">/*</span>
00104 <span class="comment"> * update the varbinds for the next request series </span>
00105 <span class="comment"> */</span>
00106 <a class="code" href="group__bulk__to__next.html#ga1">netsnmp_bulk_to_next_fix_requests</a>(requests);
00107
00108 <span class="comment">/*</span>
00109 <span class="comment"> * let agent handler know that we've already called next handler</span>
00110 <span class="comment"> */</span>
00111 handler-><a class="code" href=
"structnetsnmp__mib__handler__s.html#o2">flags</a> |= MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE;
00112 }
00113
00114 <span class="keywordflow">return</span> ret;
00115 }
00116
00121 <span class="keywordtype">void</span>
<a name="l00122" id="l00122"></a><a class="code" href="group__bulk__to__next.html#ga3">00122</a> <a class="code" href=
"group__debug.html#ga6">netsnmp_init_bulk_to_next_helper</a>(<span class="keywordtype">void</span>)
00123 {
00124 <a class="code" href="group__handler.html#ga36">netsnmp_register_handler_by_name</a>(<span class=
"stringliteral">"bulk_to_next"</span>,
00125 <a class="code" href=
"group__bulk__to__next.html#ga0">netsnmp_get_bulk_to_next_handler</a>());
00126 }
</pre>
</div>
<hr size="1" />
<address style="align: right;">
<small>Generated on Fri Dec 30 13:47:44 2005 for net-snmp by <a href="http://www.doxygen.org/index.html"><img src=
"doxygen.png" alt="doxygen" align="middle" border="0" /></a> 1.3.9.1</small>
</address>
<!-- CONTENT END -->
<!--#include virtual="/page-bottom.html" -->
See more files for this project here