|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // imapserver.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __IMAPSPOOFSERVER_H__ |
|
19 #define __IMAPSPOOFSERVER_H__ |
|
20 |
|
21 #include <e32cons.h> |
|
22 #include <e32const.h> |
|
23 #include <in_sock.h> |
|
24 #include <nifman.h> |
|
25 #include "scriptfileprocessor.h" |
|
26 #include "eventhandler.h" |
|
27 |
|
28 // Definitions |
|
29 const TInt KMaxBufferSize = 2048; |
|
30 const TInt KListeningSocketQueueSize = 1; |
|
31 |
|
32 // |
|
33 // CImapSpoofServer |
|
34 // |
|
35 |
|
36 class CImapSpoofServer : public CActive |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 IMPORT_C static CImapSpoofServer* NewL(MImapTestEventHandler* aOwner,const TDesC& aScriptFile); |
|
42 IMPORT_C static CImapSpoofServer* NewLC(MImapTestEventHandler* aOwner,const TDesC& aScriptFile); |
|
43 void StartL(); |
|
44 ~CImapSpoofServer(); |
|
45 private: |
|
46 CImapSpoofServer(); |
|
47 void ConstructL(MImapTestEventHandler* aOwner,const TDesC& aScriptFile); |
|
48 void IssueWrite(); |
|
49 void IssueRead(); |
|
50 //Implemented functions from CActive |
|
51 virtual void DoCancel(); |
|
52 virtual void RunL(); |
|
53 virtual IMPORT_C TInt RunError(TInt aError); |
|
54 |
|
55 private: |
|
56 |
|
57 enum TIMAPServerState |
|
58 { |
|
59 EIdle, EWriting, EReading |
|
60 }; |
|
61 |
|
62 TIMAPServerState iServerStatus; |
|
63 RSocket iListeningSocket; |
|
64 RSocket iServiceSocket; |
|
65 RSocketServ iSocketServer; |
|
66 TBuf8<KMaxBufferSize> iBuffer; |
|
67 TBuf8<KMaxBufferSize> iNextLine; |
|
68 TSockXfrLength iReadLength; |
|
69 CScriptFileProcessor* iScriptFileProcessor; |
|
70 MImapTestEventHandler* iOwner; |
|
71 }; |
|
72 |
|
73 #endif //__IMAPSPOOFSERVER_H__ |
|
74 |