⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c-agent11.html

📁 vxworks相关论文
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title>    The WindNet SNMPv1/v2c Agent   </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a></a><a href="c-agent.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-agent10.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-agent12.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="83986">4.11  &nbsp;&nbsp;Request Processing</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83987"> </a>In the following discussions, the term <i class="term">VarBindList</i> refers to a <i class="term">variable-binding list</i>, a list of <i class="term">variable-binding pointer</i> (<i class="term">vbp</i>) instances. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="83988">4.11.1  &nbsp;&nbsp;<b class="keyword">GET</b> PDU Processing</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83989"> </a>A <i class="term">VarBindList</i> is allocated and initialized to hold the response information.  Then the request <i class="term">VarBindList</i> is processed in two passes. </p><dd><p class="Body"><a name="83990"> </a>In the first pass, each variable's leaf is located and checked for visibility in the current MIB view (see <a href="c-agent9.html#83916"><i class="title">4.9&nbsp;View Tables</i></a>).</p><dd><p class="Body"><a name="83994"> </a>In the second pass, the agent calls the <b class="keyword">getproc</b> routines to perform instance-level testing and to find the values for the objects (for details, see the manual pages for snmpProcLib in <a href="snmp.refEntries.TOC.html#83416"><i class="title">F.&nbsp;SNMP Reference</i></a>).  Instead of returning the value, each <b class="keyword">getproc</b> operation is responsible for installing it in the <i class="term">vbp</i> by calling one of the <b class="routine"><i class="routine">getproc_got_*</i></b><b>(&nbsp;)</b> functions.  A <b class="keyword">getproc</b><b class="routine"><i class="routine"> </i></b>operation may also assume responsibility for other <i class="term">vbp</i>s in which case it should call one of the <b class="routine"><i class="routine">getproc_got_*</i></b><b>(&nbsp;)</b> functions on their behalf.</p><dd><p class="Body"><a name="83995"> </a>An exception is generated (<b class="routine"><i class="routine">getproc_nosuchinst</i></b><b>(&nbsp;)</b>) if an object does not exist or if an instance does not exist.  For other errors, the response <i class="term">VarBindList</i> is discarded and the original list is converted into a response with an appropriate error code and encoded into a buffer.</p><dd><p class="Body"><a name="83996"> </a>(<i class="emphasis">Note:</i> the following only applies to asynchronous method routines; see <a href="c-extend5.html#84336"><i class="title">6.5&nbsp;Asynchronous Method Routines</i></a>.) <b class="routine"><i class="routine">snmpdContinue</i></b><b>(&nbsp;)</b> is called when all the <b class="keyword">getproc</b><b>(&nbsp;)</b>operations have been started. It should be called when any tasks complete that were begun by a <b class="keyword">getproc</b> operation but did not finish.  <b class="routine"><i class="routine">snmpdContinue</i></b><b>(&nbsp;)</b> examines the packet and, if all of the tasks have been completed, it causes the response to be encoded into a buffer for transmission by calling the completion routine.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84000">4.11.2  &nbsp;&nbsp;<b class="keyword">GET NEXT</b> and <b class="keyword">GET BULK</b> PDU Processing</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84001"> </a>A <i class="term">VarBindList</i> is allocated and initialized to hold the response information.  Then the request <i class="term">VarBindList</i> is processed in multiple passes.  For each <i class="term">vbp</i>, the first pass locates a leaf which has an object id which is the first successor to the object id of the <i class="term">vbp</i> that is visible in the current MIB view.</p><dd><p class="Body"><a name="84002"> </a>In the next pass, the agent calls the <b class="keyword">nextproc</b> routines to perform instance-level searching and to find the object-id and value for the <i class="term">vbp</i>. Instead of returning the instance and value information, the <b class="keyword">nextproc</b> should call one of the <b class="routine"><i class="routine">getproc_got_</i></b><b>(&nbsp;)</b> routines to install the value, and <b class="routine"><i class="routine">nextproc_next_instance</i></b><b>(&nbsp;)</b> to install the instance portion of the object-id.  If no instance is found, the <b class="keyword">nextproc</b> operation should call <b class="routine"><i class="routine">nextproc_no_next</i></b><b>(&nbsp;)</b>.</p><dd><p class="Body"><a name="84003"> </a>(<i class="emphasis">Note:</i> the following only applies to asynchronous method routines; see <a href="c-extend5.html#84336"><i class="title">6.5&nbsp;Asynchronous Method Routines</i></a>.)<b class="routine"><i class="routine"> snmpdContinue</i></b><b>(&nbsp;)</b> is called when all <b class="keyword">nextproc</b> operations have been started. You should call it when any tasks complete that were begun by a <b class="keyword">nextproc</b> operation but did not finish.  When all of the tasks have completed, the SNMP agent steps through the response <i class="term">VarBindList</i> and, for any <i class="term">vbp</i> that was tagged with <b class="routine"><i class="routine">nextproc_no_next</i></b><b>(&nbsp;)</b>, step to the next object and start that object's <b class="keyword">nextproc</b> operation.</p><dd><p class="Body"><a name="84007"> </a>When all of the <i class="term">vbp</i>s have been assigned valid objects or the exception <b class="symbol_UC">VT_ENDOFMIB</b>, the target agent proceeds to the next step.  For <b class="keyword">GET NEXT</b> PDUs this means generating the correct response packet, which may require translating an exception into an error.  For <b class="keyword">GET BULK</b> PDUs, the target agent may perform several iterations on the entire <i class="term">VarBindList</i>. Each iteration performs the equivalent of a <b class="keyword">GET NEXT</b> using the previous iterations's result as its starting point.  The routine will stop when the packet is at the maximum size, the number of iterations is equal to the maximum requested in the packet or all requested variables are at the end of the MIB.  When the last iteration is finished, or an error is encountered, the agent attempts to generate the response packet by calling the completion routine.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84008">4.11.3  &nbsp;&nbsp;<b class="keyword">SET</b> PDU Processing</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84009"> </a>The processing of <b class="keyword">SET </b>request<b class="keyword"> </b>PDUs requires a number of passes through the <i class="term">VarBindList</i>. There are several hooks available during processing, through which an agent designer can alter the way the <b class="keyword">SET</b> is processed. The hooks that are provided must be defined at initialization during the invocation of <b class="routine"><i class="routine">snmpdInitFinish</i></b><b>(&nbsp;)</b>.</p></dl></dl><dl class="margin"><dd><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><a name="84018"><br></a><img border="0" alt="*" src="icons/note.gif">&nbsp;&nbsp;&nbsp;</td><td><div class="Note"><hr><b class="symbol_UC">NOTE: </b>Hooks are called at various points during the processing of a <b class="keyword">SET</b> request. For information on hooks, see <a href="c-agent8.html#83905"><i class="title">4.8&nbsp;Hooks</i></a>. Also see the manual page for the routine <b class="routine"><i class="routine">snmpdInitFinish</i></b><b>(&nbsp;)</b> in <a href="snmp.refEntries.TOC.html#83416"><i class="title">F.&nbsp;SNMP Reference</i></a>.<hr></div></td></tr></table><dl class="margin"><dd><p class="Body"><a name="84022"> </a>On the first pass, each variable's leaf is located, checked for visibility in the current MIB view, checked for writabilty, and type matched against the <b class="keyword">SET</b> request.</p><dd><p class="Body"><a name="84023"> </a>At this point, a user-defined PDU-validation hook is called to let your code perform an overall PDU validation.  This routine may return with:</p><dl class="margin"><dd><div class="Item2"><a name="84024"> </a>-1</div><dl class="margin"><dd><div class="Indent2"><a name="84025"> </a>indicates the PDU is bad and should be rejected with a <b class="symbol_UC">GEN_ERR</b> error.</div><br></dl><dd><div class="Item2"><a name="84026"> </a>0</div><dl class="margin"><dd><div class="Indent2"><a name="84027"> </a>indicates that the PDU is good and that normal handling should proceed.</div><br></dl><dd><div class="Item2"><a name="84028"> </a>1</div><dl class="margin"><dd><div class="Indent2"><a name="84029"> </a>indicates the PDU is good and this routine has already performed all the set operations. </div><br></dl></dl><dd><p class="Body"><a name="84030"> </a>On the second pass through the <i class="term">VarBindList</i>, a <b class="keyword">testproc</b> operation may be started for each variable to check for accessibility and to test whether the proposed value is acceptable. The PDU-validation hook may tag particular <i class="term">VarBindList</i> entries with a mark indicating that the associated <b class="keyword">testproc</b> operation should be bypassed. </p><dd><p class="Body"><a name="84031"> </a><b class="routine"><i class="routine">snmpdContinue</i></b><b>(&nbsp;)</b> is called when all the <b class="keyword">testproc</b> operations have been started. You should call it when any tasks complete that the <b class="keyword">testproc</b> operation started but did not finish. If no errors occurred in the test phase, a pre-<b class="keyword">set</b>-request hook (see <a href="c-agent8.html#83905"><i class="title">4.8&nbsp;Hooks</i></a>) may be called to perform activities prior to setting the requested variable. If an error occurred during the test phase, a <b class="keyword">set</b>-failure hook is called to perform activities based on the failure of a <b class="keyword">SET</b> operation.</p><dd><p class="Body"><a name="84035"> </a>After the pre-<b class="keyword">set</b>-request hook returns, another pass is made over the VarBindList and a <b class="keyword">setproc</b> operation may be started for each variable which has not otherwise been set.</p><dd><p class="Body"><a name="84036"> </a>(<i class="emphasis">Note:</i> the following only applies to asynchronous method routines; see <a href="c-extend5.html#84336"><i class="title">6.5&nbsp;Asynchronous Method Routines</i></a>.) <b class="routine"><i class="routine">snmpdContinue</i></b><b>(&nbsp;)</b> is called again when all the <b class="keyword">setproc</b> operations have been started. You should call it when any tasks complete that a <b class="keyword">setproc</b> operation started but did not finish.  When all of the tasks have completed, a post-<b class="keyword">set</b>-request hook is called to give you the means to clear any caches or to actually trigger the accumulated sets, and to perform any activities required after setting the requested variable. At this time, the values can be saved to a file in case they need to be restored the next time the agent starts up.</p><dd><p class="Body"><a name="84040"> </a>If an error occurs during a <b class="keyword">setproc</b> operation, the SNMP agent attempts to undo any sets that have already been performed.  To do so, the agent examines the variable-binding pointers and runs any routines it finds in the <i class="textVariable">undoproc</i> field.  This field should be set by the <b class="keyword">testproc</b> or <b class="keyword">setproc</b><b>(&nbsp;)</b>operation responsible for the <i class="textVariable">vbp</i>.  If you set this field during the <b class="keyword">testproc</b> routine, you are allowing it to be called before the <b class="keyword">setproc</b> operation finishes; if the <b class="keyword">setproc</b> operation can not be interrupted (or you do not want to write the code to allow that) you should set the <i class="textVariable">undoproc</i> field at the end of the <b class="keyword">SET</b> task.</p><dd><p class="Body"><a name="84041"> </a>(<i class="emphasis">Note:</i> the following only applies to asynchronous method routines.) Again, <b class="routine"><i class="routine">snmpdContinue</i></b><b>(&nbsp;)</b> is called after the <b class="keyword">undoproc</b> operations have been started and when any tasks complete that <b class="keyword">setproc</b> or <b class="keyword">undoproc</b> started but did not finish. The agent attempts to start any <b class="keyword">undoproc</b> operations that have not already been started. After all the <b class="keyword">undoproc</b> operations complete, a user-defined <b class="keyword">set</b>-failure hook is called (see <a href="c-agent8.html#83905"><i class="title">4.8&nbsp;Hooks</i></a>).</p><dd><p class="Body"><a name="84045"> </a>When all of the tasks from the <b class="keyword">setproc</b> operations and, in case of errors, the <b class="keyword">undoproc</b> operations have completed, the internal packet structure for the original request packet is modified to become the response packet. The SNMP agent then attempts to generate the response packet by calling the completion routine.</p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a></a><a href="c-agent.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-agent10.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-agent12.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 4.0.11    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -