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

oscl_socket.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00003 
00004 //                     O S C L _ S O C K E T
00005 
00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00007 
00018 #ifndef OSCL_SOCKET_H_INCLUDED
00019 #define OSCL_SOCKET_H_INCLUDED
00020 
00021 #ifndef OSCLCONFIG_IO_H_INCLUDED
00022 #include "osclconfig_io.h"
00023 #endif
00024 
00025 #ifndef OSCL_SOCKET_TYPES_H_INCLUDED
00026 #include "oscl_socket_types.h"
00027 #endif
00028 
00029 #ifndef OSCL_HEAPBASE_H_INCLUDED
00030 #include "oscl_heapbase.h"
00031 #endif
00032 
00033 #ifndef OSCL_DEFALLOC_H_INCLUDED
00034 #include "oscl_defalloc.h"
00035 #endif
00036 
00037 #ifndef OSCL_VECTOR_H_INCLUDED
00038 #include "oscl_vector.h"
00039 #endif
00040 
00041 #ifndef OSCL_MEM_H_INCLUDED
00042 #include "oscl_mem.h"
00043 #endif
00044 
00048 class OsclSocketServI;
00049 
00050 class OsclSocketServ : public HeapBase
00051 {
00052     public:
00060         OSCL_IMPORT_REF static OsclSocketServ *NewL(Oscl_DefAlloc &alloc);
00061 
00066         OSCL_IMPORT_REF ~OsclSocketServ();
00067 
00076         OSCL_IMPORT_REF int32 Connect(uint32 aMessageSlots = 8, bool aShareSession = false);
00077 
00086         OSCL_IMPORT_REF void Close(bool aCleanup = true);
00087 
00088     private:
00089         OsclSocketServ(Oscl_DefAlloc &alloc): iServ(NULL), iAlloc(alloc) {}
00090 
00091         OsclSocketServI *iServ;
00092         Oscl_DefAlloc &iAlloc;
00093 
00094         friend class OsclTCPSocket;
00095         friend class OsclUDPSocket;
00096         friend class OsclDNS;
00097 
00098 };
00099 
00100 
00101 class OsclUDPSocketI;
00102 
00107 class OsclUDPSocket : public HeapBase
00108 {
00109     public:
00122         OSCL_IMPORT_REF static OsclUDPSocket *NewL(Oscl_DefAlloc &alloc,
00123                 OsclSocketServ& aServ,
00124                 OsclSocketObserver *aObserver,
00125                 uint32 aId);
00126 
00131         OSCL_IMPORT_REF ~OsclUDPSocket();
00132 
00140         OSCL_IMPORT_REF TPVSocketEvent ThreadLogoff();
00147         OSCL_IMPORT_REF TPVSocketEvent ThreadLogon(
00148             OsclSocketServ& aServ,
00149             OsclSocketObserver *aObserver
00150         );
00151 
00164         OSCL_IMPORT_REF int32 Close();
00165 
00174         OSCL_IMPORT_REF int32 Bind(OsclNetworkAddress& aAddress);
00175 
00186         OSCL_IMPORT_REF int32 Join(OsclNetworkAddress& aAddress);
00187 
00200         OSCL_IMPORT_REF int32 JoinMulticastGroup(OsclIpMReq& aMReq);
00201 
00216         OSCL_IMPORT_REF int32 SetMulticastTTL(int32 aTTL);
00217 
00229         OSCL_IMPORT_REF int32 SetOptionToReuseAddress();
00230 
00243         OSCL_IMPORT_REF int32 SetTOS(const OsclSocketTOS& aTOS);
00244 
00254         OSCL_IMPORT_REF int32 GetPeerName(OsclNetworkAddress& aPeerName);
00255 
00269         OSCL_IMPORT_REF TPVSocketEvent BindAsync(OsclNetworkAddress& aAddress
00270                 , int32 aTimeoutMsec = (-1));
00271 
00280         OSCL_IMPORT_REF void CancelBind();
00281 
00291         OSCL_IMPORT_REF uint8 *GetRecvData(int32 *aLength);
00292 
00302         OSCL_IMPORT_REF uint8 *GetSendData(int32 *aLength);
00303 
00319         OSCL_IMPORT_REF TPVSocketEvent SendTo(const uint8* aPtr, uint32 aLen,
00320                                               OsclNetworkAddress& aAddress,
00321                                               int32 aTimeoutMsec = -1);
00330         OSCL_IMPORT_REF void CancelSendTo();
00331 
00361         OSCL_IMPORT_REF TPVSocketEvent RecvFrom(uint8* aPtr, uint32 aMaxLen,
00362                                                 OsclNetworkAddress& aAddress,
00363                                                 int32 aTimeoutMsec = -1,
00364                                                 uint32 aMultiRecvLimit = 0,
00365                                                 Oscl_Vector<uint32, OsclMemAllocator>* aPacketLen = NULL,
00366                                                 Oscl_Vector<OsclNetworkAddress, OsclMemAllocator>* aPacketSource = NULL);
00375         OSCL_IMPORT_REF void CancelRecvFrom();
00376 
00386         OSCL_IMPORT_REF int32 SetRecvBufferSize(uint32 size);
00387 
00388     private:
00389         OsclUDPSocket(Oscl_DefAlloc &alloc): iUDPSocket(NULL), iAlloc(alloc) {}
00390         OsclUDPSocketI *iUDPSocket;
00391         Oscl_DefAlloc &iAlloc;
00392 };
00393 
00394 class OsclTCPSocketI;
00395 
00400 class OsclTCPSocket : public HeapBase
00401 {
00402     public:
00415         OSCL_IMPORT_REF static OsclTCPSocket *NewL(Oscl_DefAlloc &alloc,
00416                 OsclSocketServ& aServ,
00417                 OsclSocketObserver *aObserver,
00418                 uint32 aId);
00419 
00424         OSCL_IMPORT_REF ~OsclTCPSocket();
00425 
00433         OSCL_IMPORT_REF TPVSocketEvent ThreadLogoff();
00440         OSCL_IMPORT_REF TPVSocketEvent ThreadLogon(
00441             OsclSocketServ& aServ,
00442             OsclSocketObserver *aObserver
00443         );
00444 
00457         OSCL_IMPORT_REF int32 Close();
00458 
00467         OSCL_IMPORT_REF int32 Bind(OsclNetworkAddress& aAddress);
00468 
00482         OSCL_IMPORT_REF TPVSocketEvent BindAsync(OsclNetworkAddress& aAddress
00483                 , int32 aTimeoutMsec = (-1));
00484 
00493         OSCL_IMPORT_REF void CancelBind();
00494 
00506         OSCL_IMPORT_REF int32 SetOptionToReuseAddress();
00507 
00520         OSCL_IMPORT_REF int32 SetTOS(const OsclSocketTOS& aTOS);
00521 
00531         OSCL_IMPORT_REF int32 GetPeerName(OsclNetworkAddress& aPeerName);
00540         OSCL_IMPORT_REF int32 Listen(int32 aQueueSize);
00541 
00555         OSCL_IMPORT_REF TPVSocketEvent ListenAsync(int32 aQueueSize, int32 aTimeoutMsec = (-1));
00556 
00565         OSCL_IMPORT_REF void CancelListen();
00566 
00579         OSCL_IMPORT_REF OsclTCPSocket *GetAcceptedSocketL(uint32 aId);
00580 
00590         OSCL_IMPORT_REF uint8 *GetRecvData(int32 *aLength);
00591 
00601         OSCL_IMPORT_REF uint8 *GetSendData(int32 *aLength);
00602 
00616         OSCL_IMPORT_REF TPVSocketEvent Connect(OsclNetworkAddress& aAddress,
00617                                                int32 aTimeoutMsec = -1);
00618 
00627         OSCL_IMPORT_REF void CancelConnect();
00628 
00642         OSCL_IMPORT_REF TPVSocketEvent Shutdown(TPVSocketShutdown aHow,
00643                                                 int32 aTimeoutMsec = -1);
00644 
00653         OSCL_IMPORT_REF void CancelShutdown();
00654 
00667         OSCL_IMPORT_REF TPVSocketEvent Accept(int32 aTimeout = -1);
00668 
00677         OSCL_IMPORT_REF void CancelAccept();
00678 
00693         OSCL_IMPORT_REF TPVSocketEvent Send(const uint8* aPtr, uint32 aLen,
00694                                             int32 aTimeoutMsec = -1);
00695 
00704         OSCL_IMPORT_REF void CancelSend();
00705 
00720         OSCL_IMPORT_REF TPVSocketEvent Recv(uint8* aPtr, uint32 aMaxLen,
00721                                             int32 aTimeoutMsec = -1);
00722 
00731         OSCL_IMPORT_REF void CancelRecv();
00732 
00733     private:
00734         static OsclTCPSocket *NewL(Oscl_DefAlloc &alloc, OsclTCPSocketI* aSocket);
00735 
00736     private:
00737         OsclTCPSocket(Oscl_DefAlloc &alloc): iTCPSocket(NULL), iAlloc(alloc) {}
00738         OsclTCPSocketI *iTCPSocket;
00739         Oscl_DefAlloc &iAlloc;
00740 };
00741 
00742 #endif
00743 
00744 

OSCL API
Posting Version: CORE_8.000.1.1_RC4