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