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

📄 subagentlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/subagentLib.html - generated by refgen from subagentLib.c --> <title> subagentLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>subagentLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>subagentLib</strong> - encode, decode, and process agent and subagent messages </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./subagentLib.html#snmpSubEncode">snmpSubEncode</a></i>(&nbsp;)</b>  -  encode a packet for transmission to master agent or subagent<br><b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>  -  asynchronous message processing routine for the subagent<br><b><i><a href="./subagentLib.html#snmpSaHandlerWR">snmpSaHandlerWR</a></i>(&nbsp;)</b>  -  provide <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b> functionality synchronously<br><b><i><a href="./subagentLib.html#snmpSaHandlerContinue">snmpSaHandlerContinue</a></i>(&nbsp;)</b>  -  subagent continuation function<br><b><i><a href="./subagentLib.html#snmpSaHandlerFinish">snmpSaHandlerFinish</a></i>(&nbsp;)</b>  -  encode packet for subagent IO completion<br><b><i><a href="./subagentLib.html#snmpSaHandlerCleanup">snmpSaHandlerCleanup</a></i>(&nbsp;)</b>  -  cleanup routine for subagent<br><b><i><a href="./subagentLib.html#snmpMasterHandlerAsync">snmpMasterHandlerAsync</a></i>(&nbsp;)</b>  -  process messages from the subagent asynchronously<br><b><i><a href="./subagentLib.html#snmpMasterHandlerWR">snmpMasterHandlerWR</a></i>(&nbsp;)</b>  -  synchronous version of <b><i><a href="./subagentLib.html#snmpMasterHandlerAsync">snmpMasterHandlerAsync</a></i>(&nbsp;)</b><br><b><i><a href="./subagentLib.html#snmpMasterQueryHandler">snmpMasterQueryHandler</a></i>(&nbsp;)</b>  -  handles replies from the subagent<br><b><i><a href="./subagentLib.html#snmpMasterCleanup">snmpMasterCleanup</a></i>(&nbsp;)</b>  -  free up resources after a query times out<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This module provides the core routines for processing the messages passedbetween the SNMP master agent and its subagents.  Thus, this library includesroutines for encoding and decoding a package.  It also includes the routinesused to sort the messages according to type and then respond to each specificmessage appropriately.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./subagentLib.html#top">subagentLib</a></b><hr><a name="snmpSubEncode"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>snmpSubEncode</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>snmpSubEncode</i>(&nbsp;)</strong> - encode a packet for transmission to master agent or subagent</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>INT_32_T snmpSubEncode    (    VBL_T *       pVblist,  /* varbindlist to be encoded */    SA_HEADER_T * pHdr,     /* header block structure */    SA_DEMUX_T *  pDemuxer, /* demuxer structure */    EBUFFER_T *   pBuf      /* buffer to place result in */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine encodes a memory-resident varbind list. The result is a buffercontaining a message ready for transmission.  Most of the arguments arevalues to be encoded into the buffer.<p><dl><dt><i>pVblist</i><dd>Expects a pointer to a <b>VBL_T</b> structure containing the list of the varbindsto be encoded in the message.  In a control message, the varbinds identifythe nodes or instances to be added or removed from the master agents MIBtree. In a query message, the varbinds identify the variables to be gottenor set.  In a trap message sent from a subagent to its master agent, thevarbinds specify the objects to be sent in a trap message to the SNMPmanager.  A trap message from a subagent follows the SNMPv2 trap style.Thus, the first object in the list must always be <b>sysUpTime</b>.  The secondobject must be a <b>snmpTrapOID.0</b> whose value is the administratively assignedname of the notification.<p><dt><i>pHdr</i><dd>Expects a pointer to a <b>SA_HEADER_T</b> structure containing all the items thatgo into the message header.<p><dt><i>pDemuxer</i><dd>Expects a pointer to an <b>SA_DEMUX_T</b> structure containing all the informationthe subagent might need to demux the packet.  That is, to determine thetime and space contexts for this request.  In a v1 request, the string partof the demuxer is the community string and the object ID is unused. In a v2request, the string is the local entity string from the context and theObject ID is the local time ID from the context.<p><dt><i>pBuf</i><dd> Expects a pointer to an <b>EBUFFER_T</b> structure into which <b><i><a href="./subagentLib.html#snmpSubEncode">snmpSubEncode</a></i>(&nbsp;)</b> canwrite the encoded packet.  If <i>pBuf</i> references a previously allocated<b>EBUFFER_T</b> structure, <b><i><a href="./subagentLib.html#snmpSubEncode">snmpSubEncode</a></i>(&nbsp;)</b> uses that space.  Otherwise,<b><i><a href="./subagentLib.html#snmpSubEncode">snmpSubEncode</a></i>(&nbsp;)</b> tries to the necessary space.<p></dl></blockquote><h4>RETURNS</h4><blockquote><p><p>&nbsp;0,&nbsp;if&nbsp;successful&nbsp;(that&nbsp;is,&nbsp;the&nbsp;structure&nbsp;at&nbsp;pBuf&nbsp;is&nbsp;ready&nbsp;for&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmission);&nbsp;1,&nbsp;if&nbsp;there&nbsp;is&nbsp;an&nbsp;illegal&nbsp;or&nbsp;unknown&nbsp;argument;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2,&nbsp;if&nbsp;there&nbsp;is&nbsp;insufficient&nbsp;buffer&nbsp;space&nbsp;at&nbsp;pBuf&nbsp;or&nbsp;space<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cannot&nbsp;be&nbsp;allocated.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./subagentLib.html#top">subagentLib</a></b><hr><a name="snmpSaHandlerAsync"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>snmpSaHandlerAsync</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>snmpSaHandlerAsync</i>(&nbsp;)</strong> - asynchronous message processing routine for the subagent</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpSaHandlerAsync    (    OCTET_T *           pMsg,      /* message from the master-agent */    ALENGTH_T           msglength, /* length of message in octets */    PTR_T               root,      /* root of mib tree */    SA_IO_COMPLETE_T *  pIoComp,   /* IO completion routine */    SA_ERR_COMPLETE_T * pErrComp,  /* error completion routine */    SA_REG_COMPLETE_T * pRegComp,  /* registration complete routine */    PTR_T               cookie     /* cookie */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>It decodes the message in <i>pMsg</i> and responds appropriately, which caninclude testing, getting, and setting variables.  After the message isprocessed, <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b> then calls whichever completion routineis appropriate.<p><dl><dt><i>pMsg</i><dd>Expects pointer to an octet string containing the message fromthe master agent.<p><dt><i>msglength</i><dd>Expects the length of the message.<p><dt><i>root</i><dd>Expects a pointer to the root of the subagent's MIB tree.If <i>root</i> is NULL, the default <b>mib_root_node</b> is used.<p><dt><i>pIoComp</i><dd>Expects a pointer to the function <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b> should call afterit has processed the message from the master agent.  This routine shouldbe able to send a response to the master agent, if necessary.  This functionmust handle the building, encoding, transmission of the response to themaster agent. This function must be of the form:<pre>void SA_IO_COMPLETE_T(PTR_T pktp, SA_HEADER_T *hdr_blk, PTR_T cookie)</pre>When the subagent calls this routine, it uses the <i>pktp</i> parameter topass in a pointer to the data to be sent to the master agent.  It usesthe <i>hdr_blk</i> parameter to pass in a pointer to the header to be includedwith the packet.  It uses the <i>cookie</i> parameter to pass in the <i>cookie</i>specified in the call to <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>.  You can use this <i>cookie</i>to carry information specific to your environment and application.<p><dt><i>pErrComp</i><dd>Expects a pointer to the function <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b> should call ifit cannot generate an appropriate response to a message from the masteragent.  This function must be of the form:<pre>void SA_ERR_COMPLETE_T(int error_code, PTR_T cookie)</pre>The <i>error_code</i> passes in one of the following error codes:<pre> SA_GEN_ERROR SA_UNKNOWN_VERSION SA_UNKNOWN_OPCODE1 SA_UNKNOWN_OPCODE2 SA_UNKNOWN_ENCODING SA_DECODE_FAILURE SA_ENCODE_FAILURE SA_UNKNOWN_NODE SA_UNKNOWN_TAG SA_UNKNOWN_GRP SA_SHORT_MSG SA_IPC_ERROR SA_LOCK_ERROR SA_NODE_ERROR SA_MEMORY_ERROR SA_UNSUPPORTED_TYPE SA_NO_SAVED_PACKET</pre>The <i>cookie</i> parameter passes in the <i>cookie</i> specified in the callto <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>.  You can use this <i>cookie</i> to carry informationspecific to your environment and application.<p><dt><i>pRegComp</i><dd>Expects a pointer to the function <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b> should call inresponse to a registration completion message from the master agent.If successful, this message should contain a group ID for the MIB variablesthat the registration request added to the master agent's MIB tree.The subagent needs this ID when it comes time to deregister and removethose variables from the master agent's MIB tree.This function must be of the form:<pre>void SA_REG_COMPLETE_T ( INT_32_T ecode, SA_HEADER_T *hdr_blk,                         VBL_T *vblp, PTR_T cookie )</pre>This completion routine expects an error codein <i>ecode</i>, a header block in <i>hdr_blk</i>, a list of nodes at <i>vblp</i>,and the <i>cookie</i> passed into the <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>.<p><dt><i>cookie</i><dd> Expects a pointer that you can use to pass data unchanged to the functionsyou specified in the <i>pIoComp</i>, <i>pErrComp</i>, and <i>pRegComp</i> functions.<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="snmpSaHandlerWR"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>snmpSaHandlerWR</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>snmpSaHandlerWR</i>(&nbsp;)</strong> - provide <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b> functionality synchronously</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>INT_32_T snmpSaHandlerWR    (    OCTET_T *     pMsg,    /* message from the master-agent */    ALENGTH_T     msgl,    /* kength of message in octets */    EBUFFER_T *   pBuf,    /* buffer to hold reply packet */    SA_HEADER_T * pHdr,    /* place for header structure */    VBL_T *       pVblist, /* place for vblist */    PTR_T         root     /* root of mib tree */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine puts a synchronous shell around <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>.  Like<b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>, this function can decode a message from the masteragent.  If the message is a query against a variable in the subagent'sMIB tree, <b><i><a href="./subagentLib.html#snmpSaHandlerWR">snmpSaHandlerWR</a></i>(&nbsp;)</b> processes the request and generates a response.However, <b><i><a href="./subagentLib.html#snmpSaHandlerWR">snmpSaHandlerWR</a></i>(&nbsp;)</b> does not handle the completion processing forthe message that would have been handled by the <i>pIoComp</i>, <i>pErrComp</i>,and <i>pRegComp</i> routines specified as input to <b><i><a href="./subagentLib.html#snmpSaHandlerAsync">snmpSaHandlerAsync</a></i>(&nbsp;)</b>.<p>Instead, it uses its returned function value to indicate that status ofthe message processing and uses <i>pBuf</i>, <i>pHdr</i>, and <i>pVblist</i> as outputparameters if that status requires additional processing on your part.For example, if the message was a successfully processed query, the responsedata is included in <i>pVblist</i> and a header is included in <i>pHdr</i>, but thatresponse is not yet encoded in a packet or transmitted back to the masteragent.  In <b><i>snmpSaHandlerAsyn</i>(&nbsp;)</b>, all that would normally be handledin the <i>pIoComp</i> routine.  Effectively, you must now call your <i>pIoComp</i>routine explicitly.<dl><dt><i>pMsg</i><dd>Expects a pointer to the message, an octet string, from the master agent.<p>

⌨️ 快捷键说明

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