📄 m2iflib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/m2IfLib.html - generated by refgen from m2IfLib.c --> <title> m2IfLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>m2IfLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IfLib</strong> - MIB-II interface-group API for SNMP agents </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./m2IfLib.html#m2IfAlloc">m2IfAlloc</a>( )</b> - allocate the structure for the interface table<br><b><a href="./m2IfLib.html#m2IfFree">m2IfFree</a>( )</b> - free an interface data structure<br><b><a href="./m2IfLib.html#m2IfGenericPacketCount">m2IfGenericPacketCount</a>( )</b> - increment the interface packet counters <br><b><a href="./m2IfLib.html#m2If8023PacketCount">m2If8023PacketCount</a>( )</b> - increment the packet counters for an 802.3 device <br><b><a href="./m2IfLib.html#m2IfCounterUpdate">m2IfCounterUpdate</a>( )</b> - increment interface counters <br><b><a href="./m2IfLib.html#m2IfVariableUpdate">m2IfVariableUpdate</a>( )</b> - update the contents of an interface non-counter object <br><b><a href="./m2IfLib.html#m2IfPktCountRtnInstall">m2IfPktCountRtnInstall</a>( )</b> - install an interface packet counter routine<br><b><a href="./m2IfLib.html#m2IfCtrUpdateRtnInstall">m2IfCtrUpdateRtnInstall</a>( )</b> - install an interface counter update routine<br><b><a href="./m2IfLib.html#m2IfVarUpdateRtnInstall">m2IfVarUpdateRtnInstall</a>( )</b> - install an interface variable update routine<br><b><a href="./m2IfLib.html#m2IfInit">m2IfInit</a>( )</b> - initialize MIB-II interface-group routines<br><b><a href="./m2IfLib.html#m2IfTableUpdate">m2IfTableUpdate</a>( )</b> - insert or remove an entry in the ifTable<br><b><a href="./m2IfLib.html#rcvEtherAddrGet">rcvEtherAddrGet</a>( )</b> - populate the rcvAddr fields for the ifRcvAddressTable<br><b><a href="./m2IfLib.html#rcvEtherAddrAdd">rcvEtherAddrAdd</a>( )</b> - add a physical address into the linked list<br><b><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a>( )</b> - get a MIB-II interface-group table entry<br><b><a href="./m2IfLib.html#m2IfDefaultValsGet">m2IfDefaultValsGet</a>( )</b> - get the default values for the counters<br><b><a href="./m2IfLib.html#m2IfCommonValsGet">m2IfCommonValsGet</a>( )</b> - get the common values<br><b><a href="./m2IfLib.html#m2IfTblEntrySet">m2IfTblEntrySet</a>( )</b> - set the state of a MIB-II interface entry to UP or DOWN<br><b><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a>( )</b> - get the MIB-II interface-group scalar variables<br><b><a href="./m2IfLib.html#m2IfStackTblUpdate">m2IfStackTblUpdate</a>( )</b> - update the relationship between the sub-layers<br><b><a href="./m2IfLib.html#stackEntryIsTop">stackEntryIsTop</a>( )</b> - test if an ifStackTable interface has no layers above<br><b><a href="./m2IfLib.html#stackEntryIsBottom">stackEntryIsBottom</a>( )</b> - test if an interface has no layers beneath it<br><b><a href="./m2IfLib.html#m2IfStackEntryGet">m2IfStackEntryGet</a>( )</b> - get a MIB-II interface-group table entry<br><b><a href="./m2IfLib.html#m2IfStackEntrySet">m2IfStackEntrySet</a>( )</b> - modify the status of a relationship<br><b><a href="./m2IfLib.html#m2IfRcvAddrEntryGet">m2IfRcvAddrEntryGet</a>( )</b> - get the rcvAddress table entries for a given address<br><b><a href="./m2IfLib.html#m2IfRcvAddrEntrySet">m2IfRcvAddrEntrySet</a>( )</b> - modify the entries of the rcvAddressTable<br><b><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a>( )</b> - delete all resources used to access the interface group<br><b><a href="./m2IfLib.html#nextIndex">nextIndex</a>( )</b> - the comparison routine for the AVL tree<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides MIB-II services for the interface group. Itprovides routines to initialize the group, access the group scalarvariables, read the table interfaces and change the state of the interfaces.For a broader description of MIB-II services, see the manual entry for <b><a href="./m2Lib.html#top">m2Lib</a></b>.<p>To use this feature, include the following component:<b>INCLUDE_MIB2_IF</b><p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>This library can be initialized and deleted by calling <b><a href="./m2IfLib.html#m2IfInit">m2IfInit</a>( )</b> and<b><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a>( )</b> respectively, if only the interface group's services areneeded. If full MIB-II support is used, this group and all other groupscan be initialized and deleted by calling <b><a href="./m2Lib.html#m2Init">m2Init</a>( )</b> and <b><a href="./m2Lib.html#m2Delete">m2Delete</a>( )</b>.<p>The interface group supports the Simple Network Management Protocol (SNMP)concept of traps, as specified by RFC 1215. The traps supported by thisgroup are "link up" and "link down." This library enables an applicationto register a hook routine and an argument. This hook routine can becalled by the library when a "link up" or "link down" condition isdetected. The hook routine must have the following prototype:<pre>void TrapGenerator (int trapType, /* M2_LINK_DOWN_TRAP or M2_LINK_UP_TRAP */ int interfaceIndex, void * myPrivateArg);</pre>The trap routine and argument can be specified at initialization time asinput parameters to the routine <b><a href="./m2IfLib.html#m2IfInit">m2IfInit</a>( )</b> or to the routine <b><a href="./m2Lib.html#m2Init">m2Init</a>( )</b>.<p>The interface-group global variables can be accessed as follows:<pre>M2_INTERFACE ifVars;if (m2IfGroupInfoGet (&ifVars) == OK) /* values in ifVars are valid */</pre>An interface table entry can be retrieved as follows:<pre>M2_INTERFACETBL interfaceEntry;/* Specify zero as the index to get the first entry in the table */interfaceEntry.ifIndex = 2; /* Get interface with index 2 */if (m2IfTblEntryGet (M2_EXACT_VALUE, &interfaceEntry) == OK) /* values in interfaceEntry are valid */</pre>An interface entry operational state can be changed as follows:<pre>M2_INTERFACETBL ifEntryToSet;ifEntryToSet.ifIndex = 2; /* Select interface with index 2 */ /* MIB-II value to set the interface */ /* to the down state. */ifEntryToSet.ifAdminStatus = M2_ifAdminStatus_down;if (m2IfTblEntrySet (&ifEntryToSet) == OK) /* Interface is now in the down state */</pre></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>m2Lib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2Lib.html#top">m2Lib</a></b>, <b><a href="./m2SysLib.html#top">m2SysLib</a></b>, <b><a href="./m2IpLib.html#top">m2IpLib</a></b>, <b><a href="./m2IcmpLib.html#top">m2IcmpLib</a></b>, <b><a href="./m2UdpLib.html#top">m2UdpLib</a></b>, <b><a href="./m2TcpLib.html#top">m2TcpLib</a></b><hr><a name="m2IfAlloc"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IfAlloc( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IfAlloc( )</strong> - allocate the structure for the interface table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>M2_ID * m2IfAlloc ( ULONG ifType, /* If type of the interface */ UCHAR * pEnetAddr, /* Physical address of interface */ ULONG addrLen, /* Address length */ ULONG mtuSize, /* MTU of interface */ ULONG speed, /* Speed of the interface */ char * pName, /* Name of the device */ int unit /* Unit number of the device */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is called by the driver during initialization of the interface.The memory for the interface table is allocated here. We also set thedefault update routines in the <b>M2_ID</b> struct. These fields can later beoverloaded using the installed routines in the <b>M2_ID</b>. Once this functionreturns, it is the driver's responsibility to set the pMib2Tbl pointer inthe END object to the new <b>M2_ID</b>.<p>When this call returns, the calling routine must set the <b>END_MIB_2233</b> bit of the flags field in the END object.<p></blockquote><h4>RETURNS</h4><blockquote><p>Pointer to the <b>M2_ID</b> structure that was allocated.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b><hr><a name="m2IfFree"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IfFree( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IfFree( )</strong> - free an interface data structure</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfFree ( M2_ID * pId /* pointer to the driver's M2_ID object */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine frees the given <b>M2_ID</b>. Note if the driver is not an RFC 2233driver then the <b>M2_ID</b> is NULL and this function simply returns.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK if successful, ERROR otherwise</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b><hr><a name="m2IfGenericPacketCount"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IfGenericPacketCount( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IfGenericPacketCount( )</strong> - increment the interface packet counters </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfGenericPacketCount ( M2_ID * pId, /* The pointer to the device M2_ID object */ UINT ctrl, /* Update In or Out counters */ UCHAR * pPkt, /* The incoming/outgoing packet */ ULONG pktLen /* Length of the packet */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function updates the basic interface counters for a packet. It knows nothing of the underlying media. Thus, so only the <b>ifInOctets</b>, <b>ifHCInOctets</b>, <b>ifOutOctets</b>, <b>ifHCOutOctets</b>, and <b>ifCounterDiscontinuityTime</b> variables are incremented. The <i>ctrl</i> argument specifies whether the packet is being sent or just received (<b>M2_PACKET_IN</b> or <b>M2_PACKET_OUT</b>).<p></blockquote><h4>RETURNS</h4><blockquote><p>ERROR if the <b>M2_ID</b> is NULL, OK if the counters were updated.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b><hr><a name="m2If8023PacketCount"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2If8023PacketCount( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2If8023PacketCount( )</strong> - increment the packet counters for an 802.3 device </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2If8023PacketCount ( M2_ID * pId, /* The pointer to the device M2_ID object */ UINT ctrl, /* Update In or Out counters */ UCHAR * pPkt, /* The incoming/outgoing packet */ ULONG pktLen /* Length of the packet */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function is used to update basic interface counters for a packet. Thectrl argument specifies whether the packet is being sent or just received(<b>M2_PACKET_IN</b> or <b>M2_PACKET_OUT</b>). This function only works for 802.3devices as it understand the Ethernet packet format. The following countersare updated:<table></tr><tr valign=top><td>- <td>ifInOctets</tr><tr valign=top><td>- <td>ifInUcastPkts</tr><tr valign=top><td>- <td>ifInNUcastPkts</tr><tr valign=top><td>- <td>ifOutOctets</tr><tr valign=top><td>- <td>ifOutUcastPkts</tr><tr valign=top><td>- <td>ifOutNUcastPkts</tr><tr valign=top><td>- <td>ifInMulticastPkts</tr><tr valign=top><td>- <td>ifInBroadcastPkts</tr><tr valign=top><td>- <td>ifOutMulticastPkts</tr><tr valign=top><td>- <td>ifOutBroadcastPkts</tr><tr valign=top><td>- <td>ifHCInOctets</tr><tr valign=top><td>- <td>ifHCInUcastPkts</tr><tr valign=top><td>- <td>ifHCOutOctets</tr><tr valign=top><td>- <td>ifHCOutUcastPkts</tr><tr valign=top><td>- <td>ifHCInMulticastPkts</tr><tr valign=top><td>- <td>ifHCInBroadcastPkts</tr><tr valign=top><td>- <td>ifHCOutMulticastPkts</tr><tr valign=top><td>- <td>ifHCOutBroadcastPkts</tr><tr valign=top><td>- <td>ifCounterDiscontinuityTime</table>This function should be called right after the <b><a href="./netBufLib.html#netMblkToBufCopy">netMblkToBufCopy</a>( )</b> functionhas been completed. The first 6 bytes in the resulting buffer must contain the destination MAC address and the second 6 bytes of the buffer must contain the source MAC address.<p>The type of MAC address (i.e. broadcast, multicast, or unicast) isdetermined by the following:<table></tr><tr valign=top><td>broadcast address: <td> ff:ff:ff:ff:ff:ff</tr><tr valign=top><td>multicast address: <td> first bit is set</tr><tr valign=top><td>unicast address: <td> any other address not matching the above</table></blockquote><h4>RETURNS</h4><blockquote><p>ERROR, if the <b>M2_ID</b> is NULL, or the ctrl is invalid; OK, ifthe counters were updated.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b><hr><a name="m2IfCounterUpdate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IfCounterUpdate( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IfCounterUpdate( )</strong> - increment interface counters </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfCounterUpdate ( M2_ID * pId, /* The pointer to the device M2_ID object */ UINT ctrId, /* Counter to update */ ULONG value /* Amount to update the counter by */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function is used to directly update an interface counter. The counteris specified by <i>ctrId</i> and the amount to increment it is specified by value.If the counter would roll over then the <b>ifCounterDiscontinuityTime</b> isupdated with the current system uptime.<p></blockquote><h4>RETURNS</h4><blockquote><p>ERROR if the <b>M2_ID</b> is NULL, OK if the counter was updated.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b><hr><a name="m2IfVariableUpdate"></a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -