1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3<title>oscl_tcp_socket.h Source File</title> 4<link href="doxygen.css" rel="stylesheet" type="text/css"> 5</head><body> 6<!-- Generated by Doxygen 1.2.18 --> 7<center> 8<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> 9<hr><h1>oscl_tcp_socket.h</h1><a href="oscl__tcp__socket_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 1000002 <span class="preprocessor">#ifndef OSCL_TCP_SOCKET_H_INCLUDED</span> 1100003 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_TCP_SOCKET_H_INCLUDED</span> 1200004 <span class="preprocessor"></span> 1300005 <span class="preprocessor">#ifndef OSCL_IP_SOCKET_H_INCLUDED</span> 1400006 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__ip__socket_8h.html">oscl_ip_socket.h</a>"</span> 1500007 <span class="preprocessor">#endif</span> 1600008 <span class="preprocessor"></span> 1700009 <span class="preprocessor">#ifndef OSCL_DEFALLOC_H_INCLUDED</span> 1800010 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__defalloc_8h.html">oscl_defalloc.h</a>"</span> 1900011 <span class="preprocessor">#endif</span> 2000012 <span class="preprocessor"></span> 2100013 <span class="preprocessor">#ifndef OSCL_VECTOR_H_INCLUDED</span> 2200014 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__vector_8h.html">oscl_vector.h</a>"</span> 2300015 <span class="preprocessor">#endif</span> 2400016 <span class="preprocessor"></span> 2500017 <span class="preprocessor">#ifndef OSCL_MEM_H_INCLUDED</span> 2600018 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__mem_8h.html">oscl_mem.h</a>"</span> 2700019 <span class="preprocessor">#endif</span> 2800020 <span class="preprocessor"></span> 2900021 <span class="keyword">class </span><a class="code" href="classOsclBindMethod.html">OsclBindMethod</a>; 3000022 <span class="keyword">class </span><a class="code" href="classOsclListenMethod.html">OsclListenMethod</a>; 3100023 <span class="keyword">class </span><a class="code" href="classOsclConnectMethod.html">OsclConnectMethod</a>; 3200024 <span class="keyword">class </span><a class="code" href="classOsclShutdownMethod.html">OsclShutdownMethod</a>; 3300025 <span class="keyword">class </span><a class="code" href="classOsclAcceptMethod.html">OsclAcceptMethod</a>; 3400026 <span class="keyword">class </span><a class="code" href="classOsclSendMethod.html">OsclSendMethod</a>; 3500027 <span class="keyword">class </span><a class="code" href="classOsclRecvMethod.html">OsclRecvMethod</a>; 3600028 37<a name="l00031"></a><a class="code" href="classOsclTCPSocketI.html">00031</a> <span class="keyword">class </span><a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a> : <span class="keyword">public</span> <a class="code" href="classOsclIPSocketI.html">OsclIPSocketI</a> 3800032 { 3900033 <span class="keyword">public</span>: 4000034 <span class="comment">//Synchronous methods</span> 4100035 <span class="keyword">static</span> <a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a> *<a class="code" href="classOsclTCPSocketI.html#d0">NewL</a>(<a class="code" href="classOscl__DefAlloc.html">Oscl_DefAlloc</a> &a, 4200036 <a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ, 4300037 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver, 4400038 uint32 aId); 4500039 4600040 <span class="keyword">virtual</span> <a class="code" href="classOsclTCPSocketI.html#a0">~OsclTCPSocketI</a>(); 4700041 4800042 int32 <a class="code" href="classOsclTCPSocketI.html#a1">Close</a>(); 4900043 <span class="keyword">inline</span> int32 <a class="code" href="classOsclTCPSocketI.html#a2">Listen</a>(<span class="keywordtype">int</span> aQueueSize); 5000044 <span class="comment">//the returned value is platform-specific</span> 5100045 5200046 <a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a> *<a class="code" href="classOsclTCPSocketI.html#a3">GetAcceptedSocketL</a>(uint32 aId); 5300047 5400048 <span class="keyword">inline</span> uint8 *<a class="code" href="classOsclTCPSocketI.html#a4">GetRecvData</a>(int32 *aLength) ; 5500049 <span class="keyword">inline</span> uint8 *<a class="code" href="classOsclTCPSocketI.html#a5">GetSendData</a>(int32 *aLength); 5600050 5700051 <span class="comment">//Asynchronous methods</span> 5800052 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a6">BindAsync</a>(<a class="code" href="classOsclNetworkAddress.html">OsclNetworkAddress</a>& aAddress, 5900053 int32 aTimeoutMsec = -1); 6000054 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a7">CancelBind</a>(); 6100055 6200056 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a8">ListenAsync</a>(uint32 qsize, 6300057 int32 aTimeoutMsec = -1); 6400058 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a9">CancelListen</a>(); 6500059 6600060 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a10">Connect</a>(<a class="code" href="classOsclNetworkAddress.html">OsclNetworkAddress</a>& aAddress, 6700061 int32 aTimeoutMsec = -1); 6800062 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a11">CancelConnect</a>(); 6900063 7000064 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a12">Shutdown</a>(<a class="code" href="oscl__socket__types_8h.html#a21">TPVSocketShutdown</a> aHow, 7100065 int32 aTimeoutMsec = -1); 7200066 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a13">CancelShutdown</a>(); 7300067 7400068 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a14">Accept</a>(int32 aTimeout = -1); 7500069 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a15">CancelAccept</a>(); 7600070 7700071 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a16">Send</a>(<span class="keyword">const</span> uint8* &aPtr, uint32 aLen, 7800072 int32 aTimeoutMsec = -1); 7900073 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a17">CancelSend</a>(); 8000074 8100075 <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a18">Recv</a>(uint8* &aPtr, uint32 aMaxLen, 8200076 int32 aTimeoutMsec = -1); 8300077 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a19">CancelRecv</a>(); 8400078 8500079 <span class="keyword">private</span>: 8600080 <span class="keyword">static</span> <a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a> *<a class="code" href="classOsclTCPSocketI.html#d0">NewL</a>(<a class="code" href="classOscl__DefAlloc.html">Oscl_DefAlloc</a> &a, 8700081 <a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ, 8800082 <a class="code" href="classOsclSocketI.html">OsclSocketI</a> *aSocket, 8900083 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver, 9000084 uint32 aId); 9100085 9200086 <a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a>(<a class="code" href="classOscl__DefAlloc.html">Oscl_DefAlloc</a> &a) : <a class="code" href="classOsclIPSocketI.html#b0">OsclIPSocketI</a>(a), 9300087 iConnectMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>), 9400088 iShutdownMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>), 9500089 iAcceptMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>), 9600090 iSendMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>), 9700091 iRecvMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>) 9800092 {} 9900093 10000094 <span class="keywordtype">void</span> <a class="code" href="classOsclIPSocketI.html#b1">ConstructL</a>(<a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ, 10100095 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver, 10200096 uint32 aId); 10300097 10400098 <span class="keywordtype">void</span> <a class="code" href="classOsclIPSocketI.html#b1">ConstructL</a>(<a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ, 10500099 <a class="code" href="classOsclSocketI.html">OsclSocketI</a> *aSocket, 10600100 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver, 10700101 uint32 aId); 10800102 10900103 <a class="code" href="classOsclBindMethod.html">OsclBindMethod</a> *iBindMethod; 11000104 <a class="code" href="classOsclListenMethod.html">OsclListenMethod</a> *iListenMethod; 11100105 <a class="code" href="classOsclConnectMethod.html">OsclConnectMethod</a> *iConnectMethod; 11200106 <a class="code" href="classOsclShutdownMethod.html">OsclShutdownMethod</a> *iShutdownMethod; 11300107 <a class="code" href="classOsclAcceptMethod.html">OsclAcceptMethod</a> *iAcceptMethod; 11400108 <a class="code" href="classOsclSendMethod.html">OsclSendMethod</a> *iSendMethod; 11500109 <a class="code" href="classOsclRecvMethod.html">OsclRecvMethod</a> *iRecvMethod; 11600110 }; 11700111 11800112 <span class="preprocessor">#include "<a class="code" href="oscl__socket__listen_8h.html">oscl_socket_listen.h</a>"</span> 11900113 <span class="preprocessor">#include "<a class="code" href="oscl__socket__recv_8h.html">oscl_socket_recv.h</a>"</span> 12000114 <span class="preprocessor">#include "<a class="code" href="oscl__socket__send_8h.html">oscl_socket_send.h</a>"</span> 12100115 <span class="preprocessor">#include "<a class="code" href="oscl__socket__accept_8h.html">oscl_socket_accept.h</a>"</span> 12200116 <span class="preprocessor">#include "<a class="code" href="oscl__socket__shutdown_8h.html">oscl_socket_shutdown.h</a>"</span> 12300117 <span class="preprocessor">#include "<a class="code" href="oscl__socket__connect_8h.html">oscl_socket_connect.h</a>"</span> 12400118 <span class="preprocessor">#include "<a class="code" href="oscl__socket__bind_8h.html">oscl_socket_bind.h</a>"</span> 12500119 126<a name="l00121"></a><a class="code" href="classOsclTCPSocketI.html#a2">00121</a> <span class="keyword">inline</span> int32 <a class="code" href="classOsclTCPSocketI.html#a2">OsclTCPSocketI::Listen</a>(<span class="keywordtype">int</span> aQueueSize) 12700122 { 12800123 <span class="keywordflow">return</span> <a class="code" href="classOsclIPSocketI.html#n4">iSocket</a>-><a class="code" href="classOsclSocketI.html#a6">Listen</a>(aQueueSize) ; 12900124 } 13000125 131<a name="l00127"></a><a class="code" href="classOsclTCPSocketI.html#a4">00127</a> <span class="keyword">inline</span> uint8 *<a class="code" href="classOsclTCPSocketI.html#a4">OsclTCPSocketI::GetRecvData</a>(int32 *aLength) 13200128 { 13300129 <span class="keywordflow">return</span> iRecvMethod-><a class="code" href="classOsclRecvMethod.html#a2">GetRecvData</a>(aLength); 13400130 } 13500131 136<a name="l00133"></a><a class="code" href="classOsclTCPSocketI.html#a5">00133</a> <span class="keyword">inline</span> uint8 *<a class="code" href="classOsclTCPSocketI.html#a5">OsclTCPSocketI::GetSendData</a>(int32 *aLength) 13700134 { 13800135 <span class="keywordflow">return</span> iSendMethod-><a class="code" href="classOsclSendMethod.html#a2">GetSendData</a>(aLength); 13900136 } 14000137 141<a name="l00139"></a><a class="code" href="classOsclTCPSocketI.html#a6">00139</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a6">OsclTCPSocketI::BindAsync</a>(<a class="code" href="classOsclNetworkAddress.html">OsclNetworkAddress</a>& aAddress, 14200140 int32 aTimeout) 14300141 { 14400142 <span class="keywordflow">if</span> (!<a class="code" href="classOsclSocketIBase.html#d0">OsclSocketIBase::HasAsyncBind</a>()) 14500143 <span class="keywordflow">return</span> <a class="code" href="oscl__socket__types_8h.html#a20a14">EPVSocketFailure</a>;<span class="comment">//not available.</span> 14600144 14700145 <a class="code" href="classOsclIPSocketI.html#n1">iAddress</a>.<a class="code" href="classOsclNetworkAddress.html#m0">ipAddr</a>.<a class="code" href="classOsclNameString.html#a3">Set</a>(aAddress.<a class="code" href="classOsclNetworkAddress.html#m0">ipAddr</a>.<a class="code" href="classOsclNameString.html#a5">Str</a>()); 14800146 <a class="code" href="classOsclIPSocketI.html#n1">iAddress</a>.<a class="code" href="classOsclNetworkAddress.html#m1">port</a> = aAddress.<a class="code" href="classOsclNetworkAddress.html#m1">port</a>; 14900147 <span class="keywordflow">return</span> (iBindMethod-><a class="code" href="classOsclBindMethod.html#a1">Bind</a>(aAddress, aTimeout)); 15000148 } 15100149 152<a name="l00150"></a><a class="code" href="classOsclTCPSocketI.html#a7">00150</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a7">OsclTCPSocketI::CancelBind</a>() 15300151 { 15400152 iBindMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 15500153 } 15600154 157<a name="l00156"></a><a class="code" href="classOsclTCPSocketI.html#a8">00156</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a8">OsclTCPSocketI::ListenAsync</a>(uint32 qsize, 15800157 int32 aTimeout) 15900158 { 16000159 <span class="keywordflow">if</span> (!<a class="code" href="classOsclSocketIBase.html#d1">OsclSocketIBase::HasAsyncListen</a>()) 16100160 <span class="keywordflow">return</span> <a class="code" href="oscl__socket__types_8h.html#a20a14">EPVSocketFailure</a>;<span class="comment">//not available</span> 16200161 16300162 <span class="keywordflow">return</span> (iListenMethod-><a class="code" href="classOsclListenMethod.html#a1">Listen</a>(qsize, aTimeout)); 16400163 } 16500164 166<a name="l00165"></a><a class="code" href="classOsclTCPSocketI.html#a9">00165</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a9">OsclTCPSocketI::CancelListen</a>() 16700166 { 16800167 iListenMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 16900168 } 17000169 171<a name="l00171"></a><a class="code" href="classOsclTCPSocketI.html#a10">00171</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a10">OsclTCPSocketI::Connect</a>(<a class="code" href="classOsclNetworkAddress.html">OsclNetworkAddress</a>& aAddress, 17200172 int32 aTimeout) 17300173 { 17400174 <span class="keywordflow">return</span> (iConnectMethod-><a class="code" href="classOsclConnectMethod.html#a1">Connect</a>(aAddress, aTimeout)); 17500175 } 17600176 177<a name="l00177"></a><a class="code" href="classOsclTCPSocketI.html#a11">00177</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a11">OsclTCPSocketI::CancelConnect</a>() 17800178 { 17900179 iConnectMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 18000180 } 18100181 182<a name="l00183"></a><a class="code" href="classOsclTCPSocketI.html#a12">00183</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a12">OsclTCPSocketI::Shutdown</a>(<a class="code" href="oscl__socket__types_8h.html#a21">TPVSocketShutdown</a> aHow, 18300184 int32 aTimeout) 18400185 { 18500186 <span class="keywordflow">return</span> (iShutdownMethod-><a class="code" href="classOsclShutdownMethod.html#a1">Shutdown</a>(aHow, aTimeout)); 18600187 } 18700188 188<a name="l00189"></a><a class="code" href="classOsclTCPSocketI.html#a13">00189</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a13">OsclTCPSocketI::CancelShutdown</a>() 18900190 { 19000191 iShutdownMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 19100192 } 19200193 193<a name="l00195"></a><a class="code" href="classOsclTCPSocketI.html#a14">00195</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a14">OsclTCPSocketI::Accept</a>(int32 aTimeout) 19400196 { 19500197 <span class="keywordflow">return</span> (iAcceptMethod-><a class="code" href="classOsclAcceptMethod.html#a1">Accept</a>(aTimeout)); 19600198 } 19700199 198<a name="l00200"></a><a class="code" href="classOsclTCPSocketI.html#a15">00200</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a15">OsclTCPSocketI::CancelAccept</a>() 19900201 { 20000202 iAcceptMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 20100203 } 20200204 203<a name="l00206"></a><a class="code" href="classOsclTCPSocketI.html#a16">00206</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a16">OsclTCPSocketI::Send</a>(<span class="keyword">const</span> uint8* &aPtr, uint32 aLen, 20400207 int32 aTimeoutMsec) 20500208 { 20600209 <span class="keywordflow">return</span> (iSendMethod-><a class="code" href="classOsclSendMethod.html#a1">Send</a>(aPtr, aLen, aTimeoutMsec)); 20700210 } 20800211 209<a name="l00212"></a><a class="code" href="classOsclTCPSocketI.html#a17">00212</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a17">OsclTCPSocketI::CancelSend</a>() 21000213 { 21100214 iSendMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 21200215 } 21300216 214<a name="l00218"></a><a class="code" href="classOsclTCPSocketI.html#a18">00218</a> <span class="keyword">inline</span> <a class="code" href="oscl__socket__types_8h.html#a20">TPVSocketEvent</a> <a class="code" href="classOsclTCPSocketI.html#a18">OsclTCPSocketI::Recv</a>(uint8* &aPtr, uint32 aMaxLen, 21500219 int32 aTimeout) 21600220 { 21700221 <span class="keywordflow">return</span> (iRecvMethod-><a class="code" href="classOsclRecvMethod.html#a1">Recv</a>(aPtr, aMaxLen, aTimeout)); 21800222 } 21900223 220<a name="l00224"></a><a class="code" href="classOsclTCPSocketI.html#a19">00224</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a19">OsclTCPSocketI::CancelRecv</a>() 22100225 { 22200226 iRecvMethod-><a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>(); 22300227 } 22400228 22500229 <span class="preprocessor">#endif</span> 22600230 <span class="preprocessor"></span> 227</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 228<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 229</small></address> 230</body> 231</html> 232