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

oscl_socket_serv_imp_reqlist.h

Go to the documentation of this file.
00001 
00002 #ifndef OSCL_SOCKET_SERV_IMP_REQLIST_H_INCLUDED
00003 #define OSCL_SOCKET_SERV_IMP_REQLIST_H_INCLUDED
00004 
00005 #include "oscl_socket_tuneables.h"
00006 #include "oscl_defalloc.h"
00007 #include "oscl_vector.h"
00008 #include "oscl_mem.h"
00009 
00010 #if PV_SOCKET_SERVER_IS_THREAD
00011 #include "oscl_semaphore.h"
00012 #include "oscl_mutex.h"
00013 #endif
00014 
00015 class OsclSocketServI;
00016 template<class T>class OsclSocketQueue;
00017 class OsclSocketI;
00018 class OsclSocketRequest;
00019 
00020 class OsclSocketServRequestQElem
00021 {
00022     public:
00023         OsclSocketServRequestQElem(OsclSocketRequest* r)
00024                 : iSocketRequest(r)
00025                 , iSelect(0)
00026                 , iCancel(false)
00027         {}
00028 
00029         OsclSocketRequest* iSocketRequest;
00030         uint8 iSelect;
00031         bool iCancel;
00032 };
00033 
00036 class OsclSocketServRequestList
00037 {
00038     public:
00039         OsclSocketServRequestList();
00040         void Add(OsclSocketRequest *);
00041         void StartCancel(OsclSocketRequest *);
00042         void Open(OsclSocketServI*s);
00043         void Close();
00044         void Wakeup();
00045         void WaitOnRequests();
00046         void Remove(OsclSocketServRequestQElem* aElem)
00047         {
00048             aElem->iSocketRequest = NULL;
00049         }
00050 
00051     private:
00052         //a queue of the active sockets.
00053         Oscl_Vector<OsclSocketServRequestQElem, OsclMemAllocator> iActiveRequests;
00054 
00055 #if PV_SOCKET_SERVER_IS_THREAD
00056         //thread protection
00057         OsclMutex iCrit;
00058         OsclSemaphore iSem;
00059 #endif
00060 
00061         OsclSocketServI *iContainer;
00062 
00063         //input queues for requests from the app side.  requests
00064         //are picked up by server thread, so these queues need
00065         //to be used with thread locks.
00066         Oscl_Vector<OsclSocketRequest*, OsclMemAllocator> iAddRequests;
00067         Oscl_Vector<OsclSocketRequest*, OsclMemAllocator> iCancelRequests;
00068         void GetNewRequests();
00069         void Lock();
00070         void Unlock();
00071 
00072         friend class OsclSocketServI;
00073 };
00074 
00075 
00076 #endif
00077 
00078 
00079 

OSCL API
Posting Version: CORE_8.000.1.1_RC4