📄 c-extend2.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Extending 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-extend.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-extend1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-extend3.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="83442">6.2 Application Programmer Interface Libraries</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83443"> </a>API libraries are outlined here in order to show the routines available to the SNMP agent designer. For more information on the syntax of these routines and application programmer interfaces, see <a href="snmp.refEntries.TOC.html#83416"><i class="title">F. SNMP Reference</i></a>. </p><dd><p class="Body"><a name="83444"> </a>Also see the manual entry for m2Lib in the <i class="title">VxWorks Reference Manual</i>.</p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="83445"><b class="library">snmpdLib</b> - entry points to the SNMP v1/v2c agent</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="83446"> </a>The routines in this file provide the general processing interface to the user code in the files <b class="file">snmpIoLib.c</b>, as well as routine-calls to user-defined hooks (which can be in any file, but must be linked in with the agent at build-time; see <a href="c-agent8.html#83905"><i class="title">4.8 Hooks</i></a>). The routines available to the user are:<p class="table"><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84534"> </a><b class="routine"><i class="routine">snmpdPktProcess</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84536"> </a>process a packet returned by the transport</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84538"> </a><b class="routine"><i class="routine">snmpdLog</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84540"> </a>log messgaes from the SNMP agent</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84542"> </a><b class="routine"><i class="routine">snmpdViewEntrySet</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84544"> </a>install an entry in the view table</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84546"> </a><b class="routine"><i class="routine">snmpdViewEntryRemove</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84548"> </a>remove an entry from the view table</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84550"> </a><b class="routine"><i class="routine">snmpdTreeAdd</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84552"> </a>dynamically add a subtree to the SNMP agent MIB tree</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84554"> </a><b class="routine"><i class="routine">snmpdTreeRemove</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84556"> </a>dynamically remove part of the SNMP agent MIB tree</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84558"> </a><b class="routine"><i class="routine">snmpdTrapSend</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84560"> </a>general interface to trap facilities</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84562"> </a><b class="routine"><i class="routine">snmpdInitFinish</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84564"> </a>complete the initialization of the agent</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84566"> </a><b class="routine"><i class="routine">snmpdExit</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84568"> </a>exit the SNMP agent</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84570"> </a><b class="routine"><i class="routine">snmpdContinue</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84572"> </a>continue processing of an SNMP packet</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=2 rowspan=1><div class="CellBody"><a name="84574"> </a><b class="routine"><i class="routine">snmpdGroupByGetprocAndInstance</i></b><b>( )</b></div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84578"> </a></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84580"> </a>gather set of similar variable bindings</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84582"> </a><b class="routine"><i class="routine">snmpdVbRowExtract</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84584"> </a>extract required pieces of a row for a <b class="keyword">SET</b> operation</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84586"> </a><b class="routine"><i class="routine">snmpdVbExtractRowLoose</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84588"> </a>incrementally extract pieces of a row for a set</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84590"> </a><b class="routine"><i class="routine">snmpdPktLockGet</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84592"> </a>lock an SNMP packet</div></td><td width="10"> </td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="83464"><b class="library">snmpEbufLib</b> - extended-buffer manipulation functions</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="83465"> </a>The routines in this file allow for SNMP buffer manipulation between <b class="keyword">TEST</b> and <b class="keyword">SET</b> method routines. Examine the method-routine sample code (see <a href="c-agent2.html#83635"><i class="title">4.2.2 $WIND_BASE/target/src/snmpv1/agent/</i></a>) for examples of the usage of these routines.<p class="table"><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85975"> </a><b class="routine"><i class="routine">EBufferClone</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85977"> </a>make a copy of an extended buffer</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85979"> </a><b class="routine"><i class="routine">EBufferClean</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85981"> </a>release dynamic memory in an extended buffer</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85983"> </a><b class="routine"><i class="routine">EBufferInitialize</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85985"> </a>place an extended buffer in a known state</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85987"> </a><b class="routine"><i class="routine">EBufferSetup</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85989"> </a>attach an empty memory buffer to an extended buffer</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85991"> </a><b class="routine"><i class="routine">EBufferPreLoad</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85993"> </a>attach a full memory buffer to an extended buffer</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85995"> </a><b class="routine"><i class="routine">EBufferNext</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85997"> </a>return a pointer to the next unused byte of the buffer memory</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85999"> </a><b class="routine"><i class="routine">EBufferStart</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="86001"> </a>return a pointer to the first byte in the buffer memory</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86003"> </a><b class="routine"><i class="routine">EBufferUsed</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="86005"> </a>return the number of used bytes in the buffer memory</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86007"> </a><b class="routine"><i class="routine">EBufferReset</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="86009"> </a>reset the extended buffer</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86011"> </a><b class="routine"><i class="routine">EBufferRemaining</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="86013"> </a>return the number of unused bytes remaining in buffer memory</div></td><td width="10"> </td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="83479"><b class="library">snmpBindLib</b> - routines for binding values to variables in SNMP packets</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="83480"> </a>The routines in this file are used when a trap is generated from the SNMP agent and variable information needs to be shipped to the Network Manager. This is accomplished by<i class="emphasis">binding</i> the variables together with their values. For information on variable bindings, see <a href="c-agent10.html#83927"><i class="title">4.10 Access to MIB Variables</i></a><b>( )</b></p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="83491"><b class="library">snmpProcLib</b> - manipulate variable-bindings in an SNMP packet</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="83492"> </a>The routines in this file can be invoked from the method routines to add or associate a value of a given type with a variable binding. The variable binding is used in the SNMP response packet, which is sent to the Network Management Station which originally issued the request.<p class="table"><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84679"> </a><b class="routine"><i class="routine">getproc_started</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84681"> </a>indicate that a <b class="keyword">getproc</b> operation has begun</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84683"> </a><b class="routine"><i class="routine">getproc_good</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84685"> </a>indicate successful completion of a <b class="keyword">getproc</b> procedure</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84687"> </a><b class="routine"><i class="routine">getproc_error</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84689"> </a>indicate that a <b class="keyword">getproc</b> operation encountered an error</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84691"> </a><b class="routine"><i class="routine">nextproc_started</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84693"> </a>indicate that a <b class="keyword">nextproc</b> operation has begun</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84695"> </a><b class="routine"><i class="routine">nextproc_good</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84697"> </a>indicate successful completion of a <b class="keyword">nextproc</b> procedure</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84699"> </a><b class="routine"><i class="routine">nextproc_no_next</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84701"> </a>indicate that there exists no next instance</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84703"> </a><b class="routine"><i class="routine">nextproc_error</i></b><b>( )</b></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -