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

oscl_dns_method.h

Go to the documentation of this file.
00001 
00002 #ifndef OSCL_DNS_METHOD_H_INCLUDED
00003 #define OSCL_DNS_METHOD_H_INCLUDED
00004 
00005 #include "osclconfig_io.h"
00006 #include "oscl_socket_types.h"
00007 #include "oscl_scheduler_ao.h"
00008 #include "oscl_dns.h"
00009 #include "pvlogger.h"
00010 
00011 class OsclDNSObserver;
00012 class OsclDNSRequestAO;
00013 class OsclSocketServ;
00014 class OsclDNSI;
00015 class OsclDNS;
00016 
00020 class OsclDNSMethod : public OsclTimerObject
00021 {
00022     public:
00023         OsclDNSMethod(Oscl_DefAlloc &a, const char *name, TPVDNSFxn fxn)
00024                 : OsclTimerObject(OsclActiveObject::EPriorityNominal, name)
00025                 , iDNSObserver(NULL)
00026                 , iId(0)
00027                 , iAlloc(a)
00028                 , iDNSFxn(fxn)
00029                 , iDNSRequestAO(NULL)
00030         {
00031             iLogger = PVLogger::GetLoggerObject("oscldns");
00032         }
00033 
00034         void Abort();
00035         void AbortAll();
00036         void CancelMethod();
00037         void Run();
00038 
00039         OsclDNSObserver *iDNSObserver;
00040         uint32 iId;
00041         Oscl_DefAlloc &iAlloc;
00042         TPVDNSFxn iDNSFxn;
00043         PVLogger* iLogger;
00044 
00045     protected:
00046         void ConstructL(
00047             OsclDNSObserver*aObserver,
00048             OsclDNSRequestAO *aAO,
00049             uint32 aId);
00050 
00051         bool StartMethod(int32 aTimeoutMsec);
00052         void MethodDone();
00053 
00054         OsclDNSRequestAO *iDNSRequestAO;
00055 };
00056 
00057 
00061 class OsclDNSRequestAO : public OsclActiveObject
00062 {
00063     protected:
00064 
00065         OsclDNSRequestAO(const char *name)
00066                 : OsclActiveObject(OsclActiveObject::EPriorityNominal, name)
00067                 , iDNSI(NULL)
00068                 , iDNSMethod(NULL)
00069                 , iSocketError(0)
00070         {
00071         }
00072 
00073         void ConstructL(
00074             OsclDNSI *aDNS,
00075             OsclDNSMethod *aMethod)
00076         {
00077             if (!aMethod)
00078                 OsclError::Leave(OsclErrGeneral);
00079             iDNSMethod = aMethod;
00080             iLogger = iDNSMethod->iLogger;
00081             if (!aDNS)
00082                 OsclError::Leave(OsclErrGeneral);
00083             iDNSI = aDNS;
00084         }
00085 
00086         void Abort()
00087         {
00088             Cancel();
00089             RemoveFromScheduler();
00090         }
00091         void NewRequest();
00092         void RequestDone();
00093         int GetSocketError();
00094         OsclSocketServI *Serv();
00095         void DoCancel();
00096         void Run();
00097 
00098         virtual void Success() {}
00099         virtual void Failure() {}
00100         virtual void Cancelled() {}
00101 
00102         OsclDNSI *iDNSI;
00103         OsclDNSMethod *iDNSMethod;
00104         int32 iSocketError;
00105         PVLogger* iLogger;
00106 
00107         friend class OsclDNSI;
00108         friend class OsclDNSMethod;
00109         friend class OsclDNSRequest;
00110         friend class GetHostByNameParam;
00111 };
00112 
00113 #endif
00114 

OSCL API
Posting Version: CORE_8.000.1.1_RC4