First public contribution.
1 // Copyright (c) 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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test/mmu/t_shbuf_perfserver.h
18 #ifndef _T_SHBUF_PERFSERVER_H_
19 #define _T_SHBUF_PERFSERVER_H_
24 * Test server used for Performance Testing of shared buffers.
35 * Name of the server. The '!' means it is a protected server.
37 _LIT(KRShBufTestServerName, "!RShBufServer");
41 * Server IPC requests.
43 enum TShBufServerRequest
45 EShBufServerSendBuffer,
46 EShBufServerReceiveBuffer,
47 EShBufServerSendAndReceiveBuffer,
48 EShBufServerSendSharedBuffer,
49 EShBufServerReceiveSharedBuffer,
50 EShBufServerSendAndReceiveSharedBuffer,
51 EShBufServerShutdownServer,
52 EShBufServerFromTPtr8ProcessAndReturn,
53 EShBufServerFromTPtr8ProcessAndRelease,
54 EShBufServerOpenRShBufPool,
55 EShBufServerCloseRShBufPool,
56 EShBufServerFromRShBufProcessAndReturn,
57 EShBufServerFromRShBufProcessAndRelease,
58 EShBufServerDbgMarkHeap,
59 EShBufServerDbgCheckHeap,
60 EShBufServerDbgMarkEnd,
61 EShBufServerDbgFailNext
65 class CShBufTestServerSession;
69 * The RShBuf test server class.
71 * The class provides all the services required by class CShBufTestServerSession.
73 class CShBufTestServer : public CServer2
76 static CShBufTestServer* NewL();
78 void AddSessionL(CShBufTestServerSession* aSession);
79 void DropSession(CShBufTestServerSession* aSession);
81 TInt FromTPtr8ProcessAndReturn(TDes8& aBuf, TUint aBufSize);
82 TInt FromTPtr8ProcessAndRelease(TDes8& aBuf);
84 TInt OpenRShBufPool(TInt aHandle, const TShPoolInfo& aPoolInfo);
85 TInt CloseRShBufPool();
86 TInt FromRShBufProcessAndReturn(RShBuf& aShBuf, TUint aBufSize);
87 TInt FromRShBufProcessAndRelease(RShBuf& aShBuf);
89 TInt DbgMarkHeap() const;
90 TInt DbgCheckHeap(TInt aCount) const;
91 TInt DbgMarkEnd(TInt aCount) const;
92 TInt DbgFailNext(TInt aCount) const;
94 TInt ShutdownServer();
102 CSession2* NewSessionL(const TVersion& aVersion,const RMessage2&/*aMessage*/) const;
103 TInt RunError(TInt aError);
105 RPointerArray<CShBufTestServerSession> iSessionArray;
108 // Variables to control shutdown of the server...
110 TBool iShouldShutdownServer;
113 // Handle to the driver...
115 RShBufTestChannel iShBufLdd;
116 TUint8 iClearCache[32768];
121 * This is the Phonebook Sync Server side session class and is responsible
122 * for handling the client (RPhoneBookSession) requests, encoding/decoding
123 * the parameters and Contacts Item phonebook data across the API.
124 * Once the parameters are decoded the request is sent to the server where
125 * it will either be handled directly or forwarded to the Background Sync
126 * Engine. Once the request is completed, any return parameters are written
127 * back to the client if neccessary.
129 class CShBufTestServerSession : public CSession2
133 void CompleteRequest(const RMessage2& aMessage, TInt aResult) const;
135 inline CShBufTestServer& Server();
138 ~CShBufTestServerSession();
140 void ServiceL(const RMessage2& aMessage);
142 void ShutdownServerL(const RMessage2& aMessage);
144 void FromTPtr8ProcessAndReturnL(const RMessage2& aMessage);
145 void FromTPtr8ProcessAndReleaseL(const RMessage2& aMessage);
147 void OpenRShBufPoolL(const RMessage2& aMessage);
148 void CloseRShBufPoolL(const RMessage2& aMessage);
149 void FromRShBufProcessAndReturnL(const RMessage2& aMessage);
150 void FromRShBufProcessAndReleaseL(const RMessage2& aMessage);
152 void DbgMarkHeapL(const RMessage2& aMessage);
153 void DbgCheckHeapL(const RMessage2& aMessage);
154 void DbgMarkEndL(const RMessage2& aMessage);
155 void DbgFailNextL(const RMessage2& aMessage);
158 TUint8 iSessionTempBuffer[8192];
163 * Returns a reference to the CPhoneBookServer class.
165 inline CShBufTestServer& CShBufTestServerSession::Server()
167 return *static_cast<CShBufTestServer*>(const_cast<CServer2*>(CSession2::Server()));
168 } // CShBufTestServerSession::Server
171 #ifndef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
172 TInt RShBufTestServerThread(TAny* aPtr);
176 #endif // _T_SHBUF_PERFSERVER_H_