📄 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.html"><i>VxWorks Reference Manual : 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><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b> - initialize MIB-II interface-group routines<br><b><i><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a></i>( )</b> - get the MIB-II interface-group scalar variables<br><b><i><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a></i>( )</b> - get a MIB-II interface-group table entry<br><b><i><a href="./m2IfLib.html#m2IfTblEntrySet">m2IfTblEntrySet</a></i>( )</b> - set the state of a MIB-II interface entry to UP or DOWN<br><b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>( )</b> - delete all resources used to access the interface group<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 m2Lib.<p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>This library can be initialized and deleted by calling <b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b> and<b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>( )</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><i><a href="./m2Lib.html#m2Init">m2Init</a></i>( )</b> and <b><i><a href="./m2Lib.html#m2Delete">m2Delete</a></i>( )</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><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b> or to the routine <b><i><a href="./m2Lib.html#m2Init">m2Init</a></i>( )</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="./m2IfLib.html#top">m2IfLib</a></b>, <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="m2IfInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m2IfInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m2IfInit</i>( )</strong> - initialize MIB-II interface-group routines</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfInit ( FUNCPTR pTrapRtn, /* pointer to user trap generator */ void * pTrapArg /* pointer to user trap generator argument */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates the resources needed to allow access to the MIB-II interface-group variables. This routine must be called before any interface variables can be accessed. The input parameter <i>pTrapRtn</i> is anoptional pointer to a user-supplied SNMP trap generator. The input parameter<i>pTrapArg</i> is an optional argument to the trap generator. Only one trapgenerator is supported.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>S_m2Lib_CANT_CREATE_IF_SEM<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b>, <b><i><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntrySet">m2IfTblEntrySet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>( )</b><hr><a name="m2IfGroupInfoGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m2IfGroupInfoGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m2IfGroupInfoGet</i>( )</strong> - get the MIB-II interface-group scalar variables</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfGroupInfoGet ( M2_INTERFACE * pIfInfo /* pointer to interface group structure */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine fills out the interface-group structure at <i>pIfInfo</i> withthe values of MIB-II interface-group global variables.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if <i>pIfInfo</i> is not a valid pointer.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>S_m2Lib_INVALID_PARAMETER<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b>, <b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntrySet">m2IfTblEntrySet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>( )</b><hr><a name="m2IfTblEntryGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m2IfTblEntryGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m2IfTblEntryGet</i>( )</strong> - get a MIB-II interface-group table entry</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfTblEntryGet ( int search, /* M2_EXACT_VALUE or M2_NEXT_VALUE */ M2_INTERFACETBL * pIfReqEntry /* pointer to requested interface entry */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine maps the MIB-II interface index to the system's internalinterface index. The <i>search</i> parameter is set to either<b>M2_EXACT_VALUE</b> or <b>M2_NEXT_VALUE</b>; for a discussion of its use, seethe manual entry for m2Lib. If the status of the interface has changedsince it was last read, the user trap routine is called.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the input parameter is not specified, or a match is not found.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> S_m2Lib_INVALID_PARAMETER<br> S_m2Lib_ENTRY_NOT_FOUND<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b>, <b><a href="./m2Lib.html#top">m2Lib</a></b>, <b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntrySet">m2IfTblEntrySet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>( )</b><hr><a name="m2IfTblEntrySet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m2IfTblEntrySet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m2IfTblEntrySet</i>( )</strong> - set the state of a MIB-II interface entry to UP or DOWN</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfTblEntrySet ( M2_INTERFACETBL * pIfTblEntry /* pointer to requested entry to change */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine selects the interface specified in the input parameter<i>pIfTblEntry</i> and sets the interface to the requested state. It isthe responsibility of the calling routine to set the interfaceindex, and to make sure that the state specified in the<b>ifAdminStatus</b> field of the structure at <i>pIfTblEntry</i> is a validMIB-II state, up(1) or down(2).<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the input parameter is not specified, an interfaceis no longer valid, the interface index is incorrect, or the <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>( )</b> commandto the interface fails.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> S_m2Lib_INVALID_PARAMETER<br> S_m2Lib_ENTRY_NOT_FOUND<br> S_m2Lib_IF_CNFG_CHANGED<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b>, <b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>( )</b><hr><a name="m2IfDelete"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m2IfDelete</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m2IfDelete</i>( )</strong> - delete all resources used to access the interface group</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IfDelete (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine frees all the resources allocated at the time the group wasinitialized. The interface group should not be accessed after this routine has been called.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IfLib.html#top">m2IfLib</a></b>, <b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a></i>( )</b>, <b><i><a href="./m2IfLib.html#m2IfTblEntrySet">m2IfTblEntrySet</a></i>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -