|
1 /* |
|
2 * Copyright (c) 2009-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: |
|
15 * Connection method manager server. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CMMSERVER_H_ |
|
21 #define CMMSERVER_H_ |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "cmmserverdefs.h" |
|
26 #include "cmmanagerimpl.h" |
|
27 |
|
28 class CCmmDelayedShutdown; |
|
29 |
|
30 |
|
31 /** |
|
32 * The main server class |
|
33 */ |
|
34 NONSHARABLE_CLASS( CCmmServer ) : public CPolicyServer |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Two phased construction. |
|
40 */ |
|
41 static CCmmServer* NewL(); |
|
42 |
|
43 /** |
|
44 * Two phased construction. |
|
45 */ |
|
46 static CCmmServer* NewLC(); |
|
47 |
|
48 /** |
|
49 * Destroy the object and release all memory objects |
|
50 */ |
|
51 ~CCmmServer(); |
|
52 |
|
53 /** |
|
54 * Increments the count of the active sessions for this server |
|
55 */ |
|
56 void IncrementSessions(); |
|
57 |
|
58 /** |
|
59 * Decrements the count of the active sessions for this server. |
|
60 * If no more sessions are in use the server terminates. |
|
61 */ |
|
62 void DecrementSessions(); |
|
63 |
|
64 /** |
|
65 * Produces object containers (needed by subsessions) with unique ids within the server. |
|
66 * @return A object container. |
|
67 */ |
|
68 CObjectCon* NewContainerL(); |
|
69 |
|
70 /** |
|
71 * Removes from index and deletes the object container. |
|
72 * @param aContainer The container to be deleted. |
|
73 * @return A object container. |
|
74 */ |
|
75 void RemoveContainer( CObjectCon* aContainer ); |
|
76 |
|
77 CCmManagerImpl* CmManager(); |
|
78 |
|
79 /** |
|
80 * Check for restrictions for adding an embedded destination from destination |
|
81 * instances of all clients. |
|
82 * @param aDestinationId The ID of the destination where a destination is |
|
83 * beeing embedded. |
|
84 * @param aEmbeddedDestinationId The ID of the destination that is beeing |
|
85 * embedded. |
|
86 */ |
|
87 TBool EmbeddedDestinationConflictsFromAllSessions( |
|
88 const TUint32& aDestinationId, |
|
89 const TUint32& aEmbeddedDestinationId ); |
|
90 |
|
91 /** |
|
92 * Notify each session about a destination/connection method that has been |
|
93 * updated to, or deleted from, database. |
|
94 */ |
|
95 void RefreshHandlesForAllSessions( const TUint32& aId ); |
|
96 |
|
97 /** |
|
98 * Custom security checking for IPCs marked with TSpecialCase::ECustomCheck. |
|
99 * @param aMsg The IPC message from the client. |
|
100 * @return The result of the security check (TCustomResult::EPass/TCustomResult::EFail). |
|
101 */ |
|
102 TCustomResult CustomSecurityCheckL( |
|
103 const RMessage2& aMsg, |
|
104 TInt& aAction, |
|
105 TSecurityInfo& aMissing ); |
|
106 |
|
107 |
|
108 protected: // From CActive |
|
109 /** |
|
110 * Process any errors |
|
111 * |
|
112 * @param aError the leave code reported |
|
113 */ |
|
114 TInt RunError( TInt aError ); |
|
115 |
|
116 private: |
|
117 |
|
118 /** |
|
119 * Perform the first phase of two phase construction |
|
120 * |
|
121 * @param Priority for this thread |
|
122 */ |
|
123 CCmmServer( TInt aPriority ); |
|
124 |
|
125 /** |
|
126 * Perform the second phase construction |
|
127 */ |
|
128 void ConstructL() ; |
|
129 |
|
130 private: // From CServer |
|
131 |
|
132 /** |
|
133 * Create a time server session, and return a pointer to the |
|
134 * created object |
|
135 * |
|
136 * @param Version |
|
137 * |
|
138 * @result Pointer to the new session |
|
139 */ |
|
140 CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; |
|
141 |
|
142 private: |
|
143 /** The number of client-server sessions */ |
|
144 TInt iSessionCount; |
|
145 |
|
146 static const TUint iCmmRangeCount; |
|
147 static const TInt iCmmRanges[]; |
|
148 static const TUint8 iCmmElementIndex[]; |
|
149 |
|
150 static const CPolicyServer::TPolicyElement iCmmElements[]; |
|
151 static const CPolicyServer::TPolicy iCmmPolicy; |
|
152 |
|
153 CCmManagerImpl* iCmManager; |
|
154 |
|
155 // Object container index |
|
156 CObjectConIx* iContainerIndex; |
|
157 |
|
158 // Pointer to the shutdown timer object |
|
159 CCmmDelayedShutdown* iShutdown; |
|
160 }; |
|
161 |
|
162 /** |
|
163 * CCmmDelayedShutdown |
|
164 * Shutdown timer that closes Connection Method Manager server after a period. |
|
165 */ |
|
166 NONSHARABLE_CLASS( CCmmDelayedShutdown ) : public CActive |
|
167 { |
|
168 public: |
|
169 CCmmDelayedShutdown( CCmmServer* aServer ); |
|
170 void ConstructL(); |
|
171 ~CCmmDelayedShutdown(); |
|
172 |
|
173 public: |
|
174 /** |
|
175 * Starts shutdown timer. |
|
176 * @return KErrNone if OK, otherwise a system wide error code. |
|
177 */ |
|
178 void Start(); |
|
179 |
|
180 private: |
|
181 /** |
|
182 * From CActive Cancels the shutdown timer. |
|
183 */ |
|
184 void DoCancel(); |
|
185 |
|
186 /** |
|
187 * From CActive Shuts the server down. |
|
188 */ |
|
189 void RunL(); |
|
190 |
|
191 private: // Data |
|
192 RTimer iTimer; |
|
193 CCmmServer* iServer; |
|
194 }; |
|
195 |
|
196 |
|
197 #endif // CMMSERVER_H_ |
|
198 |
|
199 // End of file |