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

📄 subagentlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
requests want to add or delete objects or instances.  If this pointer isNULL, the default MIB tree specified by <b>mib_root_node</b> is used.<p></dl></blockquote><h4>RETURNS</h4><blockquote><p><p>&nbsp;N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./subagentLib.html#top">subagentLib</a></b><hr><a name="snmpMasterHandlerWR"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>snmpMasterHandlerWR</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>snmpMasterHandlerWR</i>(&nbsp;)</strong> - synchronous version of <b><i><a href="./subagentLib.html#snmpMasterHandlerAsync">snmpMasterHandlerAsync</a></i>(&nbsp;)</b></p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>INT_32_T snmpMasterHandlerWR    (    OCTET_T *   pMsg,      /* pointer to the message */    ALENGTH_T   msgl,      /* length of the message */    IPCSEND_T * pIpcSend,  /* send routine */    IPCRCV_T *  pIpcRcv,   /* receive routine */    IPCFREE_T * pIpcFree,  /* free routine */    IPCAYT_T *  pIpcAyt,   /* status Check Routine */    PTR_T       ipchandle, /* ipchandle for the IPC scheme used */    EBUFFER_T * pBuf,      /* buffer to place reply in */    VBL_T *     pVblist,   /* place to put varbinds */    PTR_T       user_priv  /* MIB tree identifier */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function is called to process the control messages received fromsubagents when the communication method between master and subagent issynchronous.<p>To process a registration request, this function extracts the objectsfrom the message and adds them as a group to the master agent's MIB tree.The actual get, test, and set methods for these objects reside in thesubagent.  To set up local methods for these routines,<b><i><a href="./subagentLib.html#snmpMasterHandlerAsync">snmpMasterHandlerAsync</a></i>(&nbsp;)</b> uses the function referenced in <i>pIpcSend</i> and<i>pIpcRcv</i>.<p>The methods local to the master agent use <i>pIpcSend</i> to send queries tothe subagent which locally executes the actual method routine for theobject.  The subagent then transmits the results back to the master agent'spublic queue.  When the function monitoring this queue sees the queryresponse, it transfers the message to the master agent's local queuewhere the <i>pIpcRcv</i> function is waiting for the response.<p>To process a deregistration request, this function extracts a group IDfrom the message and removes that group of objects from the master agent'sMIB tree.  It also executes the function in <i>pIpcFree</i> to free any resourcesallocated locally to maintain the IPC link with the deregistered subagent.<p>The <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> routine returns information using the outputparameters <i>pBuf</i> and <i>pVblist</i> and its function return value.  If thereturned function value indicates success, the master agent sends themessage returned in <i>pBuf</i> to the subagent that sent the registration orderegistration request.  If the returned value of this function indicatesfailure, the master agent silently drops the packet.<p>This function as has the ability to return an opcode value, although thisfunctionality is unused in the shipped version of WindNet SNMP.  In fact,if <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> were to return an opcode, the current implementationof the master agent would silently drop the packet.  The possibilityof returning an opcode is supported to make it possible for you to createsubagents that send traps.  In this case, <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> wouldreturn an opcode and a varbind list using the <i>pVblist</i> parameter.  Youcould then rewrite <b><i>snmpQueMonitor</i>(&nbsp;)</b>, the master agent function that calls<b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b>, so that it responds appropriately to the returnedopcode and forwards the contents of <i>pVblist</i> to the SNMP manager.<p>Use the <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> parameters as follows:<dl><dt><i>pMsg</i><dd>Expects a pointer to an <b>EBUFFER_T</b> structure containing the data part ofthe message from the subagent.  The message shows up on the queue asan <b>SA_MESSAGE_T</b> structure.  The message expected by this parameter iscontained in the <b>mesg</b> member of the <b>SA_MESSAGE_T</b> structure.  To extractthis pointer, you can use the <b>EbufferStart</b> macro defined in definedin <b>buffer.h</b>.<p><dt><i>msgl</i><dd>Expects the length of the message referenced in <i>pMsg</i>.  To retrieve thislength value, use the <b>EBufferUsed</b> macro defined in <b>buffer.h</b>.<p><dt><i>pIpcSend</i><dd>Expects a pointer to the function that method routines should use to sendmessages to the subagent.  This function must be of the form:<pre>INT_32_T masterIpcSend   (   EBUFFER_T *        pBuf,      /* message to be sent */   PTR_T              ipchandle  /* address of subagent */   )</pre>If <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> is processing a registration request from thesubagent, it associates this function pointer with the group of objectsit adds to the master agent's MIB tree.  The methods for those objectscall this routine to send a message to the subagent to make a test, get,or set query against those variables. After using this function to sendthe message, the master agent then calls the function referenced in <i>pIpcRcv</i>.The <i>pIpcRcv</i> function waits on a local queue for a response from thesubagent.  For an example of an <b><i><a href="./masterIoLib.html#masterIpcSend">masterIpcSend</a></i>(&nbsp;)</b> routine, see the<b><i><a href="./masterIoLib.html#masterIpcSend">masterIpcSend</a></i>(&nbsp;)</b> defined in <b>masterIoLib.c</b>.<p><dt><i>ipcRcv</i><dd>Expects a pointer to a function of the form:<pre>INT_32_T masterIpcRcv   (      EBUFFER_T *        pBuf,        /* buffer to receive message */      PTR_T              ipchandle    /* address of subagent */   )</pre>If <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> is processing a registration request from thesubagent, it associates this function pointer with the group of objectsit adds to the master agent's MIB tree.  The methods for those objectscall this routine to wait on a local queue for a response from the subagent.For an example of an <b><i><a href="./masterIoLib.html#masterIpcRcv">masterIpcRcv</a></i>(&nbsp;)</b>, see the <b><i><a href="./masterIoLib.html#masterIpcRcv">masterIpcRcv</a></i>(&nbsp;)</b> defined in<b>masterIoLib.c</b>.<p><dt><i>ipcFree</i><dd>Expects a pointer to a function of the form:<pre>void masterIpcFree ( PTR_T ipchandle )</pre>The master agent uses this function to free any resources it allocated tomaintain the IPC link with the subagent.  The master agent calls thisfunction when a subagent deregisters.<p><dt><i>pIpcAyt</i><dd>Expects a pointer to the function the master agent can use to test theconnection with the subagent.  This function must be of the form:<pre>INT_32_T masterIpcAyt ( PTR_T ipchandle )</pre>For an example of such a function, see the <b><i><a href="./masterIoLib.html#masterIpcAyt">masterIpcAyt</a></i>(&nbsp;)</b> definedin <b>masterIoLib.c</b>.<p><dt><i>ipchandle</i><dd>Expects a pointer to the IPC handle used to access the subagent thatsent this message.  In the shipped implementation, this is a pointerto a message queue.<p><dt><i>pBuf</i><dd>Expects a pointer to a previously allocated <b>EBUFFER_T</b>.  This is an outputparameter that <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> uses this to return a reply packet, ifone is generated.  For example, if <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> successfullyprocesses a registration request, it writes a message to the <b>EBUFFER_T</b>at <i>pBuf</i>.  This message contains the group ID for the objects just addedto the master agent's MIB tree.  When control returns from<b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b>, you must transmit this message back to thesubagent, which will store the group ID for use in a deregistrationrequest.  In the current implementation, <b><i>snmpQueMonitor</i>(&nbsp;)</b> alreadyhandles this for you.<p><dt><i>pVblist</i><dd>Expects a pointer to a previously allocated <b>VBL_T</b>.  The intended use ofthis parameter is to provide an output vehicle for the varbind listreceived in a trap message from a subagent.  Because of theapplication-dependent nature of traps, the shipped implementationof <b><i>snmpQueMonitor</i>(&nbsp;)</b> just drops the packet.  However, if you want tosupport traps from your subagents, you can modify <b><i>snmpQueMonitor</i>(&nbsp;)</b> tocheck the returned value of <b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b> to watch for atrap message.  You can then use <b><i><a href="./snmpIoLib.html#snmpIoTrapSend">snmpIoTrapSend</a></i>(&nbsp;)</b> to forward thetrap message in <i>pVblist</i> to the SNMP manager.<p><dt><i>user_priv</i><dd> Expects a pointer to the MIB tree from which registration and deregistrationrequests want to add or delete objects or instances.  If this pointer isNULL, the default MIB tree specified by <b>mib_root_node</b> is used. </dl><p>If the message is trap request, it is the responsibility of the usercode to acquire any values not specified in the trap message and to send thetrap to the manager.<p></blockquote><h4>RETURNS</h4><blockquote><p>The opcode from the decoded packet or 0 or -1.An returned value of 0 indicates an error for which you should justdrop the packet.  A return value of -1 indicates success.<p>If this function returns an opcode, a value from 1 to127, the shipped implementation just drops the packet.  However, tosupport traps from the subagent, you could modify <b><i>snmpQueMonitor</i>(&nbsp;)</b> tonote a returned value of <b>SA_TRAP_REQUEST</b> and then forward the varbindlist in <i>pVblist</i> to the SNMP manager.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./subagentLib.html#top">subagentLib</a></b><hr><a name="snmpMasterQueryHandler"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>snmpMasterQueryHandler</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>snmpMasterQueryHandler</i>(&nbsp;)</strong> - handles replies from the subagent</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>UINT_16_T snmpMasterQueryHandler    (    OCTET_T * pMsg, /* pointer to the packet */    ALENGTH_T msgl, /* length of packet */    int       flag  /* should be 1 */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is for use with <b><i><a href="./subagentLib.html#snmpMasterHandlerAsync">snmpMasterHandlerAsync</a></i>(&nbsp;)</b>. It handles the repliesto queries generated by the method routines. It decodes the message and triesto integrate the response with an outstanding packet. The <i>pMsg</i> and <i>msgl</i>parameters are pointers to the message and the length respectively. The<i>flag</i> parameter specifies whether the continuation routines should be run.This should always be set to 1.<p></blockquote><h4>RETURNS</h4><blockquote><p>The request ID if routine could decode the packet or 0 in case of error.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./subagentLib.html#top">subagentLib</a></b><hr><a name="snmpMasterCleanup"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>snmpMasterCleanup</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>snmpMasterCleanup</i>(&nbsp;)</strong> - free up resources after a query times out</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpMasterCleanup    (    UINT_16_T reqid,  /* request Id to track state block */    UINT_16_T options /* as mentioned above */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>If you use <b><i><a href="./subagentLib.html#snmpMasterHandlerAsync">snmpMasterHandlerAsync</a></i>(&nbsp;)</b>, the master agent calls this routineif the IPC layer determines that atimeout period for a query response has been exceeded. The <i>reqid</i> parameteris the same as the <i>requestId</i> value passed to the send routine.  It is usedto track the correct state block.  The <i>options</i> parameter passes in a setof flags that control what actions the cleanup routine.  Currently, thereare three flags: <b>SA_CLEANUP_INACTIVE</b>, <b>SA_CLEANUP_TIMEOUT</b>, and<b>SA_CLEANUP_CONTINUE</b>. The continue and timeout flags should always be set.The inactive flag indicates that any objects associated with the subagentshould be removed. Set this flag when the IPC layer determines that thesubagent has stopped rather than timed out.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./subagentLib.html#top">subagentLib</a></b></body></html>

⌨️ 快捷键说明

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