| Current File : //usr/share/doc/net-snmp/html/serialize_8c_source.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: serialize.c Source File</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
 <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 Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">serialize.c</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include <net-snmp/net-snmp-config.h></span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="preprocessor">#if HAVE_STRING_H</span>
<a name="l00004"></a>00004 <span class="preprocessor"></span><span class="preprocessor">#include <string.h></span>
<a name="l00005"></a>00005 <span class="preprocessor">#else</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#include <strings.h></span>
<a name="l00007"></a>00007 <span class="preprocessor">#endif</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span>
<a name="l00009"></a>00009 <span class="preprocessor">#include <net-snmp/net-snmp-includes.h></span>
<a name="l00010"></a>00010 <span class="preprocessor">#include <net-snmp/agent/net-snmp-agent-includes.h></span>
<a name="l00011"></a>00011
<a name="l00012"></a>00012 <span class="preprocessor">#include <net-snmp/agent/serialize.h></span>
<a name="l00013"></a>00013
<a name="l00030"></a>00030 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *
<a name="l00031"></a><a class="code" href="group__serialize.html#gae0aeed0da473505a5404a5c0d459412f">00031</a> <a class="code" href="group__serialize.html#gae0aeed0da473505a5404a5c0d459412f" title="returns a serialize handler that can be injected into a given handler chain.">netsnmp_get_serialize_handler</a>(<span class="keywordtype">void</span>)
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 <span class="keywordflow">return</span> <a class="code" href="group__handler.html#ga169c1653d481ed3d7df0c1795d99ca0c" title="creates a netsnmp_mib_handler structure given a name and a access method.">netsnmp_create_handler</a>(<span class="stringliteral">"serialize"</span>,
<a name="l00034"></a>00034 <a class="code" href="group__serialize.html#ga8db5ff4abb2bc94f5c126433e3f24e76" title="Implements the serial handler.">netsnmp_serialize_helper_handler</a>);
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036
<a name="l00039"></a>00039 <span class="keywordtype">int</span>
<a name="l00040"></a><a class="code" href="group__serialize.html#ga09c511d8a9c3b00a72884600a623d8a2">00040</a> <a class="code" href="group__serialize.html#ga09c511d8a9c3b00a72884600a623d8a2" title="functionally the same as calling netsnmp_register_handler() but also injects a serialize handler at t...">netsnmp_register_serialize</a>(<a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo)
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042 <a class="code" href="group__handler.html#ga6649d75b3eaf98d70704754d3d8235f3" title="inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registrat...">netsnmp_inject_handler</a>(reginfo, <a class="code" href="group__serialize.html#gae0aeed0da473505a5404a5c0d459412f" title="returns a serialize handler that can be injected into a given handler chain.">netsnmp_get_serialize_handler</a>());
<a name="l00043"></a>00043 <span class="keywordflow">return</span> <a class="code" href="group__handler.html#gacdbdb9d74898a5bf04b0992ea0316aa4" title="register a handler, as defined by the netsnmp_handler_registration pointer.">netsnmp_register_handler</a>(reginfo);
<a name="l00044"></a>00044 }
<a name="l00045"></a>00045
<a name="l00047"></a>00047 <span class="keywordtype">int</span>
<a name="l00048"></a><a class="code" href="group__serialize.html#ga8db5ff4abb2bc94f5c126433e3f24e76">00048</a> <a class="code" href="group__serialize.html#ga8db5ff4abb2bc94f5c126433e3f24e76" title="Implements the serial handler.">netsnmp_serialize_helper_handler</a>(<a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *handler,
<a name="l00049"></a>00049 <a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00050"></a>00050 <a class="code" href="structnetsnmp__agent__request__info__s.html" title="The agent transaction request structure.">netsnmp_agent_request_info</a> *reqinfo,
<a name="l00051"></a>00051 <a class="code" href="structnetsnmp__request__info__s.html" title="The netsnmp request info structure.">netsnmp_request_info</a> *requests)
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <a class="code" href="structnetsnmp__request__info__s.html" title="The netsnmp request info structure.">netsnmp_request_info</a> *request, *requesttmp;
<a name="l00055"></a>00055
<a name="l00056"></a>00056 DEBUGMSGTL((<span class="stringliteral">"helper:serialize"</span>, <span class="stringliteral">"Got request\n"</span>));
<a name="l00057"></a>00057 <span class="comment">/*</span>
<a name="l00058"></a>00058 <span class="comment"> * loop through requests </span>
<a name="l00059"></a>00059 <span class="comment"> */</span>
<a name="l00060"></a>00060 <span class="keywordflow">for</span> (request = requests; request; request = request->next) {
<a name="l00061"></a>00061 <span class="keywordtype">int</span> ret;
<a name="l00062"></a>00062
<a name="l00063"></a>00063 <span class="comment">/*</span>
<a name="l00064"></a>00064 <span class="comment"> * store next pointer and delete it </span>
<a name="l00065"></a>00065 <span class="comment"> */</span>
<a name="l00066"></a>00066 requesttmp = request->next;
<a name="l00067"></a>00067 request->next = NULL;
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="comment">/*</span>
<a name="l00070"></a>00070 <span class="comment"> * call the next handler </span>
<a name="l00071"></a>00071 <span class="comment"> */</span>
<a name="l00072"></a>00072 ret =
<a name="l00073"></a>00073 <a class="code" href="group__handler.html#gae45d1dbf0999b242f4f45714c7a63c1b" title="calls the next handler in the chain after the current one with with appropriate NULL checking...">netsnmp_call_next_handler</a>(handler, reginfo, reqinfo, request);
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="comment">/*</span>
<a name="l00076"></a>00076 <span class="comment"> * restore original next pointer </span>
<a name="l00077"></a>00077 <span class="comment"> */</span>
<a name="l00078"></a>00078 request->next = requesttmp;
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="keywordflow">if</span> (ret != SNMP_ERR_NOERROR)
<a name="l00081"></a>00081 <span class="keywordflow">return</span> ret;
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083
<a name="l00084"></a>00084 <span class="keywordflow">return</span> SNMP_ERR_NOERROR;
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086
<a name="l00092"></a>00092 <span class="keywordtype">void</span>
<a name="l00093"></a><a class="code" href="group__serialize.html#gae710ab1626d53847843f1821b298b6ea">00093</a> <a class="code" href="group__debug.html#gae710ab1626d53847843f1821b298b6ea" title="initializes the serialize helper which then registers a serialize handler as a run-time injectable ha...">netsnmp_init_serialize</a>(<span class="keywordtype">void</span>)
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095 <a class="code" href="group__handler.html#gacbb642ff9ceefcd591d455e0c9295bc5" title="registers a given handler by name so that it can be found easily later.">netsnmp_register_handler_by_name</a>(<span class="stringliteral">"serialize"</span>,
<a name="l00096"></a>00096 <a class="code" href="group__serialize.html#gae0aeed0da473505a5404a5c0d459412f" title="returns a serialize handler that can be injected into a given handler chain.">netsnmp_get_serialize_handler</a>());
<a name="l00097"></a>00097 }
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <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>