Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_socket_request.h

Go to the documentation of this file.

    00001
    00002 #ifndef OSCL_SOCKET_REQUEST_H_INCLUDED
    00003 #define OSCL_SOCKET_REQUEST_H_INCLUDED
    00004
    00005 #include "oscl_socket_types.h"
    00006 #include "oscl_vector.h"
    00007 #include "oscl_mem.h"
    00008
    00009 //Internal use buffer types.
    00010 class PVSockBufSend
    00011 {
    00012     public:
    00013         PVSockBufSend():
    00014                 iPtr(NULL),
    00015                 iLen(0)
    00016         {}
    00017         PVSockBufSend(const uint8* aPtr, uint32 aLen):
    00018                 iPtr(aPtr),
    00019                 iLen(aLen)
    00020         {}
    00021         PVSockBufSend(const PVSockBufSend& a):
    00022                 iPtr(a.iPtr),
    00023                 iLen(a.iLen)
    00024         {}
    00025         const uint8* iPtr;
    00026         uint32 iLen;
    00027 };
    00028 class PVSockBufRecv
    00029 {
    00030     public:
    00031         PVSockBufRecv():
    00032                 iPtr(NULL),
    00033                 iLen(0),
    00034                 iMaxLen(0)
    00035         {}
    00036         PVSockBufRecv(uint8* aPtr, uint32 aLen, uint32 aMax):
    00037                 iPtr(aPtr),
    00038                 iLen(aLen),
    00039                 iMaxLen(aMax)
    00040         {}
    00041         PVSockBufRecv(const PVSockBufRecv& a)
    00042                 : iPtr(a.iPtr)
    00043                 , iLen(a.iLen)
    00044                 , iMaxLen(a.iMaxLen)
    00045         {}
    00046         uint8* iPtr;
    00047         uint32 iLen;
    00048         uint32 iMaxLen;
    00049 };
    00050
    00051 class OsclSocketI;
    00052 class OsclSocketRequestAO;
    00053
    00056 class SocketRequestParam
    00057 {
    00058     public:
    00059         SocketRequestParam(TPVSocketFxn aFxn)
    00060                 : iFxn(aFxn)
    00061         {}
    00062
    00063         TPVSocketFxn iFxn;
    00064 };
    00065
    00069 class SendParam: public SocketRequestParam
    00070 {
    00071     public:
    00072         SendParam(const uint8* &aPtr, uint32 aLen, uint32 aFlags)
    00073                 : SocketRequestParam(EPVSocketSend)
    00074                 , iBufSend(aPtr, aLen)
    00075                 , iFlags(aFlags)
    00076                 , iXferLen(0)
    00077         {}
    00078         PVSockBufSend iBufSend;
    00079         uint32 iFlags;
    00080         uint32 iXferLen;
    00081 } ;
    00082
    00083 class SendToParam: public SocketRequestParam
    00084 {
    00085     public:
    00086         SendToParam(const uint8* &aPtr, uint32 aLen, OsclNetworkAddress& anAddr, uint32 flags)
    00087                 : SocketRequestParam(EPVSocketSendTo)
    00088                 , iBufSend(aPtr, aLen)
    00089                 , iFlags(flags)
    00090                 , iAddr(anAddr)
    00091                 , iXferLen(0)
    00092         {}
    00093         ~SendToParam()
    00094         {}
    00095         PVSockBufSend iBufSend;
    00096         uint32 iFlags;
    00097         OsclNetworkAddress iAddr;
    00098         uint32 iXferLen;
    00099 } ;
    00100
    00101 class RecvParam: public SocketRequestParam
    00102 {
    00103     public:
    00104         RecvParam(uint8* &aPtr, uint32 aMaxLen, uint32 flags)
    00105                 : SocketRequestParam(EPVSocketRecv)
    00106                 , iBufRecv(aPtr, 0, aMaxLen)
    00107                 , iFlags(flags)
    00108         {}
    00109         PVSockBufRecv iBufRecv;
    00110         uint32 iFlags;
    00111 } ;
    00112
    00113 class RecvFromParam: public SocketRequestParam
    00114 {
    00115     public:
    00116         RecvFromParam(uint8* &aPtr, uint32 aMaxLen,
    00117                       OsclNetworkAddress& aAddress, uint32 flags, uint32 aMultiMax
    00118                       , Oscl_Vector<uint32, OsclMemAllocator>*aPacketLen
    00119                       , Oscl_Vector<OsclNetworkAddress, OsclMemAllocator>* aPacketSource)
    00120                 : SocketRequestParam(EPVSocketRecvFrom)
    00121                 , iBufRecv(aPtr, 0, aMaxLen)
    00122                 , iFlags(flags)
    00123                 , iAddr(aAddress)
    00124                 , iMultiMaxLen(aMultiMax)
    00125                 , iPacketLen(aPacketLen)
    00126                 , iPacketSource(aPacketSource)
    00127         {}
    00128         PVSockBufRecv iBufRecv;
    00129         uint32 iFlags;
    00130         OsclNetworkAddress& iAddr;
    00131         uint32 iMultiMaxLen;
    00132         Oscl_Vector<uint32, OsclMemAllocator>* iPacketLen;
    00133         Oscl_Vector<OsclNetworkAddress, OsclMemAllocator>* iPacketSource;
    00134 };
    00135
    00136 class BindParam: public SocketRequestParam
    00137 {
    00138     public:
    00139         BindParam(OsclNetworkAddress& anAddr)
    00140                 : SocketRequestParam(EPVSocketBind)
    00141                 , iAddr(anAddr)
    00142         {}
    00143         OsclNetworkAddress iAddr;
    00144 } ;
    00145
    00146 class ListenParam: public SocketRequestParam
    00147 {
    00148     public:
    00149         ListenParam(uint32 aSize)
    00150                 : SocketRequestParam(EPVSocketListen)
    00151                 , iQSize(aSize)
    00152         {}
    00153         uint32 iQSize;
    00154 } ;
    00155
    00156 class ConnectParam: public SocketRequestParam
    00157 {
    00158     public:
    00159         ConnectParam(OsclNetworkAddress& anAddr)
    00160                 : SocketRequestParam(EPVSocketConnect)
    00161                 , iAddr(anAddr)
    00162         {}
    00163         OsclNetworkAddress iAddr;
    00164 } ;
    00165
    00166 class AcceptParam: public SocketRequestParam
    00167 {
    00168     public:
    00169         AcceptParam(OsclSocketI& aBlankSocket)
    00170                 : SocketRequestParam(EPVSocketAccept)
    00171                 , iBlankSocket(&aBlankSocket)
    00172         {}
    00173         OsclSocketI *iBlankSocket;
    00174 } ;
    00175
    00176 class ShutdownParam: public SocketRequestParam
    00177 {
    00178     public:
    00179         ShutdownParam(TPVSocketShutdown aHow)
    00180                 : SocketRequestParam(EPVSocketShutdown)
    00181                 , iHow(aHow)
    00182         {}
    00183         TPVSocketShutdown iHow;
    00184 } ;
    00185
    00186 #include "oscl_socket_tuneables.h"
    00187 #if PV_SOCKET_SERVER
    00188
    00189 class OsclSocketServRequestQElem;
    00190
    00194 class OsclSocketRequest
    00195 {
    00196     public:
    00197         OsclSocketRequest()
    00198                 : iSocketRequestAO(NULL)
    00199                 , iParam(NULL)
    00200                 , iSocketI(NULL)
    00201         {}
    00202
    00203         TPVSocketFxn Fxn()
    00204         {
    00205             return iParam->iFxn;
    00206         }
    00207
    00208         OsclSocketRequestAO *iSocketRequestAO;
    00209         SocketRequestParam *iParam;
    00210         OsclSocketI * iSocketI;
    00211
    00212         void CancelRequest();
    00213         void Activate(SocketRequestParam *iParam, OsclSocketRequestAO &a);
    00214
    00215         void Complete(OsclSocketServRequestQElem*, int32 aStatus, int32 aSockErr = 0);
    00216
    00217 };
    00218
    00219 #endif
    00220
    00221
    00222 #endif
    00223