28
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2010 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: CCCHServerBase declaration
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_CCHSERVERBASE_H
|
|
20 |
#define C_CCHSERVERBASE_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32std.h>
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <cchclientserver.h>
|
|
26 |
#include "cchwakeupeventobserver.h"
|
|
27 |
#include "cchconnmonhandlernotifier.h"
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
// Security Policy
|
|
32 |
const TUint KCCHRangeCount = 2;
|
|
33 |
|
|
34 |
const TInt KCCHRanges[ KCCHRangeCount ] =
|
|
35 |
{
|
|
36 |
0, /// Session
|
|
37 |
24, // Non implemented requests (requests out of range)
|
|
38 |
};
|
|
39 |
|
|
40 |
const TUint8 KCCHElementsIndex[ KCCHRangeCount ] =
|
|
41 |
{
|
|
42 |
0,
|
|
43 |
CPolicyServer::ENotSupported,
|
|
44 |
};
|
|
45 |
|
|
46 |
const CPolicyServer::TPolicyElement KCCHElements[] =
|
|
47 |
{
|
|
48 |
{
|
|
49 |
_INIT_SECURITY_POLICY_C1( ECapabilityNetworkServices ),
|
|
50 |
CPolicyServer::EFailClient
|
|
51 |
},
|
|
52 |
// Policy "0"; Fail call if ECapabilityNetworkServices not present
|
|
53 |
};
|
|
54 |
|
|
55 |
const CPolicyServer::TPolicy KCCHPolicy =
|
|
56 |
{
|
|
57 |
CPolicyServer::EAlwaysPass, // Connection attempts allowed
|
|
58 |
KCCHRangeCount, // Range count
|
|
59 |
KCCHRanges, // Ranges
|
|
60 |
KCCHElementsIndex, // Elements index
|
|
61 |
KCCHElements, // Elements
|
|
62 |
};
|
|
63 |
|
|
64 |
// MACROS
|
|
65 |
// None
|
|
66 |
|
|
67 |
// DATA TYPES
|
|
68 |
// None
|
|
69 |
|
|
70 |
// FUNCTION PROTOTYPES
|
|
71 |
// None
|
|
72 |
|
|
73 |
// FORWARD DECLARATIONS
|
|
74 |
class CCCHRequestStorage;
|
|
75 |
class CCCHPluginHandler;
|
|
76 |
class CCCHSPSHandler;
|
|
77 |
class CCCHServiceHandler;
|
|
78 |
class CCCHConnMonHandler;
|
|
79 |
class CCchFeatureManager;
|
|
80 |
class CCchWakeUpEventNotifier;
|
|
81 |
class CCchStartupCounter;
|
|
82 |
|
|
83 |
// CLASS DECLARATION
|
|
84 |
|
|
85 |
/**
|
|
86 |
* CCCHServerBase declaration
|
|
87 |
* The server of CCH services.
|
|
88 |
* @lib cchserver.exe
|
|
89 |
* @since S60 3.2
|
|
90 |
*/
|
|
91 |
NONSHARABLE_CLASS( CCCHServerBase ) : public CPolicyServer,
|
|
92 |
public MCchWakeUpEventObserver,
|
|
93 |
public MCCHConnMonHandlerNotifier
|
|
94 |
{
|
|
95 |
|
|
96 |
public: // Constructors and destructor
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Two-phased constructor.
|
|
100 |
*/
|
|
101 |
static CCCHServerBase* NewL();
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Two-phased constructor.
|
|
105 |
*/
|
|
106 |
static CCCHServerBase* NewLC();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Destructor.
|
|
110 |
*/
|
|
111 |
virtual ~CCCHServerBase();
|
|
112 |
|
|
113 |
public: // New functions
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Notify the server that a session has been created.
|
|
117 |
* @since S60 3.2
|
|
118 |
*/
|
|
119 |
void NotifySessionCreatedL();
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Notify the server that a session has been closed.
|
|
123 |
* @since S60 3.2
|
|
124 |
*/
|
|
125 |
void NotifySessionClosed();
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Panic the client.
|
|
129 |
* @since S60 3.2
|
|
130 |
* @param aMessage The panic message
|
|
131 |
* @param aPanic The panic code.
|
|
132 |
*/
|
|
133 |
void PanicClient( const RMessage2& aMessage, TInt aPanic );
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Panic the server.
|
|
137 |
* @since S60 3.2
|
|
138 |
* @param aPanic The panic code.
|
|
139 |
*/
|
|
140 |
void PanicServer( TInt aPanic );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Gives reference to container for object containers.
|
|
144 |
* @since S60 3.2
|
|
145 |
* @return Container for object containers.
|
|
146 |
*/
|
|
147 |
CObjectConIx& ObjectContainerIx();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Return reference to CCCHRequestStorage
|
|
151 |
* @since S60 3.2
|
|
152 |
* @return Reference to CCCHRequestStorage
|
|
153 |
*/
|
|
154 |
CCCHRequestStorage& RequestStorage();
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Return reference to CCCHConnMonHandler
|
|
158 |
* @since S60 3.2
|
|
159 |
* @return Reference to CCCHConnMonHandler
|
|
160 |
*/
|
|
161 |
CCCHConnMonHandler& ConnMonHandler();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Return reference to CCCHConnMonHandler
|
|
165 |
* @since S60 3.2
|
|
166 |
* @return Reference to CCCHConnMonHandler
|
|
167 |
*/
|
|
168 |
CCCHSPSHandler& SPSHandler();
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Return reference to CCCHPluginHandler
|
|
172 |
* @since S60 3.2
|
|
173 |
* @return Reference to CCCHPluginHandler
|
|
174 |
*/
|
|
175 |
CCCHPluginHandler& PluginHandler();
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Return reference to CCCHServiceHandler
|
|
179 |
* @since S60 3.2
|
|
180 |
* @return Reference to CCCHServiceHandler
|
|
181 |
*/
|
|
182 |
CCCHServiceHandler& ServiceHandler();
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Return reference to CCCHFeatureManager
|
|
186 |
* @since S60 3.2
|
|
187 |
* @return Reference to CCCHFeatureManager
|
|
188 |
*/
|
|
189 |
CCchFeatureManager& FeatureManager();
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Create startup counter.
|
|
193 |
* @since S60 3.2
|
|
194 |
*/
|
|
195 |
void CreateStartupCounterL();
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Reset startup counter.
|
|
199 |
* @since S60 3.2
|
|
200 |
*/
|
|
201 |
void ResetStartupCounterL();
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Indicates if the voip emergency note has been shown or not.
|
|
205 |
* @since S60 3.2
|
|
206 |
*/
|
|
207 |
TBool VoIPEmergencyNoteShown();
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Sets the voip emergency note shown flag.
|
|
211 |
* @since S60 3.2
|
|
212 |
*/
|
|
213 |
void SetVoIPEmergencyNoteShown( TBool aShown );
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Restarts server.
|
|
217 |
* @since S60 3.2
|
|
218 |
*/
|
|
219 |
void Restart();
|
|
220 |
|
|
221 |
public: // Methods from base classes
|
|
222 |
|
|
223 |
/**
|
|
224 |
* (From CServer2) Creates a new session for a client.
|
|
225 |
*
|
|
226 |
* @param aVersion (OUT) The version of the server.
|
|
227 |
* @param aMessage IPC message
|
|
228 |
* @return A new instance of CWLMSession.
|
|
229 |
*/
|
|
230 |
virtual CSession2* NewSessionL(
|
|
231 |
const TVersion& aVersion,
|
|
232 |
const RMessage2& aMessage ) const;
|
|
233 |
|
|
234 |
/**
|
|
235 |
* (From MCchWakeUpEventObserver) Creates a new session for a client.
|
|
236 |
*
|
|
237 |
* Switch server to monitoring mode
|
|
238 |
*/
|
|
239 |
void WakeUp();
|
|
240 |
|
|
241 |
private: // From MCCHConnMonHandlerNotifier
|
|
242 |
|
|
243 |
void NetworkScanningCompletedL( const TConnMonSNAPInfo& aSNAPs, TInt aError );
|
|
244 |
|
|
245 |
void SNAPsAvailabilityChanged( TInt aError );
|
|
246 |
|
|
247 |
private:
|
|
248 |
|
|
249 |
/**
|
|
250 |
* C++ default constructor.
|
|
251 |
*/
|
|
252 |
CCCHServerBase();
|
|
253 |
|
|
254 |
/**
|
|
255 |
* By default Symbian 2nd phase constructor is private.
|
|
256 |
*/
|
|
257 |
void ConstructL();
|
|
258 |
|
|
259 |
/**
|
|
260 |
* Shutdowns server
|
|
261 |
*/
|
|
262 |
void ShutDownServerL();
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Initialize server and it's components
|
|
266 |
*/
|
|
267 |
void InitServerObjectsL();
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Switch server to monitoring mode
|
|
271 |
*/
|
|
272 |
void StartMinimalServerL();
|
|
273 |
|
|
274 |
TBool IsServerShutdownAllowedL();
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Release all dynamic memory allocations and other resources
|
|
278 |
*/
|
|
279 |
void ReleaseAllResources();
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Starts service
|
|
283 |
*/
|
|
284 |
void ServiceStartupL();
|
|
285 |
|
|
286 |
template <class T>T& ConstructObject( CCCHServerBase* aThis, T*& aObject );
|
|
287 |
template <class T>T& ConstructObject( T*& aObject );
|
|
288 |
|
|
289 |
|
|
290 |
private: // data
|
|
291 |
|
|
292 |
/**
|
|
293 |
* Session counter
|
|
294 |
*/
|
|
295 |
TInt iSessionCounter;
|
|
296 |
|
|
297 |
/**
|
|
298 |
* Object container factory for sessions
|
|
299 |
*/
|
|
300 |
CObjectConIx* iObjectConIx;
|
|
301 |
|
|
302 |
/**
|
|
303 |
* Storage for asynchronous requests.
|
|
304 |
*/
|
|
305 |
CCCHRequestStorage* iRequestStorage;
|
|
306 |
|
|
307 |
/**
|
|
308 |
* Object for handling ConnMon
|
|
309 |
*/
|
|
310 |
CCCHConnMonHandler* iConnMonHandler;
|
|
311 |
|
|
312 |
/**
|
|
313 |
* Object for handling Service Provider Settings
|
|
314 |
*/
|
|
315 |
CCCHSPSHandler* iSPSHandler;
|
|
316 |
|
|
317 |
/**
|
|
318 |
* Object for handling Plug-ins.
|
|
319 |
*/
|
|
320 |
CCCHPluginHandler* iPluginHandler;
|
|
321 |
|
|
322 |
/**
|
|
323 |
* Object for handling Services
|
|
324 |
*/
|
|
325 |
CCCHServiceHandler* iServiceHandler;
|
|
326 |
|
|
327 |
/**
|
|
328 |
* Cch's feature manager
|
|
329 |
*/
|
|
330 |
CCchFeatureManager* iFeatureManager;
|
|
331 |
|
|
332 |
/**
|
|
333 |
* Wake-up event notifer
|
|
334 |
*/
|
|
335 |
CCchWakeUpEventNotifier *iWakeUpEventNotifier;
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Counts startups
|
|
339 |
*/
|
|
340 |
CCchStartupCounter* iStartupCounter;
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Have we already shown the emergency call note?
|
|
344 |
*/
|
|
345 |
TBool iVoIPEmergencyNoteShown;
|
|
346 |
|
|
347 |
/**
|
|
348 |
* Have we already initialized the server objects?
|
|
349 |
*/
|
|
350 |
TBool iServerObjectsInit;
|
|
351 |
};
|
|
352 |
|
|
353 |
#endif // C_CCHSERVERBASE_H
|
|
354 |
|
|
355 |
// End of file
|