diff -r 6a20128ce557 -r ebfee66fde93 email/pop3andsmtpmtm/imapservermtm/test/inc/ImapSpoofServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/email/pop3andsmtpmtm/imapservermtm/test/inc/ImapSpoofServer.h Fri Jun 04 10:25:39 2010 +0100 @@ -0,0 +1,74 @@ +// 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: +// imapserver.h +// +// + +#ifndef __IMAPSPOOFSERVER_H__ +#define __IMAPSPOOFSERVER_H__ + +#include +#include +#include +#include +#include "scriptfileprocessor.h" +#include "eventhandler.h" + +// Definitions +const TInt KMaxBufferSize = 2048; +const TInt KListeningSocketQueueSize = 1; + +// +// CImapSpoofServer +// + +class CImapSpoofServer : public CActive + { + +public: + + IMPORT_C static CImapSpoofServer* NewL(MImapTestEventHandler* aOwner,const TDesC& aScriptFile); + IMPORT_C static CImapSpoofServer* NewLC(MImapTestEventHandler* aOwner,const TDesC& aScriptFile); + void StartL(); + ~CImapSpoofServer(); +private: + CImapSpoofServer(); + void ConstructL(MImapTestEventHandler* aOwner,const TDesC& aScriptFile); + void IssueWrite(); + void IssueRead(); + //Implemented functions from CActive + virtual void DoCancel(); + virtual void RunL(); + virtual IMPORT_C TInt RunError(TInt aError); + +private: + + enum TIMAPServerState + { + EIdle, EWriting, EReading + }; + + TIMAPServerState iServerStatus; + RSocket iListeningSocket; + RSocket iServiceSocket; + RSocketServ iSocketServer; + TBuf8 iBuffer; + TBuf8 iNextLine; + TSockXfrLength iReadLength; + CScriptFileProcessor* iScriptFileProcessor; + MImapTestEventHandler* iOwner; + }; + +#endif //__IMAPSPOOFSERVER_H__ +