|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Implementation of HotSpot Server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef HOTSPOTSERVER_H |
|
21 #define HOTSPOTSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32svr.h> |
|
26 #include <e32std.h> |
|
27 #include "hotspotclientserver.h" |
|
28 #include "hssscanlist.h" |
|
29 #include "hssnotif.h" |
|
30 |
|
31 #include <wlanmgmtcommon.h> |
|
32 #include <wlanmgmtinterface.h> |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CHotSpotSession; |
|
36 class HssScanList; |
|
37 class CNotificationBase; |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // Server's policy |
|
41 // ----------------------------------------------------------------------------- |
|
42 |
|
43 //Total number of ranges |
|
44 const TUint KHotSpotServerPlatSecRangeCount = 3; |
|
45 |
|
46 //Definition of the ranges of IPC numbers |
|
47 const TInt THotSpotServerPlatSecRanges[ KHotSpotServerPlatSecRangeCount ] = |
|
48 { |
|
49 0, // Internal IPC Messages (Client, WLAN, NIfman, Shutdown, Internal, UI) |
|
50 20, // IPC Message ICTS API |
|
51 21 // Not supported IPC Messages |
|
52 }; |
|
53 |
|
54 //Policy to implement for each of the above ranges |
|
55 const TUint8 THotSpotServerPlatSecElementsIndex[ KHotSpotServerPlatSecRangeCount ] = |
|
56 { |
|
57 0, // Internal IPC Messages |
|
58 CPolicyServer::EAlwaysPass, // IPC Messages ICTS API |
|
59 CPolicyServer::ENotSupported // Not supported IPC Messages |
|
60 }; |
|
61 |
|
62 //Specific capability checks |
|
63 const CPolicyServer::TPolicyElement THotSpotServerPlatSecElements[] = |
|
64 { |
|
65 { _INIT_SECURITY_POLICY_C1( ECapabilityNetworkControl ), CPolicyServer::EFailClient } |
|
66 }; |
|
67 |
|
68 //Package all the above together into a policy |
|
69 const CPolicyServer::TPolicy THotSpotServerPlatSecPolicy = |
|
70 { |
|
71 CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass |
|
72 KHotSpotServerPlatSecRangeCount, // number of ranges |
|
73 THotSpotServerPlatSecRanges, // ranges array |
|
74 THotSpotServerPlatSecElementsIndex, // elements<->ranges index |
|
75 THotSpotServerPlatSecElements, // array of elements |
|
76 }; |
|
77 |
|
78 // ---------------------------------------------------------------------------------------- |
|
79 // Server's panic codes here |
|
80 // ---------------------------------------------------------------------------------------- |
|
81 enum THotspotPanic |
|
82 { |
|
83 EPanicGeneral, |
|
84 EPanicIllegalFunction |
|
85 }; |
|
86 |
|
87 void PanicClient(const RMessagePtr2& aMessage,THotspotPanic aPanic); |
|
88 |
|
89 struct SRequestMapEntry |
|
90 { |
|
91 RMessagePtr2 iMessage; |
|
92 THotSpotCommands iFunction; |
|
93 TUint iIapId; |
|
94 }; |
|
95 |
|
96 struct SLoginLogoutTimers |
|
97 { |
|
98 TUid clientUid; |
|
99 TUint loginTimeMicroSecs; |
|
100 TUint logoutTimeMicroSecs; |
|
101 }; |
|
102 |
|
103 // CLASS DECLARATION |
|
104 |
|
105 /** |
|
106 * The server of HotSpot services. |
|
107 * |
|
108 * @lib HotSpotServer.exe |
|
109 * @since Series 60 3.0 |
|
110 */ |
|
111 NONSHARABLE_CLASS ( CHotSpotServer ) : public CPolicyServer, public MWlanMgmtNotifications |
|
112 { |
|
113 |
|
114 public: // Constructors and destructor |
|
115 |
|
116 /** |
|
117 * Two-phased constructor. |
|
118 */ |
|
119 static CHotSpotServer* NewLC(); |
|
120 |
|
121 /** |
|
122 * Destructor. |
|
123 */ |
|
124 virtual ~CHotSpotServer(); |
|
125 |
|
126 |
|
127 public: // New functions |
|
128 |
|
129 virtual void NotifyAdd( CNotificationBase& aNotification ); |
|
130 virtual void NotifyRemove(CNotificationBase& aNotification ); |
|
131 |
|
132 /** |
|
133 * Saves Iap Id, RMessage2, THotSpotCommands as one entry |
|
134 * @since Series 60 3.0 |
|
135 * @param aIapId IAP id |
|
136 * @param aMessage Client/Server message from client |
|
137 * @param aCommand Command/Function of message |
|
138 * @return None |
|
139 */ |
|
140 TInt SaveMessage( TUint aIapId, const RMessage2& aMessage, |
|
141 THotSpotCommands aCommand ); |
|
142 |
|
143 /** |
|
144 * Complete RMessage2 |
|
145 * @since Series 60 3.0 |
|
146 * @param aIndex Index of completed message in array |
|
147 * @param aResult Return value in complete |
|
148 * @return None |
|
149 */ |
|
150 void CompleteMessage( TInt aIndex, TInt aResult ); |
|
151 |
|
152 /** |
|
153 * Find message & add data to message |
|
154 * @since Series 60 3.0 |
|
155 * @param aIndex, Index of message in array |
|
156 * @param aData, TPckg type of data |
|
157 * @return Index of message in array, otherwise KErrNotFound |
|
158 */ |
|
159 TInt EditMessage( TInt aIndex, TPckg<HssScanList>& aData); |
|
160 |
|
161 /** |
|
162 * Check if IAP id has uncomplete messages |
|
163 * @since Series 60 3.0 |
|
164 * @param aIapId IAP id |
|
165 * @param aCommand Command/Function of message |
|
166 * @return Index of message in array, otherwise KErrNotFound |
|
167 */ |
|
168 TInt FindMessage( TUint aIapId, THotSpotCommands aCommand ); |
|
169 |
|
170 /** |
|
171 * Set value whether Logout() is sent or not |
|
172 * @since Series 60 3.0 |
|
173 * @param aValue New value of flag |
|
174 * @return None |
|
175 */ |
|
176 void SetLogoutFlag( TBool aValue ); |
|
177 |
|
178 /** |
|
179 * Gets value if Logout is sent to client or not |
|
180 * @since Series 60 3.0 |
|
181 * @return ETrue if Login is sent. Otherwise EFalse |
|
182 */ |
|
183 TBool GetLogoutFlagValue(); |
|
184 |
|
185 /** |
|
186 * Set value whether Login() is sent or not |
|
187 * @since Series 60 3.0 |
|
188 * @param aValue New value of flag |
|
189 * @return None |
|
190 */ |
|
191 void SetLoginFlag( TBool aValue ); |
|
192 |
|
193 /** |
|
194 * Gets value if Login is sent to client or not |
|
195 * @since Series 60 3.0 |
|
196 * @return ETrue if Login can be sent. Otherwise EFalse |
|
197 */ |
|
198 TBool GetLoginFlagValue(); |
|
199 |
|
200 /** |
|
201 * Set value whether WLAN association status can be sent |
|
202 * @param aValue New value of flag |
|
203 * @return None |
|
204 */ |
|
205 void SetAssociationFlag( TBool aValue ); |
|
206 |
|
207 /** |
|
208 * Gets value whether WLAN association status can be sent |
|
209 * @return ETrue if can be sent. Otherwise EFalse. |
|
210 */ |
|
211 TBool GetAssociationFlagValue(); |
|
212 |
|
213 /** |
|
214 * Set service id of IAP in use |
|
215 * @since Series 60 3.0 |
|
216 * @param aServiceId service id |
|
217 * @return None |
|
218 */ |
|
219 void SetServiceId( TInt aServiceId ); |
|
220 |
|
221 /** |
|
222 * Gets service id of IAP in use |
|
223 * @since Series 60 3.0 |
|
224 * @return service ID |
|
225 */ |
|
226 TInt GetServiceId(); |
|
227 |
|
228 /** |
|
229 * Checks IAPs if there's any unused Hotspot IAPs. |
|
230 * @since Series 60 3.0 |
|
231 * @return None |
|
232 */ |
|
233 void CheckIapsL(); |
|
234 |
|
235 /** |
|
236 * Checks EasyWLAN service id |
|
237 * @since Series 60 MCL |
|
238 * @return ETrue if commits were successful, otherwise EFalse. |
|
239 */ |
|
240 TBool EasyWlanIdL(); |
|
241 |
|
242 /** |
|
243 * Getter for EasyWLAN service id |
|
244 * @since Series 60 MCL |
|
245 * @return EasyWLAN IAP id |
|
246 */ |
|
247 TUint32 GetEasyWlanId(); |
|
248 |
|
249 /** |
|
250 * Get login timer value for the specified client. |
|
251 * @param aClientUid, client's user ID, |
|
252 * @return Login timer value. |
|
253 */ |
|
254 TUint GetLoginTimeMicroSecs( TUid aClientUid ); |
|
255 |
|
256 /** |
|
257 * Get logout timer value for the specified client. |
|
258 * @param aClientUid, client's user ID, |
|
259 * @return Logout timer value. |
|
260 */ |
|
261 TUint GetLogoutTimeMicroSecs( TUid aClientUid ); |
|
262 |
|
263 /** |
|
264 * Set both login and logout timer values for the specified client. |
|
265 * @param aClientUid, client's user ID, |
|
266 * @param aLoginTimerValue, set login timer value, |
|
267 * @param aLogoutTimerValue, set logout timer value. |
|
268 */ |
|
269 void CHotSpotServer::SetTimerValues( |
|
270 TUid aClientUid, |
|
271 TUint aLoginTimerValue, |
|
272 TUint aLogoutTimerValue ); |
|
273 |
|
274 private: |
|
275 |
|
276 /** |
|
277 * Find matching Client UID from the timer array. |
|
278 * @param aClientUid, client UID to find. |
|
279 * @return matching index if UID was found, otherwise KErrNotFound. |
|
280 */ |
|
281 TInt CHotSpotServer::FindClientUid( TUid aClientUid ); |
|
282 |
|
283 public: // Functions from base classes |
|
284 |
|
285 /** |
|
286 * From CServer creates a new session |
|
287 * @since Series 60 3.0 |
|
288 * @param aVersion Version |
|
289 * @return Pointer to created server side session |
|
290 */ |
|
291 CSession2* NewSessionL( const TVersion& aVersion, |
|
292 const RMessage2& aMessage ) const; |
|
293 |
|
294 /** |
|
295 * From MWlanMgmtNotifications |
|
296 * @since Series 60 3.0 |
|
297 * @param aNewState State of WLAN |
|
298 * @return None |
|
299 */ |
|
300 virtual void ConnectionStateChanged( TWlanConnectionMode aNewState ); |
|
301 |
|
302 protected: |
|
303 |
|
304 /** |
|
305 * Overrides CActive::RunError() |
|
306 */ |
|
307 virtual TInt RunError( TInt aError ); |
|
308 |
|
309 private: |
|
310 |
|
311 /** |
|
312 * C++ default constructor. |
|
313 */ |
|
314 CHotSpotServer(); |
|
315 |
|
316 /** |
|
317 * By default Symbian 2nd phase constructor is private. |
|
318 */ |
|
319 void ConstructL(); |
|
320 |
|
321 private: |
|
322 /** |
|
323 * Messages that are needed to be saved for later completion |
|
324 * Own |
|
325 */ |
|
326 RArray<SRequestMapEntry> iMap; |
|
327 /** |
|
328 * List of clients who have subscribed notifications |
|
329 */ |
|
330 RArray<CNotificationBase*> iNotificationArray; |
|
331 |
|
332 /** |
|
333 * Flag for sending client Logout -message |
|
334 */ |
|
335 TBool iLogoutSent; |
|
336 |
|
337 /** |
|
338 * Flag for sending client Login -message |
|
339 */ |
|
340 TBool iLoginValue; |
|
341 |
|
342 /** |
|
343 * Flag for sending WLAN association status to client |
|
344 */ |
|
345 TBool iAssociationValue; |
|
346 |
|
347 /** |
|
348 * Boolean flag whether the IAPs has been checked or not |
|
349 */ |
|
350 TBool iIapCheckValue; |
|
351 |
|
352 /** |
|
353 * WLAN management API |
|
354 */ |
|
355 CWlanMgmtClient* iMgtClient; |
|
356 |
|
357 /** |
|
358 * Service id of IAP in use |
|
359 */ |
|
360 TInt iCurrentServiceIdInUse; |
|
361 |
|
362 /** |
|
363 * Return/leave value of ChangeConfigDaemonL() |
|
364 */ |
|
365 TInt iConfigDaemonChanged; |
|
366 |
|
367 /** |
|
368 * Service id of IAP in use |
|
369 */ |
|
370 TUint32 iEasyWlanId; |
|
371 |
|
372 /** |
|
373 * Array for storing client dependent login and logout timer values. |
|
374 */ |
|
375 RArray<SLoginLogoutTimers> iLoginLogoutTimerArray; |
|
376 }; |
|
377 |
|
378 #endif |