📄 snmpiolib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/snmpIoLib.html - generated by refgen from snmpIoLib.c --> <title> snmpIoLib </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>snmpIoLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>snmpIoLib</strong> - default transport routines for SNMP </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./snmpIoLib.html#snmpIoInit">snmpIoInit</a></i>( )</b> - initialization routine for SNMP transport endpoint<br><b><i><a href="./snmpIoLib.html#snmpIoWrite">snmpIoWrite</a></i>( )</b> - write a packet to the transport<br><b><i><a href="./snmpIoLib.html#snmpIoClose">snmpIoClose</a></i>( )</b> - close the transport endpoint.<br><b><i><a href="./snmpIoLib.html#snmpIoMain">snmpIoMain</a></i>( )</b> - main SNMP I/O routine<br><b><i><a href="./snmpIoLib.html#snmpIoTrapSend">snmpIoTrapSend</a></i>( )</b> - send a standard SNMP or MIB-II trap<br><b><i><a href="./snmpIoLib.html#snmpIoCommunityValidate">snmpIoCommunityValidate</a></i>( )</b> - sample community validation routine<br><b><i><a href="./snmpIoLib.html#snmpdMemoryAlloc">snmpdMemoryAlloc</a></i>( )</b> - allocate memory for the SNMP agent<br><b><i><a href="./snmpIoLib.html#snmpdMemoryFree">snmpdMemoryFree</a></i>( )</b> - free memory allocated by the SNMP agent<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This module implements the SNMP v1/v2c transport-dependent routines.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>snmpdIoLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b><hr><a name="snmpIoInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpIoInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpIoInit</i>( )</strong> - initialization routine for SNMP transport endpoint</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS snmpIoInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This is the routine to be called to initialize the transport endpointused by the SNMP agent. This routine is invoked from <b><i><a href="./snmpIoLib.html#snmpIoMain">snmpIoMain</a></i>( )</b>.This implementation is for a socket based system. It will also call the<b><i><a href="./masterIoLib.html#masterIoInit">masterIoInit</a></i>( )</b> routine to create the IPC mechanism for the master agent.<p></blockquote><h4>GLOBALS</h4><blockquote><p>snmpSocket<p></blockquote><h4>RETURNS</h4><blockquote><p>ERROR if unable to create bound socket else OK.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b>, <b><i><a href="./snmpIoLib.html#snmpIoMain">snmpIoMain</a></i>( )</b><hr><a name="snmpIoWrite"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpIoWrite</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpIoWrite</i>( )</strong> - write a packet to the transport</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpIoWrite ( void * pSocket, /* Socket descriptor for SNMP */ char * pBuf, /* Encoded SNMP packet */ int bufSize, /* Size of the packet */ void * pRemote, /* Remote address of manager */ void * pLocal /* Local address */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine writes a datagram to the socket. The routine calls<b><i><a href="./sockLib.html#sendto">sendto</a></i>( )</b> with flags always set to 0. The <i>local</i> parameter is notused in this case, but exists for conformance with our transport-independent interface.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b>, <b><i><a href="./sockLib.html#sendto">sendto</a></i>( )</b><(VxWorks Reference Manual) ><hr><a name="snmpIoClose"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpIoClose</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpIoClose</i>( )</strong> - close the transport endpoint.</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpIoClose (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is invoked to deallocate the transport endpoint.It is invoked from the task deletion hook and also from <b><i><a href="./snmpdLib.html#snmpdExit">snmpdExit</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b><hr><a name="snmpIoMain"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpIoMain</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpIoMain</i>( )</strong> - main SNMP I/O routine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpIoMain (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is invoked by the agent after it has successsfullycompleted the preliminary initializations. In this routine, the useris required to initialize the transport endpoint and the views, andthen complete initialization of the agent by calling<b><i><a href="./snmpdLib.html#snmpdInitFinish">snmpdInitFinish</a></i>( )</b>. Any configuration required for <b><i><a href="./snmpIoLib.html#snmpIoTrapSend">snmpIoTrapSend</a></i>( )</b>must be done before calling <b><i><a href="./snmpdLib.html#snmpdInitFinish">snmpdInitFinish</a></i>( )</b> since it will beinvoked in there. Any hooks that are required by the user must bepassed to <b><i><a href="./snmpdLib.html#snmpdInitFinish">snmpdInitFinish</a></i>( )</b>. The transport endpoint must beinitialized before <b><i><a href="./snmpdLib.html#snmpdInitFinish">snmpdInitFinish</a></i>( )</b> is called; the main loop isthen invoked. Before calling <b><i>snmpIoBody</i>( )</b>, the routine which waits on the socket, it calls <b><i><a href="./masterIoLib.html#snmpMonitorSpawn">snmpMonitorSpawn</a></i>( )</b> which spawns the master-agenttask.<p></blockquote><h4>RETURNS</h4><blockquote><p>This routine should never return, except on failure.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b>, <b><i><a href="./snmpdLib.html#snmpdInitFinish">snmpdInitFinish</a></i>( )</b><hr><a name="snmpIoTrapSend"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpIoTrapSend</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpIoTrapSend</i>( )</strong> - send a standard SNMP or MIB-II trap</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpIoTrapSend ( int trapType, /* Type of the trap */ int trapSpecific /* User defined specifics */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sends a standard SNMP or MIB-II trap message to thenetwork. It is called by the SNMP agent at startup (to indicate acold start) and when interface states change. It takes twoarguments: <i>trapType</i>, the trap type, and <i>trapSpecific</i>, theuser-defined specifics on this trap.<p>The agent designer must rewrite this according to specific transport needs.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b>, <b><i><a href="./snmpdLib.html#snmpdTrapSend">snmpdTrapSend</a></i>( )</b><hr><a name="snmpIoCommunityValidate"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpIoCommunityValidate</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpIoCommunityValidate</i>( )</strong> - sample community validation routine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int snmpIoCommunityValidate ( SNMP_PKT_T * pPkt, /* ptr to snmp pkt */ SNMPADDR_T * pRemoteAddr, /* remote address */ SNMPADDR_T * pLocalAddr /* local address */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is used to set up the view-index field in the SNMPpacket. This product is shipped with defaults such that the "priv"community is allowed to <b>set</b> variables, and the "pub" community isallowed to <b>get</b> variables.<p>The agent designer is required to write this function according tothe design of the application.<p></blockquote><h4>RETURNS</h4><blockquote><p>0 if the community is acceptable, otherwise 1.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b><hr><a name="snmpdMemoryAlloc"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpdMemoryAlloc</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpdMemoryAlloc</i>( )</strong> - allocate memory for the SNMP agent</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void * snmpdMemoryAlloc ( size_t size /* size of memory to be allocated */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates memory for the SNMP agent. The required sizeof the block is passed in <i>size</i>. This memory must be deallocated later with <b><i><a href="./snmpIoLib.html#snmpdMemoryFree">snmpdMemoryFree</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>a pointer to the allocated buffer on success, otherwise NULL.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b>, <b><i><a href="./snmpIoLib.html#snmpdMemoryFree">snmpdMemoryFree</a></i>( )</b><hr><a name="snmpdMemoryFree"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>snmpdMemoryFree</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>snmpdMemoryFree</i>( )</strong> - free memory allocated by the SNMP agent</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void snmpdMemoryFree ( void * pBuf /* buffer to free */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deallocates memory which was previously allocated by theSNMP agent with <b><i><a href="./snmpIoLib.html#snmpdMemoryAlloc">snmpdMemoryAlloc</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./snmpIoLib.html#top">snmpIoLib</a></b>, <b><i><a href="./snmpIoLib.html#snmpdMemoryAlloc">snmpdMemoryAlloc</a></i>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -