blob: ba670b2d739ba6c39fd41d25169ace7bb77fec65 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>oscl_tcp_socket.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
<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
00002 <span class="preprocessor">#ifndef OSCL_TCP_SOCKET_H_INCLUDED</span>
00003 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_TCP_SOCKET_H_INCLUDED</span>
00004 <span class="preprocessor"></span>
00005 <span class="preprocessor">#ifndef OSCL_IP_SOCKET_H_INCLUDED</span>
00006 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__ip__socket_8h.html">oscl_ip_socket.h</a>"</span>
00007 <span class="preprocessor">#endif</span>
00008 <span class="preprocessor"></span>
00009 <span class="preprocessor">#ifndef OSCL_DEFALLOC_H_INCLUDED</span>
00010 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__defalloc_8h.html">oscl_defalloc.h</a>"</span>
00011 <span class="preprocessor">#endif</span>
00012 <span class="preprocessor"></span>
00013 <span class="preprocessor">#ifndef OSCL_VECTOR_H_INCLUDED</span>
00014 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__vector_8h.html">oscl_vector.h</a>"</span>
00015 <span class="preprocessor">#endif</span>
00016 <span class="preprocessor"></span>
00017 <span class="preprocessor">#ifndef OSCL_MEM_H_INCLUDED</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__mem_8h.html">oscl_mem.h</a>"</span>
00019 <span class="preprocessor">#endif</span>
00020 <span class="preprocessor"></span>
00021 <span class="keyword">class </span><a class="code" href="classOsclBindMethod.html">OsclBindMethod</a>;
00022 <span class="keyword">class </span><a class="code" href="classOsclListenMethod.html">OsclListenMethod</a>;
00023 <span class="keyword">class </span><a class="code" href="classOsclConnectMethod.html">OsclConnectMethod</a>;
00024 <span class="keyword">class </span><a class="code" href="classOsclShutdownMethod.html">OsclShutdownMethod</a>;
00025 <span class="keyword">class </span><a class="code" href="classOsclAcceptMethod.html">OsclAcceptMethod</a>;
00026 <span class="keyword">class </span><a class="code" href="classOsclSendMethod.html">OsclSendMethod</a>;
00027 <span class="keyword">class </span><a class="code" href="classOsclRecvMethod.html">OsclRecvMethod</a>;
00028
<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>
00032 {
00033 <span class="keyword">public</span>:
00034 <span class="comment">//Synchronous methods</span>
00035 <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> &amp;a,
00036 <a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ,
00037 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver,
00038 uint32 aId);
00039
00040 <span class="keyword">virtual</span> <a class="code" href="classOsclTCPSocketI.html#a0">~OsclTCPSocketI</a>();
00041
00042 int32 <a class="code" href="classOsclTCPSocketI.html#a1">Close</a>();
00043 <span class="keyword">inline</span> int32 <a class="code" href="classOsclTCPSocketI.html#a2">Listen</a>(<span class="keywordtype">int</span> aQueueSize);
00044 <span class="comment">//the returned value is platform-specific</span>
00045
00046 <a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a> *<a class="code" href="classOsclTCPSocketI.html#a3">GetAcceptedSocketL</a>(uint32 aId);
00047
00048 <span class="keyword">inline</span> uint8 *<a class="code" href="classOsclTCPSocketI.html#a4">GetRecvData</a>(int32 *aLength) ;
00049 <span class="keyword">inline</span> uint8 *<a class="code" href="classOsclTCPSocketI.html#a5">GetSendData</a>(int32 *aLength);
00050
00051 <span class="comment">//Asynchronous methods</span>
00052 <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>&amp; aAddress,
00053 int32 aTimeoutMsec = -1);
00054 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a7">CancelBind</a>();
00055
00056 <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,
00057 int32 aTimeoutMsec = -1);
00058 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a9">CancelListen</a>();
00059
00060 <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>&amp; aAddress,
00061 int32 aTimeoutMsec = -1);
00062 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a11">CancelConnect</a>();
00063
00064 <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,
00065 int32 aTimeoutMsec = -1);
00066 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a13">CancelShutdown</a>();
00067
00068 <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);
00069 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a15">CancelAccept</a>();
00070
00071 <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* &amp;aPtr, uint32 aLen,
00072 int32 aTimeoutMsec = -1);
00073 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a17">CancelSend</a>();
00074
00075 <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* &amp;aPtr, uint32 aMaxLen,
00076 int32 aTimeoutMsec = -1);
00077 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTCPSocketI.html#a19">CancelRecv</a>();
00078
00079 <span class="keyword">private</span>:
00080 <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> &amp;a,
00081 <a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ,
00082 <a class="code" href="classOsclSocketI.html">OsclSocketI</a> *aSocket,
00083 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver,
00084 uint32 aId);
00085
00086 <a class="code" href="classOsclTCPSocketI.html">OsclTCPSocketI</a>(<a class="code" href="classOscl__DefAlloc.html">Oscl_DefAlloc</a> &amp;a) : <a class="code" href="classOsclIPSocketI.html#b0">OsclIPSocketI</a>(a),
00087 iConnectMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>),
00088 iShutdownMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>),
00089 iAcceptMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>),
00090 iSendMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>),
00091 iRecvMethod(<a class="code" href="group__osclbase.html#a81">NULL</a>)
00092 {}
00093
00094 <span class="keywordtype">void</span> <a class="code" href="classOsclIPSocketI.html#b1">ConstructL</a>(<a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ,
00095 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver,
00096 uint32 aId);
00097
00098 <span class="keywordtype">void</span> <a class="code" href="classOsclIPSocketI.html#b1">ConstructL</a>(<a class="code" href="classOsclSocketServI.html">OsclSocketServI</a> *aServ,
00099 <a class="code" href="classOsclSocketI.html">OsclSocketI</a> *aSocket,
00100 <a class="code" href="classOsclSocketObserver.html">OsclSocketObserver</a> *aObserver,
00101 uint32 aId);
00102
00103 <a class="code" href="classOsclBindMethod.html">OsclBindMethod</a> *iBindMethod;
00104 <a class="code" href="classOsclListenMethod.html">OsclListenMethod</a> *iListenMethod;
00105 <a class="code" href="classOsclConnectMethod.html">OsclConnectMethod</a> *iConnectMethod;
00106 <a class="code" href="classOsclShutdownMethod.html">OsclShutdownMethod</a> *iShutdownMethod;
00107 <a class="code" href="classOsclAcceptMethod.html">OsclAcceptMethod</a> *iAcceptMethod;
00108 <a class="code" href="classOsclSendMethod.html">OsclSendMethod</a> *iSendMethod;
00109 <a class="code" href="classOsclRecvMethod.html">OsclRecvMethod</a> *iRecvMethod;
00110 };
00111
00112 <span class="preprocessor">#include "<a class="code" href="oscl__socket__listen_8h.html">oscl_socket_listen.h</a>"</span>
00113 <span class="preprocessor">#include "<a class="code" href="oscl__socket__recv_8h.html">oscl_socket_recv.h</a>"</span>
00114 <span class="preprocessor">#include "<a class="code" href="oscl__socket__send_8h.html">oscl_socket_send.h</a>"</span>
00115 <span class="preprocessor">#include "<a class="code" href="oscl__socket__accept_8h.html">oscl_socket_accept.h</a>"</span>
00116 <span class="preprocessor">#include "<a class="code" href="oscl__socket__shutdown_8h.html">oscl_socket_shutdown.h</a>"</span>
00117 <span class="preprocessor">#include "<a class="code" href="oscl__socket__connect_8h.html">oscl_socket_connect.h</a>"</span>
00118 <span class="preprocessor">#include "<a class="code" href="oscl__socket__bind_8h.html">oscl_socket_bind.h</a>"</span>
00119
<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)
00122 {
00123 <span class="keywordflow">return</span> <a class="code" href="classOsclIPSocketI.html#n4">iSocket</a>-&gt;<a class="code" href="classOsclSocketI.html#a6">Listen</a>(aQueueSize) ;
00124 }
00125
<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)
00128 {
00129 <span class="keywordflow">return</span> iRecvMethod-&gt;<a class="code" href="classOsclRecvMethod.html#a2">GetRecvData</a>(aLength);
00130 }
00131
<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)
00134 {
00135 <span class="keywordflow">return</span> iSendMethod-&gt;<a class="code" href="classOsclSendMethod.html#a2">GetSendData</a>(aLength);
00136 }
00137
<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>&amp; aAddress,
00140 int32 aTimeout)
00141 {
00142 <span class="keywordflow">if</span> (!<a class="code" href="classOsclSocketIBase.html#d0">OsclSocketIBase::HasAsyncBind</a>())
00143 <span class="keywordflow">return</span> <a class="code" href="oscl__socket__types_8h.html#a20a14">EPVSocketFailure</a>;<span class="comment">//not available.</span>
00144
00145 <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>());
00146 <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>;
00147 <span class="keywordflow">return</span> (iBindMethod-&gt;<a class="code" href="classOsclBindMethod.html#a1">Bind</a>(aAddress, aTimeout));
00148 }
00149
<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>()
00151 {
00152 iBindMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00153 }
00154
<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,
00157 int32 aTimeout)
00158 {
00159 <span class="keywordflow">if</span> (!<a class="code" href="classOsclSocketIBase.html#d1">OsclSocketIBase::HasAsyncListen</a>())
00160 <span class="keywordflow">return</span> <a class="code" href="oscl__socket__types_8h.html#a20a14">EPVSocketFailure</a>;<span class="comment">//not available</span>
00161
00162 <span class="keywordflow">return</span> (iListenMethod-&gt;<a class="code" href="classOsclListenMethod.html#a1">Listen</a>(qsize, aTimeout));
00163 }
00164
<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>()
00166 {
00167 iListenMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00168 }
00169
<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>&amp; aAddress,
00172 int32 aTimeout)
00173 {
00174 <span class="keywordflow">return</span> (iConnectMethod-&gt;<a class="code" href="classOsclConnectMethod.html#a1">Connect</a>(aAddress, aTimeout));
00175 }
00176
<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>()
00178 {
00179 iConnectMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00180 }
00181
<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,
00184 int32 aTimeout)
00185 {
00186 <span class="keywordflow">return</span> (iShutdownMethod-&gt;<a class="code" href="classOsclShutdownMethod.html#a1">Shutdown</a>(aHow, aTimeout));
00187 }
00188
<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>()
00190 {
00191 iShutdownMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00192 }
00193
<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)
00196 {
00197 <span class="keywordflow">return</span> (iAcceptMethod-&gt;<a class="code" href="classOsclAcceptMethod.html#a1">Accept</a>(aTimeout));
00198 }
00199
<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>()
00201 {
00202 iAcceptMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00203 }
00204
<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* &amp;aPtr, uint32 aLen,
00207 int32 aTimeoutMsec)
00208 {
00209 <span class="keywordflow">return</span> (iSendMethod-&gt;<a class="code" href="classOsclSendMethod.html#a1">Send</a>(aPtr, aLen, aTimeoutMsec));
00210 }
00211
<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>()
00213 {
00214 iSendMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00215 }
00216
<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* &amp;aPtr, uint32 aMaxLen,
00219 int32 aTimeout)
00220 {
00221 <span class="keywordflow">return</span> (iRecvMethod-&gt;<a class="code" href="classOsclRecvMethod.html#a1">Recv</a>(aPtr, aMaxLen, aTimeout));
00222 }
00223
<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>()
00225 {
00226 iRecvMethod-&gt;<a class="code" href="classOsclSocketMethod.html#a4">CancelMethod</a>();
00227 }
00228
00229 <span class="preprocessor">#endif</span>
00230 <span class="preprocessor"></span>
</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
</small></address>
</body>
</html>