📄 m2tcplib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/m2TcpLib.html - generated by refgen from m2TcpLib.c --> <title> m2TcpLib </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>m2TcpLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2TcpLib</strong> - MIB-II TCP-group API for SNMP agents </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a>( )</b> - initialize MIB-II TCP-group access<br><b><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a>( )</b> - get MIB-II TCP-group scalar variables<br><b><a href="./m2TcpLib.html#m2TcpConnEntryGet">m2TcpConnEntryGet</a>( )</b> - get a MIB-II TCP connection table entry<br><b><a href="./m2TcpLib.html#m2TcpConnEntrySet">m2TcpConnEntrySet</a>( )</b> - set a TCP connection to the closed state<br><b><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a>( )</b> - delete all resources used to access the TCP group<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides MIB-II services for the TCP group. It provides routinesto initialize the group, access the group global variables, read the tableof TCP connections, and change the state of a TCP connection. For a broaderdescription 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_TCP</b><p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>This library can be initialized and deleted by calling <b><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a>( )</b> and<b><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a>( )</b> respectively, if only the TCP group's services are needed.If full MIB-II support is used, this group and all other groups can beinitialized 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 group global variables are accessed by calling<b><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a>( )</b> as follows:<pre> M2_TCP tcpVars; if (m2TcpGroupInfoGet (&tcpVars) == OK) /* values in tcpVars are valid */</pre>The TCP table of connections can be accessed in lexicographical order. Thefirst entry in the table can be accessed by setting the table index tozero. Every other entry thereafter can be accessed by passing to<b>m2TcpConnTblEntryGet( )</b> the index retrieved in the previous invocationincremented to the next lexicographical value by giving<b>M2_NEXT_VALUE</b> as the search parameter. For example:<pre>M2_TCPCONNTBL tcpEntry; /* Specify a zero index to get the first entry in the table */ tcpEntry.tcpConnLocalAddress = 0; /* Local IP address in host byte order */ tcpEntry.tcpConnLocalPort = 0; /* Local TCP port */ tcpEntry.tcpConnRemAddress = 0; /* remote IP address */ tcpEntry.tcpConnRemPort = 0; /* remote TCP port in host byte order */ /* get the first entry in the table */ if ((m2TcpConnTblEntryGet (M2_NEXT_VALUE, &tcpEntry) == OK) /* values in tcpEntry 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.2000.147.11.46.158.1000 * the index passed in the next invocation should be * 147.11.46.8.2000.147.11.46.158.1001. 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 ((m2TcpConnTblEntryGet (M2_NEXT_VALUE, &tcpEntry) == OK) /* values in tcpEntry in the second entry are valid */</pre>The TCP table of connections allows only for a connection to be deleted asspecified in the MIB-II. For example: <pre> M2_TCPCONNTBL tcpEntry; /* Fill in the index for the connection to be deleted in the table */ /* Local IP address in host byte order, and local port number */ tcpEntry.tcpConnLocalAddress = 0x930b2e08; tcpEntry.tcpConnLocalPort = 3000; /* Remote IP address in host byte order, and remote port number */ tcpEntry.tcpConnRemAddress = 0x930b2e9e; tcpEntry.tcpConnRemPort = 3000; tcpEntry.tcpConnState = 12; /* MIB-II state value for delete */ /* set the entry in the table */ if ((m2TcpConnTblEntrySet (&tcpEntry) == OK) /* tcpEntry deleted successfuly */</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="./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="./m2SysLib.html#top">m2SysLib</a></b><hr><a name="m2TcpInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2TcpInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2TcpInit( )</strong> - initialize MIB-II TCP-group access</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2TcpInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates the resources needed to allow access to the TCP MIB-II variables. This routine must be called before any TCP variablescan be accessed.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2TcpLib.html#top">m2TcpLib</a></b>, <b><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntryGet">m2TcpConnEntryGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntrySet">m2TcpConnEntrySet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a>( )</b><hr><a name="m2TcpGroupInfoGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2TcpGroupInfoGet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2TcpGroupInfoGet( )</strong> - get MIB-II TCP-group scalar variables</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2TcpGroupInfoGet ( M2_TCPINFO * pTcpInfo /* pointer to the TCP group structure */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine fills in the TCP structure pointed to by <i>pTcpInfo</i> with thevalues of MIB-II TCP-group scalar variables.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if <i>pTcpInfo</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="./m2TcpLib.html#top">m2TcpLib</a></b>, <b><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntryGet">m2TcpConnEntryGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntrySet">m2TcpConnEntrySet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a>( )</b><hr><a name="m2TcpConnEntryGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2TcpConnEntryGet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2TcpConnEntryGet( )</strong> - get a MIB-II TCP connection table entry</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2TcpConnEntryGet ( int search, /* M2_EXACT_VALUE or M2_NEXT_VALUE */ M2_TCPCONNTBL * pReqTcpConnEntry /* input = Index, Output = Entry */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine traverses the TCP table of users and does an<b>M2_EXACT_VALUE</b> or a <b>M2_NEXT_VALUE</b> search based on the<i>search</i> parameter (see <b><a href="./m2Lib.html#top">m2Lib</a></b>). The calling routine is responsiblefor supplying a valid MIB-II entry index in the input structure<i>pReqTcpConnEntry</i>. The index is made up of the local IP address,the local port number, the remote IP address, and the remote port.The first entry in the table is retrieved by doing a <b>M2_NEXT_VALUE</b>search with the index fields set to zero.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the input parameter is not specified or amatch is not found.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> <b>S_m2Lib_INVALID_PARAMETER</b><br> <b>S_m2Lib_ENTRY_NOT_FOUND</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2TcpLib.html#top">m2TcpLib</a></b>, <b><a href="./m2Lib.html#top">m2Lib</a></b>, <b><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntrySet">m2TcpConnEntrySet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a>( )</b><hr><a name="m2TcpConnEntrySet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2TcpConnEntrySet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2TcpConnEntrySet( )</strong> - set a TCP connection to the closed state</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2TcpConnEntrySet ( M2_TCPCONNTBL * pReqTcpConnEntry /* pointer to TCP connection to close */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine traverses the TCP connection table and searches for theconnection specified by the input parameter <i>pReqTcpConnEntry</i>. Thecalling routine is responsible for providing a valid index as theinput parameter <i>pReqTcpConnEntry</i>. The index is made up of thelocal IP address, the local port number, the remote IP address, andthe remote port. This call can only succeed if the connection is inthe MIB-II state "deleteTCB" (12). If a match is found, the socketassociated with the TCP connection is closed.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the input parameter is invalid, the state of theconnection specified at <i>pReqTcpConnEntry</i> is not "closed,"the specified connection is not found, a socket is not associatedwith the connection, or the <b><a href="./ioLib.html#close">close</a>( )</b> call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2TcpLib.html#top">m2TcpLib</a></b>, <b><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntryGet">m2TcpConnEntryGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpDelete">m2TcpDelete</a>( )</b><hr><a name="m2TcpDelete"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>m2TcpDelete( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m2TcpDelete( )</strong> - delete all resources used to access the TCP group</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS m2TcpDelete (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine frees all the resources allocated at the time the group wasinitialized. The TCP group should not be accessed after this routine has beencalled.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m2TcpLib.html#top">m2TcpLib</a></b>, <b><a href="./m2TcpLib.html#m2TcpInit">m2TcpInit</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpGroupInfoGet">m2TcpGroupInfoGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntryGet">m2TcpConnEntryGet</a>( )</b>, <b><a href="./m2TcpLib.html#m2TcpConnEntrySet">m2TcpConnEntrySet</a>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -