diff -r 675a964f4eb5 -r 35751d3474b7 cryptomgmtlibs/securitytestfw/test/sntpclient/sntpclientengine.h --- a/cryptomgmtlibs/securitytestfw/test/sntpclient/sntpclientengine.h Tue Jul 21 01:04:32 2009 +0100 +++ b/cryptomgmtlibs/securitytestfw/test/sntpclient/sntpclientengine.h Thu Sep 10 14:01:51 2009 +0300 @@ -1,107 +1,107 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef __SNTPCLIENTENGINE_H__ -#define __SNTPCLIENTENGINE_H__ - -#include -#include -#include - -#include "commandlineargs.h" - -enum TSNTPClientState { - EStateIdle = 0, - EStateResolve, - EStateWrite, - EStateRead, - EStateComplete, - EStateFailed, - EStateAborted - }; - -class MTimeOutNotify - { -public: - virtual void TimerExpired() = 0; - }; - -// timeout handler - -class CTimeOutTimer: public CTimer - { -public: - static CTimeOutTimer* NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify); - ~CTimeOutTimer(); - -protected: - CTimeOutTimer(const TInt aPriority); - void ConstructL(MTimeOutNotify& aTimeOutNotify); - virtual void RunL(); - -private: - MTimeOutNotify* iNotify; - }; - -// The main client engine - -class CSNTPClient : public CActive, public MTimeOutNotify - { - -public: - static CSNTPClient* NewL(TCommandLineArgs& aArgs); - static CSNTPClient* NewLC(TCommandLineArgs& aArgs); - - TSNTPClientState State(); - void Start(); - - ~CSNTPClient(); - -private: - CSNTPClient(TCommandLineArgs& aArgs); - - void ConstructL(); - - /* CActive methods */ - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - - /* MTimeOutNotify methods */ - void TimerExpired(); - - void SetTimeL(); - -private: - RSocketServ iSockServ; - RSocket iSock; - RHostResolver iResolver; - - TCommandLineArgs& iArgs; - TSNTPClientState iState; - TNameEntry iNameEntry; - - CTimeOutTimer* iTimer; - - // An NTP packet is exactly 48 bytes - TBuf8<48> iBuffer; - - TInt iServerIndex; - }; - - - -#endif /* _SNTPCLIENTENGINE_H__ */ +#ifndef __SNTPCLIENTENGINE_H__ +#define __SNTPCLIENTENGINE_H__/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include + +#include "commandlineargs.h" + +enum TSNTPClientState { + EStateIdle = 0, + EStateResolve, + EStateWrite, + EStateRead, + EStateComplete, + EStateFailed, + EStateAborted + }; + +class MTimeOutNotify + { +public: + virtual void TimerExpired() = 0; + }; + +// timeout handler + +class CTimeOutTimer: public CTimer + { +public: + static CTimeOutTimer* NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify); + ~CTimeOutTimer(); + +protected: + CTimeOutTimer(const TInt aPriority); + void ConstructL(MTimeOutNotify& aTimeOutNotify); + virtual void RunL(); + +private: + MTimeOutNotify* iNotify; + }; + +// The main client engine + +class CSNTPClient : public CActive, public MTimeOutNotify + { + +public: + static CSNTPClient* NewL(TCommandLineArgs& aArgs); + static CSNTPClient* NewLC(TCommandLineArgs& aArgs); + + TSNTPClientState State(); + void Start(); + + ~CSNTPClient(); + +private: + CSNTPClient(TCommandLineArgs& aArgs); + + void ConstructL(); + + /* CActive methods */ + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + + /* MTimeOutNotify methods */ + void TimerExpired(); + + void SetTimeL(); + +private: + RSocketServ iSockServ; + RSocket iSock; + RHostResolver iResolver; + + TCommandLineArgs& iArgs; + TSNTPClientState iState; + TNameEntry iNameEntry; + + CTimeOutTimer* iTimer; + + // An NTP packet is exactly 48 bytes + TBuf8<48> iBuffer; + + TInt iServerIndex; + }; + + + +#endif /* _SNTPCLIENTENGINE_H__ */