diff -r 9f5ae1728557 -r db3f5fa34ec7 messagingfw/msgtest/tools/spoofserver/inc/CSpoofServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/msgtest/tools/spoofserver/inc/CSpoofServer.h Wed Nov 03 22:41:46 2010 +0530 @@ -0,0 +1,70 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "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 __CSPOOFSERVER_H__ +#define __CSPOOFSERVER_H__ + +#include +#include "cscriptfileprocessor.h" + +// Definitions +const TInt KNextLineBufferSize = 2048; +const TInt KCurrentBufferSize = KNextLineBufferSize + 2; + +class MImapTestEventHandler + { +public: + virtual void TestComplete(TInt aErrorCode)=0; + }; + +class CSpoofServer : public CActive + { + +public: + IMPORT_C static CSpoofServer* NewL(MImapTestEventHandler& aObserver,const TDesC& aScriptFile); + IMPORT_C static CSpoofServer* NewLC(MImapTestEventHandler& aObserver,const TDesC& aScriptFile); + IMPORT_C void StartL(const TInt aPortNumber); + ~CSpoofServer(); + +private: + CSpoofServer(MImapTestEventHandler& aObserver); + void ConstructL(const TDesC& aScriptFile); + void IssueWrite(); + void IssueRead(); + //implemented functions from CActive + virtual void DoCancel(); + virtual void RunL(); + virtual TInt RunError(TInt aError); + +private: + enum TIMAPServerState + { + EIdle=0, + EWriting, + EReading + }; + TIMAPServerState iServerStatus; + RSocket iListeningSocket; + RSocket iServiceSocket; + RSocketServ iSocketServer; + TBuf8 iBuffer; + TBuf8 iNextLine; + TSockXfrLength iReadLength; + CScriptFileProcessor* iScriptFileProcessor; + MImapTestEventHandler& iObserver; + }; + +#endif //__CSPOOFSERVER_H__ +