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

📄 snmp.refentries.toc72.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><i class="i">snmpMasterHandlerAsync</i>(&nbsp;)     SNMP Reference   </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="snmp.refEntries.TOC.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="snmp.refEntries.TOC71.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="snmp.refEntries.TOC73.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h2 class="H1"><i><a name="89681"> <i class="i">snmpMasterHandlerAsync</i>(&nbsp;) </a></i></h2></font><h4 class="SH"><a name="89682"> </a>NAME </h4><dl class="margin"><dl class="margin"><dd><a name="89683"><div class="aX"><b class="routine"><i class="routine">snmpMasterHandlerAsync</i></b><b>(&nbsp;)</b>     -     process messages from the subagent asynchronously </div></a></dl></dl><h4 class="SH"><a name="89684"> </a>SYNOPSIS </h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="89685">void snmpMasterHandlerAsync &nbsp;&nbsp;&nbsp;&nbsp;( &nbsp;&nbsp;&nbsp;&nbsp;OCTET_T *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pMsg,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* pointer to the message&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;ALENGTH_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msgl,&nbsp;&nbsp;&nbsp;&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routine&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;PTR_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipchandle,&nbsp;&nbsp;/* ipchandle for the IPC scheme used */ &nbsp;&nbsp;&nbsp;&nbsp;PTR_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user_priv&nbsp;&nbsp; /* MIB tree identifier&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */ &nbsp;&nbsp;&nbsp;&nbsp;)</a></b></pre></dl></dl><h4 class="SH"><a name="89697"> </a>DESCRIPTION </h4><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="89698"> </a>This function provides support for an asynchronous communication scheme between the master agent and its subagents. The shipped version of WindNet SNMP does not call this function. Instead, it calls <b class="routine"><i class="routine">snmpMasterHandlerWR</i></b><b>(&nbsp;)</b>, a function that supports a synchronous communication scheme. If you want master agents and subagents to use an asynchronous communication scheme, you must rewrite <b class="routine"><i class="routine">snmpQueMonitor</i></b><b>(&nbsp;)</b> to call <b class="routine"><i class="routine">snmpMasterHandlerAsync</i></b><b>(&nbsp;)</b> instead of <b class="routine"><i class="routine">snmpMasterHandlerWR</i></b><b>(&nbsp;)</b>. In addition, because <b class="routine"><i class="routine">snmpMasterHandlerAsync</i></b><b>(&nbsp;)</b> does not return a function value, you will need to remove the <b class="routine"><i class="routine">snmpQueMonitor</i></b><b>(&nbsp;)</b> code that responded to the <b class="routine"><i class="routine">snmpMasterHandlerWR</i></b><b>(&nbsp;)</b> function value. The functionality handled by the removed code should instead be implemented in the function referenced by the <i class="i">pIpcComp</i> parameter. Use the parameters as follows: </p><dl class="margin"><dd><div class="Indent"><a name="89699"> </a><i class="i">pMsg <br></i>Expects a pointer to an <b>EBUFFER_T</b> structure containing the data part of the message from the subagent. The message shows up on the queue as an <b>SA_MESSAGE_T</b> structure. The message expected by this parameter is contained in the <b>mesg</b> member of this structure. To extract this pointer, use <b>EbufferStart</b> macro defined in defined in <b>buffer.h</b>. </div><br><dd><div class="Indent"><a name="89700"> </a><i class="i">msgl <br></i>Expects the length of the message referenced in <i class="i">pMsg</i>. To retrieve this length value, use the <b>EBufferUsed</b> macro defined in <b>buffer.h</b>. </div><br><dd><div class="Indent"><a name="89701"> </a><i class="i">pIpcComp <br></i>Expects a pointer to the completion function, which must be of the form: </div><br></dl><dl class="margin"><dd><pre class="Code2"><b><a name="89702">void masterIpcComp &nbsp;&nbsp; ( &nbsp;&nbsp; OCTET_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opcode,&nbsp;&nbsp;&nbsp;&nbsp;/* this specifies what needs to be done &nbsp;&nbsp; EBUFFER_T *&nbsp;&nbsp; ebuf,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* reply message to be sent &nbsp;&nbsp; VBL_T *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vblist,&nbsp;&nbsp;&nbsp;&nbsp;/* list of varbinds message contained &nbsp;&nbsp; PTR_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipchandle&nbsp;&nbsp;/* subagent address &nbsp;&nbsp; )</a></b></pre></dl><dl class="margin"><dd><div class="Indent"><a name="89703"> </a>The master agent executes this function upon completing processing for an unsolicited control message from a subagent (primarily registration requests, although a trap from the subagent will eventually find its way to this function). Your <b class="routine"><i class="routine">masterIcpComp</i></b><b>(&nbsp;)</b> should be able handle things such as letting the subagent know the completion status of message it sent to the master agent.</div><br><dd><div class="Indent"><a name="89704"> </a>For a registration routine, it must send the message in <i class="i">ebuf</i> back to the subagent. This message contains the group ID of the MIB variables added to the master agent's MIB tree. The subagent needs this ID to make a deregistration request.</div><br><dd><div class="Indent"><a name="89705"> </a>If you decide to support traps from subagents, this function must be able to forward the varbind list in <i class="i">vblist</i> to the SNMP manager. In addition, it is your responsibility to acquire any values not specified in <i class="i">vblist</i> and include it in the message you send the to the SNMP manager. Use the <i class="i">opcode</i> to know when you are handling the completion processing for a registration request, a deregistration request, or a trap from a subagent.</div><br><dd><div class="Indent"><a name="89706"> </a>For an example of an IPC completion routine, see <b class="routine"><i class="routine">masterIpcComp</i></b><b>(&nbsp;)</b> defined in <b>masterIoLib.c</b>. </div><br><dd><div class="Indent"><a name="89707"> </a><i class="i">pIpcSend <br></i>Expects a pointer to the function that method routines should use to send messages to the subagent. This function must be of the form: </div><br></dl><dl class="margin"><dd><pre class="Code2"><b><a name="89708">INT_32_T masterIpcSend &nbsp;&nbsp; ( &nbsp;&nbsp; EBUFFER_T *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pBuf,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* message to be sent &nbsp;&nbsp; PTR_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipchandle&nbsp;&nbsp;/* address of subagent &nbsp;&nbsp; UINT_16_T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reqid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* ID for request sent &nbsp;&nbsp; )</a></b></pre></dl><dl class="margin"><dd><div class="Indent"><a name="89709"> </a>To make the communication between the master agent and subagent asynchronous, this send routine should send the message to the subagent and return. Eventually, a response shows up on the master agent's local queue, or the query times out. How you process a query response or a query time out is almost entirely up to you.</div><br><dd><div class="Indent"><a name="89710"> </a>To process a query response, you must call <b class="routine"><i class="routine">snmpMasterQueryHandler</i></b><b>(&nbsp;)</b>. This function will handle the details of integrating the message from the subagent into a message to the SNMP manager.</div><br><dd><div class="Indent"><a name="89711"> </a>To clean up after a send that times out, you must call <b class="routine"><i class="routine">snmpMasterCleanup</i></b><b>(&nbsp;)</b>. The specifics of the mechanism you use are up to you, but you will likely need to integrate the mechanism with your <b class="routine"><i class="routine">masterIpcSend</i></b><b>(&nbsp;)</b> routine. That is because this function gets the request ID that you will need for clean up. The request ID is a number generated internally to the SNMP master agent. It passes this value into your <b class="routine"><i class="routine">masterIpcSend</i></b><b>(&nbsp;)</b> using the <i class="i">reqid</i> parameter. To clean up after a send that times out, you submit the <i class="i">reqid</i> in a call to <b class="routine"><i class="routine">snmpMasterCleanup</i></b><b>(&nbsp;)</b>.</div><br><dd><div class="Indent"><a name="89712"> </a>For an example of an <b class="routine"><i class="routine">masterIpcSend</i></b><b>(&nbsp;)</b>, see the <b class="routine"><i class="routine">masterIpcSend</i></b><b>(&nbsp;)</b> defined in <b>masterIoLib.c</b>. </div><br><dd><div class="Indent"><a name="89713"> </a><i class="i">pIpcRcv <br></i>This parameter is not used by <b class="routine"><i class="routine">snmpMasterHandlerAsync</i></b><b>(&nbsp;)</b> and so should be null. It is included to maintain parallelism with <b class="routine"><i class="routine">snmpMasterHandlerWR</i></b><b>(&nbsp;)</b>. </div><br><dd><div class="Indent"><a name="89714"> </a><i class="i">pIpcFree <br></i>Expects a pointer to a function of the form: </div><br></dl><dl class="margin"><dd><pre class="Code2"><b><a name="89715">void masterIpcFree ( PTR_T ipchandle )</a></b></pre></dl><dl class="margin"><dd><div class="Indent"><a name="89716"> </a>The master agent uses this function to free any resources it might have allocated to maintain the IPC link with the subagent. The master agent calls this function when a subagent deregisters. </div><br><dd><div class="Indent"><a name="89717"> </a><i class="i">pIpcAyt <br></i>Expects a pointer to the function the master agent can use to test the connection with the subagent. This function must be of the form: </div><br></dl><dl class="margin"><dd><pre class="Code2"><b><a name="89718">INT_32_T masterIpcAyt ( PTR_T ipchandle )</a></b></pre></dl><dl class="margin"><dd><div class="Indent"><a name="89719"> </a>For an example of such a function, see the <b class="routine"><i class="routine">masterIpcAyt</i></b><b>(&nbsp;)</b> defined in <b>masterIoLib.c</b>. </div><br><dd><div class="Indent"><a name="89720"> </a><i class="i">ipchandle <br></i>Expects a pointer to the IPC handle used to access the subagent that sent this message. In the shipped implementation, this is a pointer to a message queue. </div><br><dd><div class="Indent"><a name="89721"> </a><i class="i">user_priv <br></i>Expects a pointer to the MIB tree from which registration and deregistration requests want to add or delete objects or instances. If this pointer is NULL, the default MIB tree specified by mib_root_node is used. </div><br></dl></dl></dl><h4 class="SH"><a name="89722"> </a>RETURNS </h4><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="89723"> </a>N/A </p></dl></dl><h4 class="SH"><a name="89724"> </a>SEE ALSO </h4><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="89725"> </a><b class="library">subagentLib</b> </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="snmp.refEntries.TOC.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="snmp.refEntries.TOC71.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="snmp.refEntries.TOC73.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 + -