sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test/mmu/t_shbuf_perfserver.h sl@0: // sl@0: // sl@0: sl@0: #ifndef _T_SHBUF_PERFSERVER_H_ sl@0: #define _T_SHBUF_PERFSERVER_H_ sl@0: sl@0: /** sl@0: * @file sl@0: * sl@0: * Test server used for Performance Testing of shared buffers. sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #include "d_shbuf.h" sl@0: sl@0: class RShBuf; sl@0: sl@0: /** sl@0: * Name of the server. The '!' means it is a protected server. sl@0: */ sl@0: _LIT(KRShBufTestServerName, "!RShBufServer"); sl@0: sl@0: sl@0: /** sl@0: * Server IPC requests. sl@0: */ sl@0: enum TShBufServerRequest sl@0: { sl@0: EShBufServerSendBuffer, sl@0: EShBufServerReceiveBuffer, sl@0: EShBufServerSendAndReceiveBuffer, sl@0: EShBufServerSendSharedBuffer, sl@0: EShBufServerReceiveSharedBuffer, sl@0: EShBufServerSendAndReceiveSharedBuffer, sl@0: EShBufServerShutdownServer, sl@0: EShBufServerFromTPtr8ProcessAndReturn, sl@0: EShBufServerFromTPtr8ProcessAndRelease, sl@0: EShBufServerOpenRShBufPool, sl@0: EShBufServerCloseRShBufPool, sl@0: EShBufServerFromRShBufProcessAndReturn, sl@0: EShBufServerFromRShBufProcessAndRelease, sl@0: EShBufServerDbgMarkHeap, sl@0: EShBufServerDbgCheckHeap, sl@0: EShBufServerDbgMarkEnd, sl@0: EShBufServerDbgFailNext sl@0: }; sl@0: sl@0: sl@0: class CShBufTestServerSession; sl@0: sl@0: sl@0: /** sl@0: * The RShBuf test server class. sl@0: * sl@0: * The class provides all the services required by class CShBufTestServerSession. sl@0: */ sl@0: class CShBufTestServer : public CServer2 sl@0: { sl@0: public: sl@0: static CShBufTestServer* NewL(); sl@0: sl@0: void AddSessionL(CShBufTestServerSession* aSession); sl@0: void DropSession(CShBufTestServerSession* aSession); sl@0: sl@0: TInt FromTPtr8ProcessAndReturn(TDes8& aBuf, TUint aBufSize); sl@0: TInt FromTPtr8ProcessAndRelease(TDes8& aBuf); sl@0: sl@0: TInt OpenRShBufPool(TInt aHandle, const TShPoolInfo& aPoolInfo); sl@0: TInt CloseRShBufPool(); sl@0: TInt FromRShBufProcessAndReturn(RShBuf& aShBuf, TUint aBufSize); sl@0: TInt FromRShBufProcessAndRelease(RShBuf& aShBuf); sl@0: sl@0: TInt DbgMarkHeap() const; sl@0: TInt DbgCheckHeap(TInt aCount) const; sl@0: TInt DbgMarkEnd(TInt aCount) const; sl@0: TInt DbgFailNext(TInt aCount) const; sl@0: sl@0: TInt ShutdownServer(); sl@0: sl@0: private: sl@0: CShBufTestServer(); sl@0: ~CShBufTestServer(); sl@0: sl@0: void ConstructL(); sl@0: sl@0: CSession2* NewSessionL(const TVersion& aVersion,const RMessage2&/*aMessage*/) const; sl@0: TInt RunError(TInt aError); sl@0: sl@0: RPointerArray iSessionArray; sl@0: sl@0: // sl@0: // Variables to control shutdown of the server... sl@0: // sl@0: TBool iShouldShutdownServer; sl@0: sl@0: // sl@0: // Handle to the driver... sl@0: // sl@0: RShBufTestChannel iShBufLdd; sl@0: TUint8 iClearCache[32768]; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: * This is the Phonebook Sync Server side session class and is responsible sl@0: * for handling the client (RPhoneBookSession) requests, encoding/decoding sl@0: * the parameters and Contacts Item phonebook data across the API. sl@0: * Once the parameters are decoded the request is sent to the server where sl@0: * it will either be handled directly or forwarded to the Background Sync sl@0: * Engine. Once the request is completed, any return parameters are written sl@0: * back to the client if neccessary. sl@0: */ sl@0: class CShBufTestServerSession : public CSession2 sl@0: { sl@0: public: sl@0: void CreateL(); sl@0: void CompleteRequest(const RMessage2& aMessage, TInt aResult) const; sl@0: sl@0: inline CShBufTestServer& Server(); sl@0: sl@0: private: sl@0: ~CShBufTestServerSession(); sl@0: sl@0: void ServiceL(const RMessage2& aMessage); sl@0: sl@0: void ShutdownServerL(const RMessage2& aMessage); sl@0: sl@0: void FromTPtr8ProcessAndReturnL(const RMessage2& aMessage); sl@0: void FromTPtr8ProcessAndReleaseL(const RMessage2& aMessage); sl@0: sl@0: void OpenRShBufPoolL(const RMessage2& aMessage); sl@0: void CloseRShBufPoolL(const RMessage2& aMessage); sl@0: void FromRShBufProcessAndReturnL(const RMessage2& aMessage); sl@0: void FromRShBufProcessAndReleaseL(const RMessage2& aMessage); sl@0: sl@0: void DbgMarkHeapL(const RMessage2& aMessage); sl@0: void DbgCheckHeapL(const RMessage2& aMessage); sl@0: void DbgMarkEndL(const RMessage2& aMessage); sl@0: void DbgFailNextL(const RMessage2& aMessage); sl@0: sl@0: private: sl@0: TUint8 iSessionTempBuffer[8192]; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: * Returns a reference to the CPhoneBookServer class. sl@0: */ sl@0: inline CShBufTestServer& CShBufTestServerSession::Server() sl@0: { sl@0: return *static_cast(const_cast(CSession2::Server())); sl@0: } // CShBufTestServerSession::Server sl@0: sl@0: sl@0: #ifndef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS sl@0: TInt RShBufTestServerThread(TAny* aPtr); sl@0: #endif sl@0: sl@0: sl@0: #endif // _T_SHBUF_PERFSERVER_H_ sl@0: