📄 m2iplib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/m2IpLib.html - generated by refgen from m2IpLib.c --> <title> m2IpLib </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>m2IpLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IpLib</strong> - MIB-II IP-group API for SNMP agents </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./m2IpLib.html#m2IpInit">m2IpInit</a>( )</b> - initialize MIB-II IP-group access<br><b><a href="./m2IpLib.html#m2IpGroupInfoGet">m2IpGroupInfoGet</a>( )</b> - get the MIB-II IP-group scalar variables<br><b><a href="./m2IpLib.html#m2IpGroupInfoSet">m2IpGroupInfoSet</a>( )</b> - set MIB-II IP-group variables to new values<br><b><a href="./m2IpLib.html#m2IpAddrTblEntryGet">m2IpAddrTblEntryGet</a>( )</b> - get an IP MIB-II address entry<br><b><a href="./m2IpLib.html#m2IpAtransTblEntryGet">m2IpAtransTblEntryGet</a>( )</b> - get a MIB-II ARP table entry<br><b><a href="./m2IpLib.html#m2IpAtransTblEntrySet">m2IpAtransTblEntrySet</a>( )</b> - add, modify, or delete a MIB-II ARP entry<br><b><a href="./m2IpLib.html#m2IpRouteTblEntryGet">m2IpRouteTblEntryGet</a>( )</b> - get a MIB-2 routing table entry <br><b><a href="./m2IpLib.html#m2IpRouteTblEntrySet">m2IpRouteTblEntrySet</a>( )</b> - set a MIB-II routing table entry<br><b><a href="./m2IpLib.html#m2IpDelete">m2IpDelete</a>( )</b> - delete all resources used to access the IP group<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides MIB-II services for the IP group. It providesroutines to initialize the group, access the group scalar variables, readthe table IP address, route and ARP table. The route and ARP table canalso be modified. 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_IP</b><p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>To use this library, the MIB-II interface group must also be initialized;see the manual entry for <b><a href="./m2IfLib.html#top">m2IfLib</a></b>. This library (<b><a href="./m2IpLib.html#top">m2IpLib</a></b>) can beinitialized and deleted by calling <b><a href="./m2IpLib.html#m2IpInit">m2IpInit</a>( )</b> and <b><a href="./m2IpLib.html#m2IpDelete">m2IpDelete</a>( )</b>respectively, if only the IP group's services are needed. If full MIB-IIsupport is used, this group and all other groups can be initialized anddeleted by calling <b><a href="./m2Lib.html#m2Init">m2Init</a>( )</b> and <b><a href="./m2Lib.html#m2Delete">m2Delete</a>( )</b>.<p>The following example demonstrates how to access and change IP scalarvariables:<pre> M2_IP ipVars; int varToSet; if (m2IpGroupInfoGet (&ipVars) == OK) /* values in ipVars are valid */ /* if IP is forwarding packets (MIB-II value is 1) turn it off */ if (ipVars.ipForwarding == M2_ipForwarding_forwarding) { /* Not forwarding (MIB-II value is 2) */ ipVars.ipForwarding = M2_ipForwarding_not_forwarding; varToSet |= M2_IPFORWARDING; } /* change the IP default time to live parameter */ ipVars.ipDefaultTTL = 55; if (m2IpGroupInfoSet (varToSet, &ipVars) == OK) /* values in ipVars are valid */</pre>The IP address table is a read-only table. Entries to this table can be retrieved as follows:<pre> M2_IPADDRTBL ipAddrEntry; /* Specify the index as zero to get the first entry in the table */ ipAddrEntry.ipAdEntAddr = 0; /* Local IP address in host byte order */ /* get the first entry in the table */ if ((m2IpAddrTblEntryGet (M2_NEXT_VALUE, &ipAddrEntry) == OK) /* values in ipAddrEntry in the first entry are valid */ /* Process first entry in the table */ /* * For the next call, increment the index returned in the previous call. * The increment is to the next possible lexicographic entry; for * example, if the returned index was 147.11.46.8 the index passed in the * next invocation should be 147.11.46.9. If an entry in the table * matches the specified index, then that entry is returned. * Otherwise the closest entry following it, in lexicographic order, * is returned. */ /* get the second entry in the table */ if ((m2IpAddrTblEntryGet (M2_NEXT_VALUE, &ipAddrEntryEntry) == OK) /* values in ipAddrEntry in the second entry are valid */</pre>The IP Address Translation Table (ARP table) includes the functionality ofthe AT group plus additional functionality. The AT group is supportedthrough this MIB-II table. Entries in this table can be added anddeleted. An entry is deleted (with a set operation) by setting the<b>ipNetToMediaType</b> field to the MIB-II "invalid" value (2). The following example shows how to delete an entry:<pre>M2_IPATRANSTBL atEntry; /* Specify the index for the connection to be deleted in the table */ atEntry.ipNetToMediaIfIndex = 1 /* interface index */ /* destination IP address in host byte order */ atEntry.ipNetToMediaNetAddress = 0x930b2e08; /* mark entry as invalid */ atEntry.ipNetToMediaType = M2_ipNetToMediaType_invalid; /* set the entry in the table */ if ((m2IpAtransTblEntrySet (&atEntry) == OK) /* Entry deleted successfully */</pre>The IP route table allows for entries to be read, deleted, and modified. Thisexample demonstrates how an existing route is deleted:<pre> M2_IPROUTETBL routeEntry; /* Specify the index for the connection to be deleted in the table */ /* destination IP address in host byte order */ routeEntry.ipRouteDest = 0x930b2e08; /* mark entry as invalid */ routeEntry.ipRouteType = M2_ipRouteType_invalid; /* set the entry in the table */ if ((m2IpRouteTblEntrySet (M2_IP_ROUTE_TYPE, &routeEntry) == OK) /* Entry deleted successfully */</pre></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>m2Lib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><p><b><a href="./m2Lib.html#top">m2Lib</a></b>, <b><a href="./m2SysLib.html#top">m2SysLib</a></b>, <b><a href="./m2IfLib.html#top">m2IfLib</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="m2IpInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IpInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IpInit( )</strong> - initialize MIB-II IP-group access</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IpInit ( int maxRouteTableSize /* max size of routing table */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates the resources needed to allow access to the MIB-IIIP variables. This routine must be called before any IP variablescan be accessed. The parameter <i>maxRouteTableSize</i> is used to increase thedefault size of the MIB-II route table cache.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the route table or the route semaphore cannot be allocated.<p></blockquote><h4>ERRNO</h4><blockquote><p><p><b>S_m2Lib_CANT_CREATE_ROUTE_SEM</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IpLib.html#top">m2IpLib</a></b>, <b><a href="./m2IpLib.html#m2IpGroupInfoGet">m2IpGroupInfoGet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpGroupInfoSet">m2IpGroupInfoSet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpAddrTblEntryGet">m2IpAddrTblEntryGet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpAtransTblEntrySet">m2IpAtransTblEntrySet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpRouteTblEntryGet">m2IpRouteTblEntryGet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpRouteTblEntrySet">m2IpRouteTblEntrySet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpDelete">m2IpDelete</a>( )</b><hr><a name="m2IpGroupInfoGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IpGroupInfoGet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IpGroupInfoGet( )</strong> - get the MIB-II IP-group scalar variables</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IpGroupInfoGet ( M2_IP * pIpInfo /* pointer to IP MIB-II global group variables */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine fills in the IP structure at <i>pIpInfo</i> with thevalues of MIB-II IP global variables.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if <i>pIpInfo</i> is not a valid pointer.<p></blockquote><h4>ERRNO</h4><blockquote><p><p><b>S_m2Lib_INVALID_PARAMETER</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2IpLib.html#top">m2IpLib</a></b>, <b><a href="./m2IpLib.html#m2IpInit">m2IpInit</a>( )</b>, <b><a href="./m2IpLib.html#m2IpGroupInfoSet">m2IpGroupInfoSet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpAddrTblEntryGet">m2IpAddrTblEntryGet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpAtransTblEntrySet">m2IpAtransTblEntrySet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpRouteTblEntryGet">m2IpRouteTblEntryGet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpRouteTblEntrySet">m2IpRouteTblEntrySet</a>( )</b>, <b><a href="./m2IpLib.html#m2IpDelete">m2IpDelete</a>( )</b><hr><a name="m2IpGroupInfoSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2IpGroupInfoSet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2IpGroupInfoSet( )</strong> - set MIB-II IP-group variables to new values</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2IpGroupInfoSet ( unsigned int varToSet, /* bit field used to set variables */ M2_IP * pIpInfo /* ptr to the MIB-II IP group global variables */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets one or more variables in the IP group, as specified in theinput structure <i>pIpInfo</i> and the bit field parameter <i>varToSet</i>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if <i>pIpInfo</i> is not a valid pointer, or <i>varToSet</i> hasan invalid bit field.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -