messagingfw/msgtest/testutils/MsgTestUtilServer/inc/MessagingTestUtilityServer.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2004-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 //
       
    15 
       
    16 
       
    17 #ifndef __MESSAGINGTESTUTILITYSERVER_H__
       
    18 #define __MESSAGINGTESTUTILITYSERVER_H__
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <f32file.h>
       
    22 #include "messagingtestutility.h"
       
    23 
       
    24 
       
    25 enum TTestPanic
       
    26 	{
       
    27 	ETestPanicBadDescriptor,
       
    28 	ETestPanicIllegalFunction,
       
    29 	ETestPanicAlreadyReceiving
       
    30 	};
       
    31 
       
    32 void PanicClient(RMessage2& aMessage,TTestPanic TMyPanic);
       
    33 
       
    34 class CShutdown : public CTimer
       
    35 	{
       
    36 	enum {KMyShutdownDelay=0x200000};	// approx 2s
       
    37 public:
       
    38 	inline CShutdown();
       
    39 	inline void ConstructL();
       
    40 	inline void Start();
       
    41 private:
       
    42 	void RunL();
       
    43 	};
       
    44 
       
    45 
       
    46 class CMessagingTestUtilityServer : public CServer2
       
    47 	{
       
    48 public:
       
    49 	static CServer2* NewLC();
       
    50 	void AddSession();
       
    51 	void DropSession();
       
    52 private:
       
    53 	CMessagingTestUtilityServer();
       
    54 	void ConstructL();
       
    55 	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
    56 private:
       
    57 	TInt iSessionCount;
       
    58 	CShutdown iShutdown;
       
    59 	};
       
    60 
       
    61 
       
    62 class CMessagingTestUtilitySession : public CSession2
       
    63 	{
       
    64 public:
       
    65 	CMessagingTestUtilitySession();
       
    66 	void CreateL();
       
    67 private:
       
    68 	~CMessagingTestUtilitySession();
       
    69 	inline CMessagingTestUtilityServer& Server();
       
    70 	void ServiceL(const RMessage2& aMessage);
       
    71 	void ServiceError(const RMessage2& aMessage,TInt aError);
       
    72 	inline TBool ReceivePending() const;
       
    73 private:
       
    74 	TInt DoDeleteMessageStoreL(const RMessage2& aMessage);
       
    75 	TInt DoKillProcessL(const RMessage2& aMessage);
       
    76 	TInt DoCopyFileL(const RMessage2& aMessage);
       
    77 	TInt DoDeleteFileL(const RMessage2& aMessage);
       
    78 	TInt DoMkDirL(const RMessage2& aMessage);
       
    79 	TInt DoRmDirL(const RMessage2& aMessage);
       
    80 	TInt DoGetDirL(const RMessage2& aMessage);
       
    81 	TInt DoGetDirCountL(const RMessage2& aMessage);
       
    82 	TInt DoGetDirEntryL(const RMessage2& aMessage);
       
    83 	TInt DoFileExistsL(const RMessage2& aMessage);
       
    84 private:
       
    85 	RFs iFs;
       
    86 	CDir* iDir;
       
    87 	};
       
    88 
       
    89 #endif //__MESSAGINGTESTUTILITYSERVER__