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

📄 m2lib.html

📁 vxworks相关论文
💻 HTML
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/m2Lib.html - generated by refgen from m2Lib.c --> <title> m2Lib </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>m2Lib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>m2Lib</strong> - MIB-II API library for SNMP agents </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./m2Lib.html#m2Init">m2Init</a></i>(&nbsp;)</b>  -  initialize the SNMP MIB-2 library <br><b><i><a href="./m2Lib.html#m2Delete">m2Delete</a></i>(&nbsp;)</b>  -  delete all the MIB-II library groups<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides Management Information Base (MIB-II, defined inRFC 1213) services for applications wishing to have access to MIBparameters.<p>There are no specific provisions for MIB-I: all servicesare provided at the MIB-II level.  Applications that use this libraryfor MIB-I must hide the MIB-II extensions from higher level protocols.The library accesses all the MIB-II parameters, and presents them tothe application in data structures based on the MIB-II specifications.<p>The routines provided by the VxWorks MIB-II library are separatedinto groups that follow the MIB-II definition.  Each supported grouphas its own interface library:<dl><dt><b><a href="./m2SysLib.html#top">m2SysLib</a></b><dd>systems group<p><dt><b><a href="./m2IfLib.html#top">m2IfLib</a></b><dd>interface group<p><dt><b><a href="./m2IpLib.html#top">m2IpLib</a></b><dd>IP group (includes AT)<p><dt><b><a href="./m2IcmpLib.html#top">m2IcmpLib</a></b><dd>ICMP group <p><dt><b><a href="./m2TcpLib.html#top">m2TcpLib</a></b><dd>TCP group <p><dt><b><a href="./m2UdpLib.html#top">m2UdpLib</a></b><dd>UDP group  </dl><p>MIB-II retains the AT group for backward compatibility, butincludes its functionality in the IP group.  The EGP and SNMP groupsare not supported by this interface.  The variables in each group havebeen subdivided into two types: table entries and scalar variables.Each type has a pair of routines that get and set the variables.<p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>There are four types of operations on each group:<p>&nbsp;&nbsp;-&nbsp;initializing&nbsp;the&nbsp;group<br>&nbsp;&nbsp;-&nbsp;getting&nbsp;variables&nbsp;and&nbsp;table&nbsp;entries<br>&nbsp;&nbsp;-&nbsp;setting&nbsp;variables&nbsp;and&nbsp;table&nbsp;entries<br>&nbsp;&nbsp;-&nbsp;deleting&nbsp;the&nbsp;group<p>Only the groups that are to be used need be initialized.  There is oneexception: to use the IP group, the interface group must also beinitialized.  Applications that require MIB-II support from all groups caninitialize all groups at once by calling the <b><i><a href="./m2Lib.html#m2Init">m2Init</a></i>(&nbsp;)</b>.  All MIB-II groupservices can be disabled by calling <b><i><a href="./m2Lib.html#m2Delete">m2Delete</a></i>(&nbsp;)</b>.  Applications that needaccess only to a particular set of groups need only call theinitialization routines of the desired groups.<p>To read the scalar variables for each group, call one of the followingroutines:<p>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2SysLib.html#m2SysGroupInfoGet">m2SysGroupInfoGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IfLib.html#m2IfGroupInfoGet">m2IfGroupInfoGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IpLib.html#m2IpGroupInfoGet">m2IpGroupInfoGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IcmpLib.html#m2IcmpGroupInfoGet">m2IcmpGroupInfoGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2UdpLib.html#m2UdpGroupInfoGet">m2UdpGroupInfoGet</a></i>(&nbsp;)</b><p>The input parameter to the routine is always a pointer to a structurespecific to the associated group.  The scalar group structures followthe naming convention "M2_<i>groupname</i>".  The get routines fill in theinput structure with the values of all the group variables.<p>The scalar variables can also be set to a user supplied value. Not allgroups permit setting variables, as specified by the MIB-II definition.  The following group routines allow setting variables:<p>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2SysLib.html#m2SysGroupInfoSet">m2SysGroupInfoSet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IpLib.html#m2IpGroupInfoSet">m2IpGroupInfoSet</a></i>(&nbsp;)</b><p>The input parameters to the variable-set routines are a bit fieldthat specifies which variables to set, and a group structure.  Thestructure is the same structure type used in the get operation.Applications need set only the structure fields corresponding to thebits that are set in the bit field.<p>The MIB-II table routines read one entry at a time.  Each MIB-II groupthat has tables has a get routine for each table.  The followingtable-get routines are available:<p>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IfLib.html#m2IfTblEntryGet">m2IfTblEntryGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IpLib.html#m2IpAddrTblEntryGet">m2IpAddrTblEntryGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IpLib.html#m2IpAtransTblEntryGet">m2IpAtransTblEntryGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2IpLib.html#m2IpRouteTblEntryGet">m2IpRouteTblEntryGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2TcpLib.html#m2TcpConnEntryGet">m2TcpConnEntryGet</a></i>(&nbsp;)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;<b><i><a href="./m2UdpLib.html#m2UdpTblEntryGet">m2UdpTblEntryGet</a></i>(&nbsp;)</b><p>The input parameters are a pointer to a table entry structure, and aflag value specifying one of two types of table search.  Each tableentry is a structure, where the struct type name follows this namingconvention: "M2_<i>Groupname</i><i>Tablename</i>TBL".  The MIB-II RFC specifies anindex that identifies a table entry.  Each get request must specify anindex value.  To retrieve the first entry in a table, set all theindex fields of the table-entry structure to zero, and use the searchparameter <b>M2_NEXT_VALUE</b>.  To retrieve subsequent entries, pass theindex returned from the previous invocation, incremented to the nextpossible lexicographical entry.  The search field can only be set tothe constants <b>M2_NEXT_VALUE</b> or <b>M2_EXACT_VALUE</b>:<dl><dt><b>M2_NEXT_VALUE</b><dd>retrieves a table entry that is either identical tothe index value specified as input, or is the closest entry followingthat value, in lexicographic order.<p><dt><b>M2_EXACT_VALUE</b><dd>retrieves a table entry that exactly matches the indexspecified in the input structure. </dl><p>Some MIB-II table entries can be added, modified and deleted.Routines to manipulate such entries are described in the manual pagesfor individual groups.<p>All the IP network addresses that are exchanged with the MIB-IIlibrary must be in host-byte order; use <b><i>ntohl</i>(&nbsp;)</b> to convert addressesbefore calling these library routines.<p>The following example shows how to initialize the MIB-II library forall groups.<p><pre>    extern FUNCPTR myTrapGenerator;    extern void *  myTrapGeneratorArg;    M2_OBJECTID mySysObjectId = { 8, {1,3,6,1,4,1,731,1} };    if (m2Init ("VxWorks 5.1.1 MIB-II library (sysDescr)",                "support@wrs.com (sysContact)",                "1010 Atlantic Avenue Alameda, California 94501 (sysLocation)",                 &amp;mySysObjectId,                 myTrapGenerator,                 myTrapGeneratorArg,                 0) == OK)        /* MIB-II groups initialized successfully */</pre><p></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="./m2IfLib.html#top">m2IfLib</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>, <b><a href="./m2SysLib.html#top">m2SysLib</a></b><hr><a name="m2Init"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>m2Init</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>m2Init</i>(&nbsp;)</strong> - initialize the SNMP MIB-2 library </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2Init    (    char *        pMib2SysDescr,    /* sysDescr */    char *        pMib2SysContact,  /* sysContact */    char *        pMib2SysLocation, /* sysLocation */    M2_OBJECTID * pMib2SysObjectId, /* sysObjectID */    FUNCPTR       pTrapRtn,         /* link up/down -trap routine */    void *        pTrapArg,         /* trap routine arg */    int           maxRouteTableSize /* max size of routing table */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes the MIB-2 library by calling the initializationroutines for each MIB-2 group.  The parameters <i>pMib2SysDescr</i><i>pMib2SysContact</i>, <i>pMib2SysLocation</i>, and <i>pMib2SysObjectId</i> are passeddirectly to <b><i><a href="./m2SysLib.html#m2SysInit">m2SysInit</a></i>(&nbsp;)</b>;  <i>pTrapRtn</i> and <i>pTrapArg</i> are passed directly to<b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>(&nbsp;)</b>; and <i>maxRouteTableSize</i> is passed to <b><i><a href="./m2IpLib.html#m2IpInit">m2IpInit</a></i>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK if successful, otherwise ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2Lib.html#top">m2Lib</a></b>, <b><i><a href="./m2SysLib.html#m2SysInit">m2SysInit</a></i>(&nbsp;)</b>, <b><i><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a></i>(&nbsp;)</b>, <b><i><a href="./m2UdpLib.html#m2UdpInit">m2UdpInit</a></i>(&nbsp;)</b>, <b><i><a href="./m2IcmpLib.html#m2IcmpInit">m2IcmpInit</a></i>(&nbsp;)</b>, <b><i><a href="./m2IfLib.html#m2IfInit">m2IfInit</a></i>(&nbsp;)</b>, <b><i><a href="./m2IpLib.html#m2IpInit">m2IpInit</a></i>(&nbsp;)</b><hr><a name="m2Delete"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>m2Delete</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>m2Delete</i>(&nbsp;)</strong> - delete all the MIB-II library groups</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2Delete (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine cleans up the state associated with the MIB-II library.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK (always).<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2Lib.html#top">m2Lib</a></b>, <b><i><a href="./m2SysLib.html#m2SysDelete">m2SysDelete</a></i>(&nbsp;)</b>, <b><i><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a></i>(&nbsp;)</b>, <b><i><a href="./m2UdpLib.html#m2UdpDelete">m2UdpDelete</a></i>(&nbsp;)</b>, <b><i><a href="./m2IcmpLib.html#m2IcmpDelete">m2IcmpDelete</a></i>(&nbsp;)</b>,  <b><i><a href="./m2IfLib.html#m2IfDelete">m2IfDelete</a></i>(&nbsp;)</b>, <b><i><a href="./m2IpLib.html#m2IpDelete">m2IpDelete</a></i>(&nbsp;)</b></body></html>

⌨️ 快捷键说明

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