20
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Declaration of the server side main class CATStorageServer
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef ATSTORAGESERVER_H
|
|
20 |
#define ATSTORAGESERVER_H
|
|
21 |
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <analyzetool/atcommon.h>
|
|
26 |
#include "atdllinfo.h"
|
|
27 |
|
|
28 |
// CONSTANTS
|
|
29 |
// Constants for the server's version
|
|
30 |
const TUint KVersionNumberMaj = 0;
|
|
31 |
const TUint KVersionNumberMin = 1;
|
|
32 |
const TUint KVersionNumberBld = 1;
|
|
33 |
|
|
34 |
// DATA TYPES
|
|
35 |
|
|
36 |
// FORWARD DECLARATIONS
|
|
37 |
class TATProcessInfo;
|
|
38 |
class CATDynProcessInfo;
|
|
39 |
class CATStorageServerSession;
|
|
40 |
|
|
41 |
// CLASS DECLARATION
|
|
42 |
|
|
43 |
/**
|
|
44 |
* The main class of the Storage Server.
|
|
45 |
* When a client connects to the server, a new session object
|
|
46 |
* is created by an object of this class. If the server does not exist when
|
|
47 |
* connecting, a new process and an object of this class are created first.
|
|
48 |
*/
|
|
49 |
class CATStorageServer : public CPolicyServer
|
|
50 |
{
|
|
51 |
|
|
52 |
public: // Enumerations
|
|
53 |
|
|
54 |
// opcodes used in message passing between client and server
|
|
55 |
enum TStorageServerReq
|
|
56 |
{
|
|
57 |
EProcessStarted,
|
|
58 |
EDllLoaded,
|
|
59 |
EDllUnloaded,
|
|
60 |
EMemoryAllocated,
|
|
61 |
EMemoryFreed,
|
|
62 |
EProcessEnded,
|
|
63 |
EMemoryCheck,
|
|
64 |
EGetProcesses,
|
|
65 |
EGetDlls,
|
|
66 |
ESetLoggingMode,
|
|
67 |
EGetLoggingMode,
|
|
68 |
ESubtestStart,
|
|
69 |
ESubtestStop,
|
|
70 |
ESubtestStart2,
|
|
71 |
ESubtestStop2,
|
|
72 |
EGetCurrentAllocs,
|
|
73 |
EGetMaxAllocs,
|
|
74 |
ECancelLogging,
|
|
75 |
EGetUdeb,
|
|
76 |
EGetLoggingFile,
|
|
77 |
EProcessUdeb,
|
|
78 |
EIsMemoryAdded,
|
|
79 |
EOutOfBounds
|
|
80 |
};
|
|
81 |
|
|
82 |
|
|
83 |
public: // Constructors and destructor
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Two-phased constructor that can leave.
|
|
87 |
* @return A new instance of this class
|
|
88 |
*/
|
|
89 |
static CATStorageServer* NewL();
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Two-phased constructor that can leave and leaves a pointer
|
|
93 |
* on the cleanup stack.
|
|
94 |
* @return A new instance of this class
|
|
95 |
*/
|
|
96 |
static CATStorageServer* NewLC();
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Destructor
|
|
100 |
*/
|
|
101 |
virtual ~CATStorageServer();
|
|
102 |
|
|
103 |
public: // New functions
|
|
104 |
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Creates a new server object and starts the server.
|
|
108 |
*/
|
|
109 |
static void RunServerL();
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Increments the count of active sessions for this server.
|
|
113 |
*/
|
|
114 |
void IncSessionCount();
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Decrements the count of active sessions for this server.
|
|
118 |
*/
|
|
119 |
void DecSessionCount();
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Adds a new process into the server's arrays.
|
|
123 |
* @param aProcessName The name of the process to be added.
|
|
124 |
* @param aProcessId The ID of the process to be added.
|
|
125 |
* @param aSessionObject A pointer to the current process's associated session
|
|
126 |
* object.
|
|
127 |
* @param aStartTime The starting time of the process to be added. It represents
|
|
128 |
* time as a number of microseconds since midnight, January 1st, 0 AD nominal
|
|
129 |
* Gregorian. This is the representation used by, e.g., the TTime class.
|
|
130 |
* @return KErrNone, if the operation is successful; KErrAlreadyExists, if
|
|
131 |
* an attempt is being made to insert a duplicate process; otherwise one of
|
|
132 |
* the other system wide error codes.
|
|
133 |
*/
|
|
134 |
TInt AddProcessL( const TDesC8& aProcessName,
|
|
135 |
TUint aProcessId,
|
|
136 |
CATStorageServerSession* aSessionObject,
|
|
137 |
const TInt64& aStartTime );
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Removes a process from the server's arrays.
|
|
141 |
* @param aProcessId The ID of the process to be removed.
|
|
142 |
* @return KErrNone, if successful; KErrNotFound, if a process with
|
|
143 |
* the specified process ID could not be found in the array.
|
|
144 |
*/
|
|
145 |
TInt RemoveProcessL( TUint aProcessId );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Adds a DLL for a given process to the dynamic process info array of this class.
|
|
149 |
* @param aProcessId The ID of the process that has loaded the DLL to be added.
|
|
150 |
* @param aDllInfo Information of the DLL.
|
|
151 |
* @return KErrNone, if successful; KErrNotFound, if a process with the given
|
|
152 |
* process ID could not be found; KErrAlreadyExists, if a DLL with the given
|
|
153 |
* name was already stored; otherwise one of the other system wide error codes.
|
|
154 |
*/
|
|
155 |
TInt AddDllL( TUint aProcessId, const TATDllInfo aDllInfo );
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Removes a DLL associated with the given process from the dynamic process
|
|
159 |
* info array of this class.
|
|
160 |
* @param aProcessId The ID of the process that has loaded the DLL to be removed.
|
|
161 |
* @param aDllName The name of the DLL to be removed.
|
|
162 |
* @return KErrNone, if successful; KErrNotFound, if a process with
|
|
163 |
* the specified process ID could not be found, or if a DLL with the specified
|
|
164 |
* name could not be found.
|
|
165 |
*/
|
|
166 |
TInt RemoveDllL( TUint aProcessId, const TDesC8& aDllName );
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Gives a reference to the process info array of this class.
|
|
170 |
* @return A reference to iProcesses array
|
|
171 |
*/
|
|
172 |
const RArray<TATProcessInfo>& ProcessInfoArray();
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Gives a reference to the dynamic process info array of this class.
|
|
176 |
* @return A reference to iProcessesDyn array
|
|
177 |
*/
|
|
178 |
const RPointerArray<CATDynProcessInfo>& DynProcessInfoArray();
|
|
179 |
|
|
180 |
public: // Functions from base classes
|
|
181 |
|
|
182 |
/**
|
|
183 |
* From CPolicyServer.
|
|
184 |
* Creates a new server-side session object.
|
|
185 |
* @param aVersion The version of this server
|
|
186 |
* @param aMessage A message from the client
|
|
187 |
* @return A pointer to a new session object.
|
|
188 |
*/
|
|
189 |
CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
|
|
190 |
|
|
191 |
private:
|
|
192 |
|
|
193 |
/**
|
|
194 |
* C++ default constructor.
|
|
195 |
* @param aPriority A priority for this active object
|
|
196 |
*/
|
|
197 |
CATStorageServer( TInt aPriority );
|
|
198 |
|
|
199 |
/**
|
|
200 |
* Symbian 2nd phase constructor.
|
|
201 |
*/
|
|
202 |
void ConstructL();
|
|
203 |
|
|
204 |
private: // Data
|
|
205 |
|
|
206 |
/** The number of active sessions */
|
|
207 |
TInt iSessionCount;
|
|
208 |
|
|
209 |
/** An array for storing TATProcessInfo objects */
|
|
210 |
RArray<TATProcessInfo> iProcesses;
|
|
211 |
|
|
212 |
/** An array for storing CATDynProcessInfo pointers */
|
|
213 |
RPointerArray<CATDynProcessInfo> iProcessesDyn;
|
|
214 |
};
|
|
215 |
|
|
216 |
#endif // ATSTORAGESERVER_H
|
|
217 |
|
|
218 |
// End of File |