|
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 * Handles client requests. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CMMSESSION_H_ |
|
21 #define CMMSESSION_H_ |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "cmmcache.h" |
|
26 |
|
27 class CCmmServer; |
|
28 class CCmmConnMethodInstance; |
|
29 class CCmmDestinationInstance; |
|
30 |
|
31 |
|
32 /** |
|
33 * A handler for the service requests received from clients. |
|
34 */ |
|
35 class CCmmSession : public CSession2 |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * Creates a CVpnManagerSession object using two phase construction, |
|
40 * and returns a pointer to the created object |
|
41 * |
|
42 * @param Client's thread |
|
43 * @param The server |
|
44 * |
|
45 * @result Pointer to the new session |
|
46 */ |
|
47 static CCmmSession* NewL( CCmmServer& aServer, CCmmCache& aCache ); |
|
48 |
|
49 /** |
|
50 * Creates a CVpnManagerSession object using two phase construction, |
|
51 * and returns a pointer to the created object |
|
52 * (leaving a pointer to the object on the cleanup stack) |
|
53 * |
|
54 * @param Client's thread |
|
55 * @param The server |
|
56 * |
|
57 * @result Pointer to the new session |
|
58 */ |
|
59 static CCmmSession* NewLC( CCmmServer& aServer, CCmmCache& aCache ); |
|
60 |
|
61 /** |
|
62 * Destroy the object and release all memory objects. |
|
63 */ |
|
64 ~CCmmSession(); |
|
65 |
|
66 public: |
|
67 /** |
|
68 * Service request from client. |
|
69 * |
|
70 * @param aMessage Message from client (containing requested operation and |
|
71 * any relevant data). |
|
72 */ |
|
73 void ServiceL( const RMessage2& aMessage ); |
|
74 |
|
75 /** |
|
76 * Finds a connection method instance that belongs to this session and |
|
77 * matches the provided ID. Return NULL if no match is found. |
|
78 */ |
|
79 CCmmConnMethodInstance* FindConnMethodInstanceById( |
|
80 const TUint32& aConnMethodId ); |
|
81 |
|
82 /** |
|
83 * Finds a destination instance that belongs to this session and matches |
|
84 * the provided handle. |
|
85 */ |
|
86 CCmmDestinationInstance* FindDestinationInstanceByHandleL( |
|
87 const TInt& aDestinationHandle ); |
|
88 |
|
89 /** |
|
90 * Finds a destination instance that belongs to this session and matches |
|
91 * the provided ID. Return NULL if no match is found. |
|
92 */ |
|
93 CCmmDestinationInstance* FindDestinationInstanceById( |
|
94 const TUint32& aDestinationId ); |
|
95 |
|
96 /** |
|
97 * Check from all open destination handles in this session if the given |
|
98 * connection method is inside any of them. The given destination is |
|
99 * skipped. |
|
100 */ |
|
101 TBool ConnMethodInOtherDestination( |
|
102 const TUint32& aConnMethodId, |
|
103 const TUint32& aDestinationId ); |
|
104 |
|
105 /** |
|
106 * Check for restrictions for adding an embedded destination from destination |
|
107 * instances of all clients. |
|
108 * @param aDestinationId The ID of the destination where a destination is |
|
109 * beeing embedded. |
|
110 * @param aEmbeddedDestinationId The ID of the destination that is beeing |
|
111 * embedded. |
|
112 */ |
|
113 TBool EmbeddedDestinationConflictsFromAllSessions( |
|
114 const TUint32& aDestinationId, |
|
115 const TUint32& aEmbeddedDestinationId ); |
|
116 |
|
117 /** |
|
118 * Check for restrictions for adding an embedded destination from destination |
|
119 * instances of this session. |
|
120 * @param aDestinationId The ID of the destination where a destination is |
|
121 * beeing embedded. |
|
122 * @param aEmbeddedDestinationId The ID of the destination that is beeing |
|
123 * embedded. |
|
124 */ |
|
125 TBool EmbeddedDestinationConflicts( |
|
126 const TUint32& aDestinationId, |
|
127 const TUint32& aEmbeddedDestinationId ); |
|
128 |
|
129 /** |
|
130 * After update to database, refresh temporary ID to real ID if necessary |
|
131 * and refresh status information for any related handles for all client |
|
132 * sessions. |
|
133 */ |
|
134 void RefreshHandlesForAllSessions( const TCmmIdStruct& aIdStruct ); |
|
135 |
|
136 /** |
|
137 * Removes a connection method from any open destination handle in this |
|
138 * session. |
|
139 */ |
|
140 void RemoveConnMethodFromDestinationHandles( |
|
141 const TUint32& aConnMethodId ); |
|
142 |
|
143 /** |
|
144 * Notify this sessions destination/connection method handles about an |
|
145 * updated/deleted destination/connection method. |
|
146 */ |
|
147 void RefreshHandles( const TUint32& aId ) const; |
|
148 |
|
149 private: |
|
150 /** |
|
151 * The first phase of two phase construction. |
|
152 * |
|
153 * @param Client's thread |
|
154 * @param The server |
|
155 */ |
|
156 CCmmSession( CCmmServer& aServer, CCmmCache& aCache ); |
|
157 |
|
158 /** |
|
159 * Destination specific service dispatcher. |
|
160 * @param aMessage Message sent by the plugin |
|
161 */ |
|
162 void ServiceDestinationL( const RMessage2& aMessage ); |
|
163 |
|
164 /** |
|
165 * Connection Method specific service dispatcher. |
|
166 * @param aMessage Message sent by the plugin |
|
167 */ |
|
168 void ServiceConnMethodL( const RMessage2& aMessage ); |
|
169 |
|
170 /** |
|
171 * The second phase of two phase construction. |
|
172 */ |
|
173 void ConstructL() ; |
|
174 |
|
175 void GetBearerInfoIntL( const RMessage2& aMessage ); |
|
176 void GetBearerInfoBoolL( const RMessage2& aMessage ); |
|
177 void GetBearerInfoStringL( const RMessage2& aMessage ); |
|
178 void GetBearerInfoString8L( const RMessage2& aMessage ); |
|
179 void GetConnMethodInfoIntL( const RMessage2& aMessage ); |
|
180 void GetConnMethodInfoBoolL( const RMessage2& aMessage ); |
|
181 void GetConnMethodInfoStringL( const RMessage2& aMessage ); |
|
182 void GetConnMethodInfoString8L( const RMessage2& aMessage ); |
|
183 void GetConnMethodArrayL( const RMessage2& aMessage ); |
|
184 void GetAllDestinationsL( const RMessage2& aMessage ); |
|
185 void GetEasyWLANIdL( const RMessage2& aMessage ); |
|
186 void GetSupportedBearersL( const RMessage2& aMessage ); |
|
187 void ReadDefaultConnectionL( const RMessage2& aMessage ); |
|
188 void ReadGenConnSettingsL( const RMessage2& aMessage ); |
|
189 void WriteGenConnSettingsL( const RMessage2& aMessage ); |
|
190 void GetBearerPriorityArrayL( const RMessage2& aMessage ); |
|
191 void UpdateBearerPriorityArrayL( const RMessage2& aMessage ); |
|
192 void CopyConnMethodL( const RMessage2& aMessage ); |
|
193 void MoveConnMethodL( const RMessage2& aMessage ); |
|
194 void RemoveConnMethodL( const RMessage2& aMessage ); |
|
195 |
|
196 void RemoveAllReferencesL( const RMessage2& aMessage ); |
|
197 |
|
198 void GetDestinationL( const RMessage2& aMessage ); |
|
199 void RefreshDestinationL( const RMessage2& aMessage ); |
|
200 void CreateDestinationWithNameL( const RMessage2& aMessage ); |
|
201 void CreateDestinationWithNameAndIdL( const RMessage2& aMessage ); |
|
202 void CloseDestination( const RMessage2& aMessage ); |
|
203 void GetConnectionMehodCountL( const RMessage2& aMessage ); |
|
204 void GetConnMethodPriorityL( const RMessage2& aMessage ); |
|
205 void GetDestinationNameL( const RMessage2& aMessage ); |
|
206 void GetDestinationIdL( const RMessage2& aMessage ); |
|
207 void GetDestinationElementIdL( const RMessage2& aMessage ); |
|
208 void GetDestinationMetadataL( const RMessage2& aMessage ); |
|
209 void GetDestinationProtectionLevelL( const RMessage2& aMessage ); |
|
210 void IsDestinationConnectedL( const RMessage2& aMessage ); |
|
211 void IsDestinationHiddenL( const RMessage2& aMessage ); |
|
212 void DestinationIsEqualL( const RMessage2& aMessage ); |
|
213 |
|
214 void DestAddConnMethodL( const RMessage2& aMessage ); |
|
215 void DestAddEmbeddedDestinationL( const RMessage2& aMessage ); |
|
216 void DestDeleteConnMethodL( const RMessage2& aMessage ); |
|
217 void DestRemoveConnMethodL( const RMessage2& aMessage ); |
|
218 |
|
219 void ModifyConnMethodPriorityL( const RMessage2& aMessage ); |
|
220 void SetDestinationNameL( const RMessage2& aMessage ); |
|
221 void SetDestinationMetadataL( const RMessage2& aMessage ); |
|
222 void SetDestinationProtectionL( const RMessage2& aMessage ); |
|
223 void SetDestinationHiddenL( const RMessage2& aMessage ); |
|
224 void UpdateDestinationL( const RMessage2& aMessage ); |
|
225 void DeleteDestinationL( const RMessage2& aMessage ); |
|
226 |
|
227 void CreateConnMethodL( const RMessage2& aMessage ); |
|
228 void UpdateConnMethodL( const RMessage2& aMessage ); |
|
229 void CloseConnMethod( const RMessage2& aMessage ); |
|
230 void DeleteConnMethodL( const RMessage2& aMessage ); |
|
231 void GetConnMethodWithIdL( const RMessage2& aMessage ); |
|
232 void RefreshConnMethodL( const RMessage2& aMessage ); |
|
233 void GetIntAttributeL( const RMessage2& aMessage ); |
|
234 void GetBoolAttributeL( const RMessage2& aMessage ); |
|
235 void GetStringAttributeL( const RMessage2& aMessage ); |
|
236 void GetString8AttributeL( const RMessage2& aMessage ); |
|
237 void SetIntAttributeL( const RMessage2& aMessage ); |
|
238 void SetBoolAttributeL( const RMessage2& aMessage ); |
|
239 void SetStringAttributeL( const RMessage2& aMessage ); |
|
240 void SetString8AttributeL( const RMessage2& aMessage ); |
|
241 void CreateConnMethodWithIdL( const RMessage2& aMessage ); |
|
242 void GetConnMethodFromDestWithIndexL( const RMessage2& aMessage ); |
|
243 void GetConnMethodFromDestWithIdL( const RMessage2& aMessage ); |
|
244 void CreateConnMethodToDestL( const RMessage2& aMessage ); |
|
245 void CreateConnMethodToDestWithIdL( const RMessage2& aMessage ); |
|
246 void CmIsEqualL( const RMessage2& aMessage ); |
|
247 void CreateCopyOfExistingL( const RMessage2& aMessage ); |
|
248 void GetEmbeddedDestinationL( const RMessage2& aMessage ); |
|
249 |
|
250 private: |
|
251 RMessage2 iMessage; |
|
252 |
|
253 CCmmServer& iServer; |
|
254 |
|
255 // Object container for this session (our handles) |
|
256 CObjectCon* iDestinationContainer; |
|
257 |
|
258 // Object index which stores objects for this session |
|
259 CObjectIx* iDestinationObjects; |
|
260 |
|
261 // Object container for this session (our handles) |
|
262 CObjectCon* iConnMethodContainer; |
|
263 |
|
264 // Object index which stores objects for this session |
|
265 CObjectIx* iConnMethodObjects; |
|
266 |
|
267 CCmmCache& iCache; // Not owned |
|
268 }; |
|
269 |
|
270 #endif // CMMSESSION_H_ |
|
271 |
|
272 // End of file |