61 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
62 // |
62 // |
63 CCmmSession::CCmmSession( CCmmServer& aServer, CCmmCache& aCache ) |
63 CCmmSession::CCmmSession( CCmmServer& aServer, CCmmCache& aCache ) |
64 : |
64 : |
65 iServer( aServer ), |
65 iServer( aServer ), |
66 iCache( aCache ) |
66 iCache( aCache ), |
|
67 iFsConnected( EFalse ) |
67 { |
68 { |
68 OstTraceFunctionEntry0( CCMMSESSION_CCMMSESSION_ENTRY ); |
69 OstTraceFunctionEntry0( CCMMSESSION_CCMMSESSION_ENTRY ); |
69 |
70 |
70 iDestinationContainer = NULL; |
71 iDestinationContainer = NULL; |
71 iDestinationObjects = NULL; |
72 iDestinationObjects = NULL; |
126 if ( iConnMethodContainer != 0 ) |
127 if ( iConnMethodContainer != 0 ) |
127 { |
128 { |
128 iServer.RemoveContainer( iConnMethodContainer ); |
129 iServer.RemoveContainer( iConnMethodContainer ); |
129 iConnMethodContainer = NULL; |
130 iConnMethodContainer = NULL; |
130 } |
131 } |
|
132 |
|
133 if ( iFsConnected ) |
|
134 { |
|
135 iFs.Close(); |
|
136 iFsConnected = EFalse; |
|
137 } |
|
138 |
131 OstTraceFunctionExit0( DUP1_CCMMSESSION_CCMMSESSION_EXIT ); |
139 OstTraceFunctionExit0( DUP1_CCMMSESSION_CCMMSESSION_EXIT ); |
132 } |
140 } |
133 |
141 |
134 // ----------------------------------------------------------------------------- |
142 // ----------------------------------------------------------------------------- |
135 // CCmmSession::ServiceL |
143 // CCmmSession::ServiceL |
267 case EDestMetadata: |
280 case EDestMetadata: |
268 case EDestGetProtectionLevel: |
281 case EDestGetProtectionLevel: |
269 case EDestIsConnected: |
282 case EDestIsConnected: |
270 case EDestIsHidden: |
283 case EDestIsHidden: |
271 case EDestIsEqual: |
284 case EDestIsEqual: |
|
285 case EDestGetIcon: |
272 case EDestAddConnMethod: |
286 case EDestAddConnMethod: |
273 case EDestAddEmbeddedDestination: |
287 case EDestAddEmbeddedDestination: |
274 case EDestDeleteConnMethod: |
288 case EDestDeleteConnMethod: |
275 case EDestRemoveConnMethod: |
289 case EDestRemoveConnMethod: |
276 case EDestModifyPriority: |
290 case EDestModifyPriority: |
327 // Finds a connection method instance that belongs to this session and matches |
342 // Finds a connection method instance that belongs to this session and matches |
328 // the provided ID. Return NULL if no match is found. |
343 // the provided ID. Return NULL if no match is found. |
329 // ----------------------------------------------------------------------------- |
344 // ----------------------------------------------------------------------------- |
330 // |
345 // |
331 CCmmConnMethodInstance* CCmmSession::FindConnMethodInstanceById( |
346 CCmmConnMethodInstance* CCmmSession::FindConnMethodInstanceById( |
332 const TUint32& aConnMethodId ) |
347 const TUint32 aConnMethodId ) |
333 { |
348 { |
334 OstTraceFunctionEntry0( CCMMSESSION_FINDCONNMETHODINSTANCEBYID_ENTRY ); |
349 OstTraceFunctionEntry0( CCMMSESSION_FINDCONNMETHODINSTANCEBYID_ENTRY ); |
335 |
350 |
336 CCmmConnMethodInstance* wantedConnMethodInstance( NULL ); |
351 CCmmConnMethodInstance* wantedConnMethodInstance( NULL ); |
337 |
352 |
354 // Finds a destination instance that belongs to this session and matches |
369 // Finds a destination instance that belongs to this session and matches |
355 // the provided handle. |
370 // the provided handle. |
356 // ----------------------------------------------------------------------------- |
371 // ----------------------------------------------------------------------------- |
357 // |
372 // |
358 CCmmDestinationInstance* CCmmSession::FindDestinationInstanceByHandleL( |
373 CCmmDestinationInstance* CCmmSession::FindDestinationInstanceByHandleL( |
359 const TInt& aDestinationHandle ) |
374 const TInt aDestinationHandle ) |
360 { |
375 { |
361 OstTraceFunctionEntry0( CCMMSESSION_FINDDESTINATIONINSTANCEBYHANDLEL_ENTRY ); |
376 OstTraceFunctionEntry0( CCMMSESSION_FINDDESTINATIONINSTANCEBYHANDLEL_ENTRY ); |
362 |
377 |
363 return (CCmmDestinationInstance*)iDestinationObjects->AtL( aDestinationHandle ); |
378 return (CCmmDestinationInstance*)iDestinationObjects->AtL( aDestinationHandle ); |
364 } |
379 } |
367 // Finds a destination instance that belongs to this session and matches |
382 // Finds a destination instance that belongs to this session and matches |
368 // the provided ID. Return NULL if no match is found. |
383 // the provided ID. Return NULL if no match is found. |
369 // ----------------------------------------------------------------------------- |
384 // ----------------------------------------------------------------------------- |
370 // |
385 // |
371 CCmmDestinationInstance* CCmmSession::FindDestinationInstanceById( |
386 CCmmDestinationInstance* CCmmSession::FindDestinationInstanceById( |
372 const TUint32& aDestinationId ) |
387 const TUint32 aDestinationId ) |
373 { |
388 { |
374 OstTraceFunctionEntry0( CCMMSESSION_FINDDESTINATIONINSTANCEBYID_ENTRY ); |
389 OstTraceFunctionEntry0( CCMMSESSION_FINDDESTINATIONINSTANCEBYID_ENTRY ); |
375 |
390 |
376 CCmmDestinationInstance* wantedDestinationInstance( NULL ); |
391 CCmmDestinationInstance* wantedDestinationInstance( NULL ); |
377 |
392 |
394 // Check from all open destination handles in this session if the given |
409 // Check from all open destination handles in this session if the given |
395 // connection method is inside any of them. The given destination is skipped. |
410 // connection method is inside any of them. The given destination is skipped. |
396 // ----------------------------------------------------------------------------- |
411 // ----------------------------------------------------------------------------- |
397 // |
412 // |
398 TBool CCmmSession::ConnMethodInOtherDestination( |
413 TBool CCmmSession::ConnMethodInOtherDestination( |
399 const TUint32& aConnMethodId, |
414 const TUint32 aConnMethodId, |
400 const TUint32& aDestinationId ) |
415 const TUint32 aDestinationId ) |
401 { |
416 { |
402 OstTraceFunctionEntry0( CCMMSESSION_CONNMETHODINOTHERDESTINATION_ENTRY ); |
417 OstTraceFunctionEntry0( CCMMSESSION_CONNMETHODINOTHERDESTINATION_ENTRY ); |
403 |
418 |
404 for ( TInt i = 0; i < iDestinationObjects->Count(); i++ ) |
419 for ( TInt i = 0; i < iDestinationObjects->Count(); i++ ) |
405 { |
420 { |
430 // - aEmbeddedDestinationId is the ID of the destination that is beeing |
445 // - aEmbeddedDestinationId is the ID of the destination that is beeing |
431 // embedded. |
446 // embedded. |
432 // ----------------------------------------------------------------------------- |
447 // ----------------------------------------------------------------------------- |
433 // |
448 // |
434 TBool CCmmSession::EmbeddedDestinationConflictsFromAllSessions( |
449 TBool CCmmSession::EmbeddedDestinationConflictsFromAllSessions( |
435 const TUint32& aDestinationId, |
450 const TUint32 aDestinationId, |
436 const TUint32& aEmbeddedDestinationId ) |
451 const TUint32 aEmbeddedDestinationId ) |
437 { |
452 { |
438 OstTraceFunctionEntry0( CCMMSESSION_EMBEDDEDDESTINATIONCONFLICTSFROMALLSESSIONS_ENTRY ); |
453 OstTraceFunctionEntry0( CCMMSESSION_EMBEDDEDDESTINATIONCONFLICTSFROMALLSESSIONS_ENTRY ); |
439 |
454 |
440 return iServer.EmbeddedDestinationConflictsFromAllSessions( aDestinationId, aEmbeddedDestinationId ); |
455 return iServer.EmbeddedDestinationConflictsFromAllSessions( |
|
456 aDestinationId, |
|
457 aEmbeddedDestinationId ); |
441 } |
458 } |
442 |
459 |
443 // ----------------------------------------------------------------------------- |
460 // ----------------------------------------------------------------------------- |
444 // Check for restrictions for adding an embedded destination from destination |
461 // Check for restrictions for adding an embedded destination from destination |
445 // instances of this session. |
462 // instances of this session. |
453 // - Check that any destination instance for aEmbeddedDestinationId does not |
470 // - Check that any destination instance for aEmbeddedDestinationId does not |
454 // contain an embedded destination. |
471 // contain an embedded destination. |
455 // ----------------------------------------------------------------------------- |
472 // ----------------------------------------------------------------------------- |
456 // |
473 // |
457 TBool CCmmSession::EmbeddedDestinationConflicts( |
474 TBool CCmmSession::EmbeddedDestinationConflicts( |
458 const TUint32& aDestinationId, |
475 const TUint32 aDestinationId, |
459 const TUint32& aEmbeddedDestinationId ) |
476 const TUint32 aEmbeddedDestinationId ) |
460 { |
477 { |
461 OstTraceFunctionEntry0( CCMMSESSION_EMBEDDEDDESTINATIONCONFLICTS_ENTRY ); |
478 OstTraceFunctionEntry0( CCMMSESSION_EMBEDDEDDESTINATIONCONFLICTS_ENTRY ); |
462 |
479 |
463 TBool result( EFalse ); |
480 TBool result( EFalse ); |
464 |
481 |
560 // Removes a connection method from any open destination handle in this |
577 // Removes a connection method from any open destination handle in this |
561 // session. |
578 // session. |
562 // --------------------------------------------------------------------------- |
579 // --------------------------------------------------------------------------- |
563 // |
580 // |
564 void CCmmSession::RemoveConnMethodFromDestinationHandles( |
581 void CCmmSession::RemoveConnMethodFromDestinationHandles( |
565 const TUint32& aConnMethodId ) |
582 const TUint32 aConnMethodId ) |
566 { |
583 { |
567 OstTraceFunctionEntry0( CCMMSESSION_REMOVECONNMETHODFROMDESTINATIONHANDLES_ENTRY ); |
584 OstTraceFunctionEntry0( CCMMSESSION_REMOVECONNMETHODFROMDESTINATIONHANDLES_ENTRY ); |
568 |
585 |
569 for ( TInt i = 0; i < iDestinationObjects->Count(); i++ ) |
586 for ( TInt i = 0; i < iDestinationObjects->Count(); i++ ) |
570 { |
587 { |
589 // --------------------------------------------------------------------------- |
606 // --------------------------------------------------------------------------- |
590 // Notify this session destination/connection method handles about an |
607 // Notify this session destination/connection method handles about an |
591 // updated/deleted destination/connection method. |
608 // updated/deleted destination/connection method. |
592 // --------------------------------------------------------------------------- |
609 // --------------------------------------------------------------------------- |
593 // |
610 // |
594 void CCmmSession::RefreshHandles( const TUint32& aId ) const |
611 void CCmmSession::RefreshHandles( const TUint32 aId ) const |
595 { |
612 { |
596 OstTraceFunctionEntry0( CCMMSESSION_REFRESHHANDLES_ENTRY ); |
613 OstTraceFunctionEntry0( CCMMSESSION_REFRESHHANDLES_ENTRY ); |
597 |
614 |
598 // Destination or connection method. |
615 // Destination or connection method. |
599 if ( aId < KCmmConnMethodIdIntervalMax ) |
616 if ( aId < KCmmConnMethodIdIntervalMax ) |
1015 |
1032 |
1016 OstTraceFunctionExit0( DUP1_CCMMSESSION_GETSUPPORTEDBEARERSL_EXIT ); |
1033 OstTraceFunctionExit0( DUP1_CCMMSESSION_GETSUPPORTEDBEARERSL_EXIT ); |
1017 } |
1034 } |
1018 |
1035 |
1019 // ----------------------------------------------------------------------------- |
1036 // ----------------------------------------------------------------------------- |
|
1037 // CCmmSession::GetUncategorizedIconL |
|
1038 // ----------------------------------------------------------------------------- |
|
1039 // |
|
1040 void CCmmSession::GetUncategorizedIconL( const RMessage2& aMessage ) |
|
1041 { |
|
1042 OstTraceFunctionEntry0( CCMMSESSION_GETUNCATEGORIZEDICONL_ENTRY ); |
|
1043 |
|
1044 HBufC* result = KCmmUncategorizedIconName().AllocLC(); |
|
1045 |
|
1046 TInt bufferLen = aMessage.GetDesMaxLength( 0 ); |
|
1047 if ( result->Length() > bufferLen ) |
|
1048 { |
|
1049 User::Leave( KErrArgument ); |
|
1050 } |
|
1051 |
|
1052 TPtrC resultPtr = result->Des(); |
|
1053 aMessage.WriteL( 0, resultPtr ); |
|
1054 CleanupStack::PopAndDestroy( result ); |
|
1055 |
|
1056 OstTraceFunctionExit0( CCMMSESSION_GETUNCATEGORIZEDICONL_EXIT ); |
|
1057 } |
|
1058 |
|
1059 // ----------------------------------------------------------------------------- |
1020 // CCmmSession::ReadDefaultConnectionL |
1060 // CCmmSession::ReadDefaultConnectionL |
1021 // ----------------------------------------------------------------------------- |
1061 // ----------------------------------------------------------------------------- |
1022 // |
1062 // |
1023 void CCmmSession::ReadDefaultConnectionL( const RMessage2& aMessage ) |
1063 void CCmmSession::ReadDefaultConnectionL( const RMessage2& aMessage ) |
1024 { |
1064 { |
1101 TInt maxBufLen( 2 ); |
1141 TInt maxBufLen( 2 ); |
1102 // Check the length needed for serializing. |
1142 // Check the length needed for serializing. |
1103 for ( TInt i = 0; i < bearerCountInArray; i++ ) |
1143 for ( TInt i = 0; i < bearerCountInArray; i++ ) |
1104 { |
1144 { |
1105 // Skip if service type is not valid. |
1145 // Skip if service type is not valid. |
1106 if ( bearerPriorityArray[i]->ServiceType() && bearerPriorityArray[i]->ServiceType()->Length() > 0 ) |
1146 if ( bearerPriorityArray[i]->ServiceType() && |
|
1147 bearerPriorityArray[i]->ServiceType()->Length() > 0 ) |
1107 { |
1148 { |
1108 maxBufLen += KCmmBearerPriorityHeaderLength; // Priorities and servicetype length. |
1149 maxBufLen += KCmmBearerPriorityHeaderLength; // Priorities and servicetype length. |
1109 maxBufLen += bearerPriorityArray[i]->ServiceType()->Length(); |
1150 maxBufLen += bearerPriorityArray[i]->ServiceType()->Length(); |
1110 } |
1151 } |
1111 else |
1152 else |
1139 bufferPtr.Append( maxBufLen ); |
1180 bufferPtr.Append( maxBufLen ); |
1140 |
1181 |
1141 for ( TInt i = 0; i < bearerCountInArray; i++ ) |
1182 for ( TInt i = 0; i < bearerCountInArray; i++ ) |
1142 { |
1183 { |
1143 // Skip if service type is not valid. |
1184 // Skip if service type is not valid. |
1144 if ( bearerPriorityArray[i]->ServiceType() && bearerPriorityArray[i]->ServiceType()->Length() > 0 ) |
1185 if ( bearerPriorityArray[i]->ServiceType() && |
|
1186 bearerPriorityArray[i]->ServiceType()->Length() > 0 ) |
1145 { |
1187 { |
1146 TUint32 priority = bearerPriorityArray[i]->Priority(); |
1188 TUint32 priority = bearerPriorityArray[i]->Priority(); |
1147 TUint32 uiPriority = bearerPriorityArray[i]->UiPriority(); |
1189 TUint32 uiPriority = bearerPriorityArray[i]->UiPriority(); |
1148 const HBufC* serviceType = bearerPriorityArray[i]->ServiceType(); |
1190 const HBufC* serviceType = bearerPriorityArray[i]->ServiceType(); |
1149 |
1191 |
1170 // ----------------------------------------------------------------------------- |
1212 // ----------------------------------------------------------------------------- |
1171 // |
1213 // |
1172 void CCmmSession::UpdateBearerPriorityArrayL( const RMessage2& aMessage ) |
1214 void CCmmSession::UpdateBearerPriorityArrayL( const RMessage2& aMessage ) |
1173 { |
1215 { |
1174 OstTraceFunctionEntry0( CCMMSESSION_UPDATEBEARERPRIORITYARRAYL_ENTRY ); |
1216 OstTraceFunctionEntry0( CCMMSESSION_UPDATEBEARERPRIORITYARRAYL_ENTRY ); |
|
1217 |
|
1218 // Check the disk space. |
|
1219 if ( CheckSpaceBelowCriticalLevelL() ) |
|
1220 { |
|
1221 User::Leave( KErrDiskFull ); |
|
1222 } |
1175 |
1223 |
1176 HBufC* bearerPriorityBuf = HBufC::NewLC( aMessage.GetDesMaxLengthL( 0 ) ); |
1224 HBufC* bearerPriorityBuf = HBufC::NewLC( aMessage.GetDesMaxLengthL( 0 ) ); |
1177 TPtr bearerPriorityBufPtr( bearerPriorityBuf->Des() ); |
1225 TPtr bearerPriorityBufPtr( bearerPriorityBuf->Des() ); |
1178 |
1226 |
1179 aMessage.ReadL( 0, bearerPriorityBufPtr ); |
1227 aMessage.ReadL( 0, bearerPriorityBufPtr ); |
1211 HBufC* serviceName = HBufC::NewLC( stringLength ); |
1259 HBufC* serviceName = HBufC::NewLC( stringLength ); |
1212 serviceName->Des().Append( &( bearerPriorityBufPtr[position] ), stringLength ); |
1260 serviceName->Des().Append( &( bearerPriorityBufPtr[position] ), stringLength ); |
1213 position += stringLength; |
1261 position += stringLength; |
1214 |
1262 |
1215 TPtrC tempServiceType( serviceName->Des() ); |
1263 TPtrC tempServiceType( serviceName->Des() ); |
1216 CCmmBearerPriority* item = CCmmBearerPriority::NewLC( tempServiceType, priority, uiPriority ); |
1264 CCmmBearerPriority* item = CCmmBearerPriority::NewLC( |
|
1265 tempServiceType, |
|
1266 priority, |
|
1267 uiPriority ); |
1217 bearerPriorityArray.AppendL( item ); |
1268 bearerPriorityArray.AppendL( item ); |
1218 CleanupStack::Pop( item ); |
1269 CleanupStack::Pop( item ); |
1219 |
1270 |
1220 CleanupStack::PopAndDestroy( serviceName ); |
1271 CleanupStack::PopAndDestroy( serviceName ); |
1221 } |
1272 } |
1238 // |
1289 // |
1239 void CCmmSession::CopyConnMethodL( const RMessage2& aMessage ) |
1290 void CCmmSession::CopyConnMethodL( const RMessage2& aMessage ) |
1240 { |
1291 { |
1241 OstTraceFunctionEntry0( CCMMSESSION_COPYCONNMETHODL_ENTRY ); |
1292 OstTraceFunctionEntry0( CCMMSESSION_COPYCONNMETHODL_ENTRY ); |
1242 |
1293 |
1243 CCmmDestinationInstance* destination = ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() ); |
1294 // Check the disk space. |
1244 CCmmConnMethodInstance* connMethod = ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int1() ); |
1295 if ( CheckSpaceBelowCriticalLevelL() ) |
|
1296 { |
|
1297 User::Leave( KErrDiskFull ); |
|
1298 } |
|
1299 |
|
1300 CCmmDestinationInstance* destination = |
|
1301 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() ); |
|
1302 CCmmConnMethodInstance* connMethod = |
|
1303 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int1() ); |
1245 |
1304 |
1246 // Can't add an embedded destination this way. |
1305 // Can't add an embedded destination this way. |
1247 if ( connMethod->IsEmbeddedDestination() ) |
1306 if ( connMethod->IsEmbeddedDestination() ) |
1248 { |
1307 { |
1249 User::Leave( KErrArgument ); |
1308 User::Leave( KErrArgument ); |
1250 } |
1309 } |
1251 |
1310 |
1252 //TODO, capability check, what to do if anything is protected. |
1311 // Check the protection level of the destination. |
|
1312 // And based on that check the needed capabilities from the client. |
|
1313 CMManager::TProtectionLevel protLevel( CMManager::EProtLevel0 ); |
|
1314 destination->GetProtectionL( protLevel ); |
|
1315 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
1316 if ( protLevel == CMManager::EProtLevel1 ) |
|
1317 { |
|
1318 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
1319 } |
|
1320 |
|
1321 if ( capabilities == CPolicyServer::EFail ) |
|
1322 { |
|
1323 User::Leave( KErrPermissionDenied ); |
|
1324 } |
1253 |
1325 |
1254 // Add connection method into destination. |
1326 // Add connection method into destination. |
1255 TInt index = destination->AddConnMethodL( *connMethod ); |
1327 TInt index = destination->AddConnMethodL( *connMethod ); |
1256 |
1328 |
1257 // Update destination into database. |
1329 // Update destination into database. |
1271 // ----------------------------------------------------------------------------- |
1343 // ----------------------------------------------------------------------------- |
1272 // |
1344 // |
1273 void CCmmSession::MoveConnMethodL( const RMessage2& aMessage ) |
1345 void CCmmSession::MoveConnMethodL( const RMessage2& aMessage ) |
1274 { |
1346 { |
1275 OstTraceFunctionEntry0( CCMMSESSION_MOVECONNMETHODL_ENTRY ); |
1347 OstTraceFunctionEntry0( CCMMSESSION_MOVECONNMETHODL_ENTRY ); |
|
1348 |
|
1349 // Check the disk space. |
|
1350 if ( CheckSpaceBelowCriticalLevelL() ) |
|
1351 { |
|
1352 User::Leave( KErrDiskFull ); |
|
1353 } |
1276 |
1354 |
1277 // Read data from client request. |
1355 // Read data from client request. |
1278 TPckgBuf<TCmmIpcStructMoveConnMethod> attributesPckg; |
1356 TPckgBuf<TCmmIpcStructMoveConnMethod> attributesPckg; |
1279 aMessage.ReadL( 0, attributesPckg ); |
1357 aMessage.ReadL( 0, attributesPckg ); |
1280 TCmmIpcStructMoveConnMethod attributes = attributesPckg(); |
1358 TCmmIpcStructMoveConnMethod attributes = attributesPckg(); |
1311 if ( iCache.CheckIfCmConnected( connMethodId ) ) |
1389 if ( iCache.CheckIfCmConnected( connMethodId ) ) |
1312 { |
1390 { |
1313 User::Leave( KErrInUse ); |
1391 User::Leave( KErrInUse ); |
1314 } |
1392 } |
1315 |
1393 |
1316 //TODO, capability checks, what to do if anything is protected. |
1394 // Check the protection level of the source and target destination. |
|
1395 // And based on those check the needed capabilities from the client. |
|
1396 TBool protectionExists( EFalse ); |
|
1397 CMManager::TProtectionLevel protLevelSource( CMManager::EProtLevel0 ); |
|
1398 sourceDestination->GetProtectionL( protLevelSource ); |
|
1399 if ( protLevelSource == CMManager::EProtLevel1 |
|
1400 || protLevelSource == CMManager::EProtLevel3 ) |
|
1401 { |
|
1402 protectionExists = ETrue; |
|
1403 } |
|
1404 |
|
1405 // If source destination is not protected check the target destination. |
|
1406 if ( !protectionExists ) |
|
1407 { |
|
1408 CMManager::TProtectionLevel protLevelTarget( CMManager::EProtLevel0 ); |
|
1409 targetDestination->GetProtectionL( protLevelTarget ); |
|
1410 if ( protLevelTarget == CMManager::EProtLevel1 ) |
|
1411 { |
|
1412 protectionExists = ETrue; |
|
1413 } |
|
1414 } |
|
1415 |
|
1416 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
1417 if ( protectionExists ) |
|
1418 { |
|
1419 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
1420 } |
|
1421 |
|
1422 if ( capabilities == CPolicyServer::EFail ) |
|
1423 { |
|
1424 User::Leave( KErrPermissionDenied ); |
|
1425 } |
1317 |
1426 |
1318 // Add connection method into target destination and update it. |
1427 // Add connection method into target destination and update it. |
1319 attributesPckg().iIndex = targetDestination->AddConnMethodL( *connMethod ); |
1428 attributesPckg().iIndex = targetDestination->AddConnMethodL( *connMethod ); |
1320 targetDestination->UpdateL(); |
1429 targetDestination->UpdateL(); |
1321 |
1430 |
1341 CCmmDestinationInstance* destinationInstance = |
1450 CCmmDestinationInstance* destinationInstance = |
1342 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() ); |
1451 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() ); |
1343 CCmmConnMethodInstance* connMethodInstance = |
1452 CCmmConnMethodInstance* connMethodInstance = |
1344 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int1() ); |
1453 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int1() ); |
1345 |
1454 |
1346 //TODO, capability checks |
1455 // Check the protection level of the destination. |
|
1456 // And based on that check the needed capabilities from the client. |
|
1457 CMManager::TProtectionLevel protLevel( CMManager::EProtLevel0 ); |
|
1458 destinationInstance->GetProtectionL( protLevel ); |
|
1459 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
1460 if ( protLevel == CMManager::EProtLevel1 || protLevel == CMManager::EProtLevel3 ) |
|
1461 { |
|
1462 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
1463 } |
|
1464 |
|
1465 if ( capabilities == CPolicyServer::EFail ) |
|
1466 { |
|
1467 User::Leave( KErrPermissionDenied ); |
|
1468 } |
1347 |
1469 |
1348 destinationInstance->RemoveConnMethodFromDestinationL( *connMethodInstance ); |
1470 destinationInstance->RemoveConnMethodFromDestinationL( *connMethodInstance ); |
1349 destinationInstance->UpdateL(); |
1471 destinationInstance->UpdateL(); |
1350 |
1472 |
1351 OstTraceFunctionExit0( CCMMSESSION_REMOVECONNMETHODL_EXIT ); |
1473 OstTraceFunctionExit0( CCMMSESSION_REMOVECONNMETHODL_EXIT ); |
1361 OstTraceFunctionEntry0( CCMMSESSION_REMOVEALLREFERENCESL_ENTRY ); |
1483 OstTraceFunctionEntry0( CCMMSESSION_REMOVEALLREFERENCESL_ENTRY ); |
1362 |
1484 |
1363 CCmmConnMethodInstance* connMethodInstance = |
1485 CCmmConnMethodInstance* connMethodInstance = |
1364 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
1486 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
1365 |
1487 |
|
1488 TBool capabilityCheckNeeded( EFalse ); |
|
1489 iCache.CheckIfConnMethodBelongsToProtectedDestinationL( |
|
1490 *connMethodInstance, |
|
1491 capabilityCheckNeeded ); |
|
1492 if ( capabilityCheckNeeded ) |
|
1493 { |
|
1494 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
1495 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
1496 if ( capabilities == CPolicyServer::EFail ) |
|
1497 { |
|
1498 User::Leave( KErrPermissionDenied ); |
|
1499 } |
|
1500 } |
|
1501 |
1366 iCache.CheckIfConnMethodReferencesCanBeRemovedL( *connMethodInstance ); |
1502 iCache.CheckIfConnMethodReferencesCanBeRemovedL( *connMethodInstance ); |
1367 iCache.RemoveAllReferencesToConnMethodL( *connMethodInstance ); |
1503 iCache.RemoveAllReferencesToConnMethodL( *connMethodInstance ); |
1368 |
1504 |
1369 OstTraceFunctionExit0( CCMMSESSION_REMOVEALLREFERENCESL_EXIT ); |
1505 OstTraceFunctionExit0( CCMMSESSION_REMOVEALLREFERENCESL_EXIT ); |
1370 } |
1506 } |
1683 { |
1829 { |
1684 User::Leave( KErrArgument ); |
1830 User::Leave( KErrArgument ); |
1685 } |
1831 } |
1686 |
1832 |
1687 // Check if a destination with given ID exists (or is already created but not saved). |
1833 // Check if a destination with given ID exists (or is already created but not saved). |
1688 if ( iCache.DestinationExistsWithId( destinationId ) || |
1834 //TODO, Implement one single method for this check in CCmmCache-class, and call that. CCmmCache::DestinationOpenWithId() can be removed after that. |
1689 iCache.DestinationOpenWithId( destinationId ) ) |
1835 if ( iCache.DestinationExistsWithId( destinationId ) || iCache.DestinationOpenWithId( destinationId ) ) |
1690 { |
1836 { |
1691 User::Leave( KErrAlreadyExists ); |
1837 User::Leave( KErrAlreadyExists ); |
|
1838 //TODO: Destination ID is decided based on network record ID. Connection methods also use network records. |
|
1839 //TODO: Add a check here too see that the necessary network record ID is also available. |
1692 } |
1840 } |
1693 |
1841 |
1694 // Load and check name. |
1842 // Load and check name. |
1695 TInt destNameLength = aMessage.GetDesLength( 0 ); |
1843 TInt destNameLength = aMessage.GetDesLength( 0 ); |
1696 if ( destNameLength <= 0 ) |
1844 if ( destNameLength <= 0 ) |
1802 |
1950 |
1803 // Leave if given connection method is not inside this destination. |
1951 // Leave if given connection method is not inside this destination. |
1804 User::LeaveIfError( index ); |
1952 User::LeaveIfError( index ); |
1805 |
1953 |
1806 // Check if the connection method is an embedded destination. |
1954 // Check if the connection method is an embedded destination. |
1807 if ( connMethodInstance->GetBearerType() == KUidEmbeddedDestination ) |
1955 if ( connMethodInstance->IsEmbeddedDestination() ) |
1808 { |
1956 { |
1809 index = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
1957 index = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
1810 } |
1958 } |
1811 |
1959 |
1812 //TODO, what if CM is virtual? |
1960 // If this is a virtual IAP that doesn't link to an IAP, the priority is wildcard. |
|
1961 else if ( connMethodInstance->GetBoolAttributeL( CMManager::ECmVirtual ) ) |
|
1962 { |
|
1963 if ( connMethodInstance->GetIntAttributeL( CMManager::ECmNextLayerIapId ) == 0 ) |
|
1964 { |
|
1965 index = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; |
|
1966 } |
|
1967 } |
1813 |
1968 |
1814 TUint priority = ( TUint )index; |
1969 TUint priority = ( TUint )index; |
1815 TPckg<TUint> priorityPckg( priority ); |
1970 TPckg<TUint> priorityPckg( priority ); |
1816 aMessage.WriteL( 1, priorityPckg ); |
1971 aMessage.WriteL( 1, priorityPckg ); |
1817 |
1972 |
1842 aMessage.WriteL( 0, namePtr ); |
1997 aMessage.WriteL( 0, namePtr ); |
1843 |
1998 |
1844 CleanupStack::PopAndDestroy( name ); |
1999 CleanupStack::PopAndDestroy( name ); |
1845 |
2000 |
1846 OstTraceFunctionExit0( CCMMSESSION_GETDESTINATIONNAMEL_EXIT ); |
2001 OstTraceFunctionExit0( CCMMSESSION_GETDESTINATIONNAMEL_EXIT ); |
|
2002 } |
|
2003 |
|
2004 // ----------------------------------------------------------------------------- |
|
2005 // CCmmSession::GetDestinationIconL |
|
2006 // ----------------------------------------------------------------------------- |
|
2007 // |
|
2008 void CCmmSession::GetDestinationIconL( const RMessage2& aMessage ) |
|
2009 { |
|
2010 OstTraceFunctionEntry0( CCMMSESSION_GETDESTINATIONICONL_ENTRY ); |
|
2011 |
|
2012 CCmmDestinationInstance* destinationInstance = |
|
2013 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2014 |
|
2015 HBufC* icon = destinationInstance->GetDestinationIconL(); |
|
2016 CleanupStack::PushL( icon ); |
|
2017 TPtrC iconPtr( icon->Des() ); |
|
2018 |
|
2019 TInt bufferLen = aMessage.GetDesMaxLength( 0 ); |
|
2020 if ( iconPtr.Length() > bufferLen ) |
|
2021 { |
|
2022 User::Leave( KErrArgument ); |
|
2023 } |
|
2024 |
|
2025 aMessage.WriteL( 0, iconPtr ); |
|
2026 CleanupStack::PopAndDestroy( icon ); |
|
2027 |
|
2028 OstTraceFunctionExit0( CCMMSESSION_GETDESTINATIONICONL_EXIT ); |
1847 } |
2029 } |
1848 |
2030 |
1849 // ----------------------------------------------------------------------------- |
2031 // ----------------------------------------------------------------------------- |
1850 // CCmmSession::GetDestinationIdL |
2032 // CCmmSession::GetDestinationIdL |
1851 // ----------------------------------------------------------------------------- |
2033 // ----------------------------------------------------------------------------- |
2010 { |
2192 { |
2011 OstTraceFunctionEntry0( CCMMSESSION_DESTADDCONNMETHODL_ENTRY ); |
2193 OstTraceFunctionEntry0( CCMMSESSION_DESTADDCONNMETHODL_ENTRY ); |
2012 |
2194 |
2013 CCmmDestinationInstance* destination = |
2195 CCmmDestinationInstance* destination = |
2014 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2196 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2197 |
|
2198 // Check the protection and if protected check the needed capabilities. |
|
2199 CMManager::TProtectionLevel protLevel = |
|
2200 destination->CurrentProtectionLevelL(); |
|
2201 if ( protLevel == CMManager::EProtLevel1 ) |
|
2202 { |
|
2203 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2204 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2205 if ( capabilities == CPolicyServer::EFail ) |
|
2206 { |
|
2207 User::Leave( KErrPermissionDenied ); |
|
2208 } |
|
2209 } |
|
2210 |
2015 CCmmConnMethodInstance* connMethod = |
2211 CCmmConnMethodInstance* connMethod = |
2016 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2212 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2017 |
2213 |
2018 if ( connMethod->IsEmbeddedDestination() ) |
2214 if ( connMethod->IsEmbeddedDestination() ) |
2019 { |
2215 { |
2033 // |
2229 // |
2034 void CCmmSession::DestAddEmbeddedDestinationL( const RMessage2& aMessage ) |
2230 void CCmmSession::DestAddEmbeddedDestinationL( const RMessage2& aMessage ) |
2035 { |
2231 { |
2036 OstTraceFunctionEntry0( CCMMSESSION_DESTADDEMBEDDEDDESTINATIONL_ENTRY ); |
2232 OstTraceFunctionEntry0( CCMMSESSION_DESTADDEMBEDDEDDESTINATIONL_ENTRY ); |
2037 |
2233 |
2038 CCmmDestinationInstance* destination = |
2234 CCmmDestinationInstance* destinationInstance = |
2039 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2235 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2236 |
|
2237 // Check the protection and if protected check the needed capabilities. |
|
2238 CMManager::TProtectionLevel protLevel = |
|
2239 destinationInstance->CurrentProtectionLevelL(); |
|
2240 if ( protLevel == CMManager::EProtLevel1 ) |
|
2241 { |
|
2242 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2243 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2244 if ( capabilities == CPolicyServer::EFail ) |
|
2245 { |
|
2246 User::Leave( KErrPermissionDenied ); |
|
2247 } |
|
2248 } |
|
2249 |
2040 CCmmDestinationInstance* embeddedDestination = |
2250 CCmmDestinationInstance* embeddedDestination = |
2041 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() ); |
2251 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() ); |
2042 |
2252 |
2043 TInt index = destination->AddEmbeddedDestinationL( *embeddedDestination ); |
2253 TInt index = destinationInstance->AddEmbeddedDestinationL( *embeddedDestination ); |
2044 TPckg<TInt> indexPckg( index ); |
2254 TPckg<TInt> indexPckg( index ); |
2045 aMessage.WriteL( 1, indexPckg ); |
2255 aMessage.WriteL( 1, indexPckg ); |
2046 |
2256 |
2047 OstTraceFunctionExit0( CCMMSESSION_DESTADDEMBEDDEDDESTINATIONL_EXIT ); |
2257 OstTraceFunctionExit0( CCMMSESSION_DESTADDEMBEDDEDDESTINATIONL_EXIT ); |
2048 } |
2258 } |
2057 |
2267 |
2058 CCmmDestinationInstance* destinationInstance = |
2268 CCmmDestinationInstance* destinationInstance = |
2059 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2269 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2060 CCmmConnMethodInstance* connMethodInstance = |
2270 CCmmConnMethodInstance* connMethodInstance = |
2061 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2271 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2062 |
2272 |
2063 //TODO, capability checks |
2273 // Check the protection of destination and if protected check the needed |
|
2274 // capabilities. |
|
2275 CMManager::TProtectionLevel protLevel = |
|
2276 destinationInstance->CurrentProtectionLevelL(); |
|
2277 if ( protLevel == CMManager::EProtLevel1 || |
|
2278 protLevel == CMManager::EProtLevel3 ) |
|
2279 { |
|
2280 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2281 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2282 if ( capabilities == CPolicyServer::EFail ) |
|
2283 { |
|
2284 User::Leave( KErrPermissionDenied ); |
|
2285 } |
|
2286 } |
|
2287 |
|
2288 // Check the protection of CM and if protected check the needed |
|
2289 // capabilities. |
|
2290 CheckCapabilitiesForProtectedCML( aMessage, connMethodInstance ); |
2064 |
2291 |
2065 destinationInstance->DeleteConnMethodFromDestinationL( *connMethodInstance ); |
2292 destinationInstance->DeleteConnMethodFromDestinationL( *connMethodInstance ); |
2066 |
2293 |
2067 OstTraceFunctionExit0( CCMMSESSION_DESTDELETECONNMETHODL_EXIT ); |
2294 OstTraceFunctionExit0( CCMMSESSION_DESTDELETECONNMETHODL_EXIT ); |
2068 } |
2295 } |
2078 CCmmDestinationInstance* destinationInstance = |
2305 CCmmDestinationInstance* destinationInstance = |
2079 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2306 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2080 CCmmConnMethodInstance* connMethodInstance = |
2307 CCmmConnMethodInstance* connMethodInstance = |
2081 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2308 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2082 |
2309 |
2083 //TODO, capability checks |
2310 // Check the protection of destination and if protected check the needed |
|
2311 // capabilities. |
|
2312 CMManager::TProtectionLevel protLevel = |
|
2313 destinationInstance->CurrentProtectionLevelL(); |
|
2314 if ( protLevel == CMManager::EProtLevel1 || |
|
2315 protLevel == CMManager::EProtLevel3 ) |
|
2316 { |
|
2317 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2318 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2319 if ( capabilities == CPolicyServer::EFail ) |
|
2320 { |
|
2321 User::Leave( KErrPermissionDenied ); |
|
2322 } |
|
2323 } |
2084 |
2324 |
2085 destinationInstance->RemoveConnMethodFromDestinationL( *connMethodInstance ); |
2325 destinationInstance->RemoveConnMethodFromDestinationL( *connMethodInstance ); |
2086 |
2326 |
2087 OstTraceFunctionExit0( CCMMSESSION_DESTREMOVECONNMETHODL_EXIT ); |
2327 OstTraceFunctionExit0( CCMMSESSION_DESTREMOVECONNMETHODL_EXIT ); |
2088 } |
2328 } |
2095 { |
2335 { |
2096 OstTraceFunctionEntry0( CCMMSESSION_MODIFYCONNMETHODPRIORITYL_ENTRY ); |
2336 OstTraceFunctionEntry0( CCMMSESSION_MODIFYCONNMETHODPRIORITYL_ENTRY ); |
2097 |
2337 |
2098 CCmmDestinationInstance* destinationInstance = |
2338 CCmmDestinationInstance* destinationInstance = |
2099 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2339 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2340 |
|
2341 // Check the protection of destination and if protected check the needed |
|
2342 // capabilities. |
|
2343 CMManager::TProtectionLevel protLevel = |
|
2344 destinationInstance->CurrentProtectionLevelL(); |
|
2345 if ( protLevel == CMManager::EProtLevel1 || |
|
2346 protLevel == CMManager::EProtLevel3 ) |
|
2347 { |
|
2348 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2349 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2350 if ( capabilities == CPolicyServer::EFail ) |
|
2351 { |
|
2352 User::Leave( KErrPermissionDenied ); |
|
2353 } |
|
2354 } |
|
2355 |
2100 CCmmConnMethodInstance* connMethodInstance = |
2356 CCmmConnMethodInstance* connMethodInstance = |
2101 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2357 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() ); |
2102 |
2358 |
2103 //TODO, capability checks |
|
2104 |
|
2105 // Index values start from 0 (0 meaning highest priority). |
2359 // Index values start from 0 (0 meaning highest priority). |
2106 TUint index( ( TUint )aMessage.Int1() ); |
2360 TUint index( ( TUint )aMessage.Int1() ); |
2107 |
2361 |
2108 destinationInstance->ModifyConnMethodPriorityL( *connMethodInstance, index ); |
2362 destinationInstance->ModifyConnMethodPriorityL( *connMethodInstance, index ); |
2109 |
2363 |
2118 { |
2372 { |
2119 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONNAMEL_ENTRY ); |
2373 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONNAMEL_ENTRY ); |
2120 |
2374 |
2121 CCmmDestinationInstance* destinationInstance = |
2375 CCmmDestinationInstance* destinationInstance = |
2122 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2376 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2377 |
|
2378 // Check that client does not try to change the name of the Internet Destination. |
|
2379 TUint32 metadata( 0 ); |
|
2380 destinationInstance->GetMetadataL( CMManager::ESnapMetadataPurpose, metadata ); |
|
2381 if ( metadata == CMManager::ESnapPurposeInternet ) |
|
2382 { |
|
2383 User::Leave( KErrPermissionDenied ); |
|
2384 } |
|
2385 |
|
2386 // Check the protection and if protected check the needed capabilities. |
|
2387 CMManager::TProtectionLevel protLevel = |
|
2388 destinationInstance->CurrentProtectionLevelL(); |
|
2389 if ( protLevel == CMManager::EProtLevel1 || |
|
2390 protLevel == CMManager::EProtLevel2 ) |
|
2391 { |
|
2392 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2393 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2394 if ( capabilities == CPolicyServer::EFail ) |
|
2395 { |
|
2396 User::Leave( KErrPermissionDenied ); |
|
2397 } |
|
2398 } |
2123 |
2399 |
2124 // Load and check name. |
2400 // Load and check name. |
2125 TInt destNameLength = aMessage.GetDesLength( 0 ); |
2401 TInt destNameLength = aMessage.GetDesLength( 0 ); |
2126 if ( destNameLength <= 0 ) |
2402 if ( destNameLength <= 0 ) |
2127 { |
2403 { |
2145 |
2421 |
2146 OstTraceFunctionExit0( CCMMSESSION_SETDESTINATIONNAMEL_EXIT ); |
2422 OstTraceFunctionExit0( CCMMSESSION_SETDESTINATIONNAMEL_EXIT ); |
2147 } |
2423 } |
2148 |
2424 |
2149 // ----------------------------------------------------------------------------- |
2425 // ----------------------------------------------------------------------------- |
2150 // CCmmSession::SetDestinationMetadataL |
2426 // CCmmSession::SetDestinationIconL |
2151 // ----------------------------------------------------------------------------- |
2427 // ----------------------------------------------------------------------------- |
2152 // |
2428 // |
2153 void CCmmSession::SetDestinationMetadataL( const RMessage2& aMessage ) |
2429 void CCmmSession::SetDestinationIconL( const RMessage2& aMessage ) |
2154 { |
2430 { |
2155 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONMETADATAL_ENTRY ); |
2431 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONICONL_ENTRY ); |
2156 |
|
2157 //TODO, Capability check. Protection level or Internet destination. |
|
2158 |
2432 |
2159 CCmmDestinationInstance* destinationInstance = |
2433 CCmmDestinationInstance* destinationInstance = |
2160 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2434 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2435 |
|
2436 // Check the protection and if protected check the needed capabilities. |
|
2437 CMManager::TProtectionLevel protLevel = |
|
2438 destinationInstance->CurrentProtectionLevelL(); |
|
2439 if ( protLevel == CMManager::EProtLevel1 || |
|
2440 protLevel == CMManager::EProtLevel2 ) |
|
2441 { |
|
2442 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2443 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2444 if ( capabilities == CPolicyServer::EFail ) |
|
2445 { |
|
2446 User::Leave( KErrPermissionDenied ); |
|
2447 } |
|
2448 } |
|
2449 |
|
2450 // Load and check name. |
|
2451 TInt destIconNameLength = aMessage.GetDesLength( 0 ); |
|
2452 if ( destIconNameLength < 0 || destIconNameLength > KCmmStringLengthMax ) |
|
2453 { |
|
2454 User::Leave( KErrArgument ); |
|
2455 } |
|
2456 |
|
2457 HBufC* newIconName = HBufC::NewLC( destIconNameLength ); |
|
2458 TPtr ptrNewIconName = newIconName->Des(); |
|
2459 aMessage.ReadL( 0, ptrNewIconName ); |
|
2460 |
|
2461 destinationInstance->SetDestinationIconL( *newIconName ); |
|
2462 CleanupStack::PopAndDestroy( newIconName ); |
|
2463 |
|
2464 OstTraceFunctionExit0( CCMMSESSION_SETDESTINATIONICONL_EXIT ); |
|
2465 } |
|
2466 |
|
2467 // ----------------------------------------------------------------------------- |
|
2468 // CCmmSession::SetDestinationMetadataL |
|
2469 // ----------------------------------------------------------------------------- |
|
2470 // |
|
2471 void CCmmSession::SetDestinationMetadataL( const RMessage2& aMessage ) |
|
2472 { |
|
2473 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONMETADATAL_ENTRY ); |
|
2474 |
|
2475 CCmmDestinationInstance* destinationInstance = |
|
2476 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2477 |
|
2478 // Check the protection and if protected check the needed capabilities. |
|
2479 CMManager::TProtectionLevel protLevel = |
|
2480 destinationInstance->CurrentProtectionLevelL(); |
|
2481 if ( protLevel == CMManager::EProtLevel1 || |
|
2482 protLevel == CMManager::EProtLevel2 ) |
|
2483 { |
|
2484 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2485 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2486 if ( capabilities == CPolicyServer::EFail ) |
|
2487 { |
|
2488 User::Leave( KErrPermissionDenied ); |
|
2489 } |
|
2490 } |
2161 |
2491 |
2162 CMManager::TSnapMetadataField metadataField = |
2492 CMManager::TSnapMetadataField metadataField = |
2163 ( CMManager::TSnapMetadataField )aMessage.Int0(); |
2493 ( CMManager::TSnapMetadataField )aMessage.Int0(); |
2164 TUint32 metadata = aMessage.Int1(); |
2494 TUint32 metadata = aMessage.Int1(); |
2165 |
2495 |
2174 // |
2504 // |
2175 void CCmmSession::SetDestinationProtectionL( const RMessage2& aMessage ) |
2505 void CCmmSession::SetDestinationProtectionL( const RMessage2& aMessage ) |
2176 { |
2506 { |
2177 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONPROTECTIONL_ENTRY ); |
2507 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONPROTECTIONL_ENTRY ); |
2178 |
2508 |
2179 //TODO, Capability check: ECapabilityNetworkControl |
2509 // Check the needed capabilities. |
|
2510 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2511 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2512 if ( capabilities == CPolicyServer::EFail ) |
|
2513 { |
|
2514 User::Leave( KErrPermissionDenied ); |
|
2515 } |
2180 |
2516 |
2181 CCmmDestinationInstance* destinationInstance = |
2517 CCmmDestinationInstance* destinationInstance = |
2182 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2518 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2183 CMManager::TProtectionLevel protLevel = |
2519 CMManager::TProtectionLevel protLevel = |
2184 ( CMManager::TProtectionLevel )aMessage.Int0(); |
2520 ( CMManager::TProtectionLevel )aMessage.Int0(); |
2196 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONHIDDENL_ENTRY ); |
2532 OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONHIDDENL_ENTRY ); |
2197 |
2533 |
2198 CCmmDestinationInstance* destinationInstance = |
2534 CCmmDestinationInstance* destinationInstance = |
2199 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2535 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2200 |
2536 |
|
2537 // Check the protection and if protected check the needed capabilities. |
|
2538 CMManager::TProtectionLevel protLevel = |
|
2539 destinationInstance->CurrentProtectionLevelL(); |
|
2540 if ( protLevel == CMManager::EProtLevel1 || |
|
2541 protLevel == CMManager::EProtLevel2 ) |
|
2542 { |
|
2543 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2544 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2545 if ( capabilities == CPolicyServer::EFail ) |
|
2546 { |
|
2547 User::Leave( KErrPermissionDenied ); |
|
2548 } |
|
2549 } |
|
2550 |
2201 TBool hidden = aMessage.Int0(); |
2551 TBool hidden = aMessage.Int0(); |
2202 destinationInstance->SetMetadataL( CMManager::ESnapMetadataHiddenAgent, hidden ); |
2552 destinationInstance->SetMetadataL( CMManager::ESnapMetadataHiddenAgent, hidden ); |
2203 |
2553 |
2204 OstTraceFunctionExit0( CCMMSESSION_SETDESTINATIONHIDDENL_EXIT ); |
2554 OstTraceFunctionExit0( CCMMSESSION_SETDESTINATIONHIDDENL_EXIT ); |
2205 } |
2555 } |
2210 // |
2560 // |
2211 void CCmmSession::UpdateDestinationL( const RMessage2& aMessage ) |
2561 void CCmmSession::UpdateDestinationL( const RMessage2& aMessage ) |
2212 { |
2562 { |
2213 OstTraceFunctionEntry0( CCMMSESSION_UPDATEDESTINATIONL_ENTRY ); |
2563 OstTraceFunctionEntry0( CCMMSESSION_UPDATEDESTINATIONL_ENTRY ); |
2214 |
2564 |
|
2565 // Check the disk space. |
|
2566 if ( CheckSpaceBelowCriticalLevelL() ) |
|
2567 { |
|
2568 User::Leave( KErrDiskFull ); |
|
2569 } |
|
2570 |
2215 CCmmDestinationInstance* destinationInstance = |
2571 CCmmDestinationInstance* destinationInstance = |
2216 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2572 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2573 |
|
2574 // Check the protection and if protected check the needed capabilities |
|
2575 CMManager::TProtectionLevel protLevel = |
|
2576 destinationInstance->CurrentProtectionLevelL(); |
|
2577 if ( protLevel == CMManager::EProtLevel1 || |
|
2578 protLevel == CMManager::EProtLevel2 || |
|
2579 protLevel == CMManager::EProtLevel3 ) |
|
2580 { |
|
2581 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2582 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2583 if ( capabilities == CPolicyServer::EFail ) |
|
2584 { |
|
2585 User::Leave( KErrPermissionDenied ); |
|
2586 } |
|
2587 } |
|
2588 |
2217 destinationInstance->UpdateL(); |
2589 destinationInstance->UpdateL(); |
2218 |
2590 |
2219 OstTraceFunctionExit0( CCMMSESSION_UPDATEDESTINATIONL_EXIT ); |
2591 OstTraceFunctionExit0( CCMMSESSION_UPDATEDESTINATIONL_EXIT ); |
2220 } |
2592 } |
2221 |
2593 |
2227 { |
2599 { |
2228 OstTraceFunctionEntry0( CCMMSESSION_DELETEDESTINATIONL_ENTRY ); |
2600 OstTraceFunctionEntry0( CCMMSESSION_DELETEDESTINATIONL_ENTRY ); |
2229 |
2601 |
2230 CCmmDestinationInstance* destinationInstance = |
2602 CCmmDestinationInstance* destinationInstance = |
2231 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
2603 ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() ); |
|
2604 |
|
2605 // Check the protection of destination and if protected check the needed |
|
2606 // capabilities. |
|
2607 CMManager::TProtectionLevel protLevel = |
|
2608 destinationInstance->CurrentProtectionLevelL(); |
|
2609 if ( protLevel == CMManager::EProtLevel1 || |
|
2610 protLevel == CMManager::EProtLevel2 || |
|
2611 protLevel == CMManager::EProtLevel3 ) |
|
2612 { |
|
2613 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
2614 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
2615 if ( capabilities == CPolicyServer::EFail ) |
|
2616 { |
|
2617 User::Leave( KErrPermissionDenied ); |
|
2618 } |
|
2619 } |
2232 |
2620 |
2233 iCache.CheckIfDestinationCanBeDeletedL( *destinationInstance ); |
2621 iCache.CheckIfDestinationCanBeDeletedL( *destinationInstance ); |
2234 iCache.DeleteDestinationL( *destinationInstance ); |
2622 iCache.DeleteDestinationL( *destinationInstance ); |
2235 |
2623 |
2236 // Close the destination handle. Destination instance destructor will |
2624 // Close the destination handle. Destination instance destructor will |
2378 { |
2766 { |
2379 OstTraceFunctionEntry0( CCMMSESSION_CREATECONNMETHODL_ENTRY ); |
2767 OstTraceFunctionEntry0( CCMMSESSION_CREATECONNMETHODL_ENTRY ); |
2380 |
2768 |
2381 TUint32 bearerType( aMessage.Int0() ); |
2769 TUint32 bearerType( aMessage.Int0() ); |
2382 |
2770 |
2383 CCmmConnMethodInstance* connMethod = CCmmConnMethodInstance::NewLC( this, &iCache ); |
2771 CCmmConnMethodInstance* connMethodInstance = |
2384 iCache.CreateConnMethodL( *connMethod, NULL, bearerType, 0 ); |
2772 CCmmConnMethodInstance::NewLC( this, &iCache ); |
2385 |
2773 iCache.CreateConnMethodL( *connMethodInstance, NULL, bearerType, 0 ); |
2386 iConnMethodContainer->AddL( ( CObject* ) connMethod ); |
2774 |
2387 TInt handle = iConnMethodObjects->AddL( ( CObject* ) connMethod ); |
2775 iConnMethodContainer->AddL( ( CObject* ) connMethodInstance ); |
2388 connMethod->SetHandle( handle ); |
2776 TInt handle = iConnMethodObjects->AddL( ( CObject* ) connMethodInstance ); |
2389 CleanupStack::Pop( connMethod ); |
2777 connMethodInstance->SetHandle( handle ); |
|
2778 CleanupStack::Pop( connMethodInstance ); |
2390 |
2779 |
2391 TPckg<TInt> handlePckg( handle ); |
2780 TPckg<TInt> handlePckg( handle ); |
2392 TInt error = aMessage.Write( 3, handlePckg ); |
2781 TInt error = aMessage.Write( 3, handlePckg ); |
2393 if ( error ) |
2782 if ( error ) |
2394 { |
2783 { |
2406 // |
2795 // |
2407 void CCmmSession::UpdateConnMethodL( const RMessage2& aMessage ) |
2796 void CCmmSession::UpdateConnMethodL( const RMessage2& aMessage ) |
2408 { |
2797 { |
2409 OstTraceFunctionEntry0( CCMMSESSION_UPDATECONNMETHODL_ENTRY ); |
2798 OstTraceFunctionEntry0( CCMMSESSION_UPDATECONNMETHODL_ENTRY ); |
2410 |
2799 |
2411 CCmmConnMethodInstance* connMethod = |
2800 // Check the disk space. |
|
2801 if ( CheckSpaceBelowCriticalLevelL() ) |
|
2802 { |
|
2803 User::Leave( KErrDiskFull ); |
|
2804 } |
|
2805 |
|
2806 CCmmConnMethodInstance* connMethodInstance = |
2412 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
2807 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
2413 connMethod->UpdateL(); |
2808 |
|
2809 // Check if the Client has capabilities to modify this CM. |
|
2810 CheckCapabilitiesForProtectedCML( aMessage, connMethodInstance ); |
|
2811 |
|
2812 connMethodInstance->UpdateL(); |
2414 |
2813 |
2415 OstTraceFunctionExit0( CCMMSESSION_UPDATECONNMETHODL_EXIT ); |
2814 OstTraceFunctionExit0( CCMMSESSION_UPDATECONNMETHODL_EXIT ); |
2416 } |
2815 } |
2417 |
2816 |
2418 // ----------------------------------------------------------------------------- |
2817 // ----------------------------------------------------------------------------- |
2433 |
2832 |
2434 OstTraceFunctionExit0( CCMMSESSION_CLOSECONNMETHOD_EXIT ); |
2833 OstTraceFunctionExit0( CCMMSESSION_CLOSECONNMETHOD_EXIT ); |
2435 } |
2834 } |
2436 |
2835 |
2437 // ----------------------------------------------------------------------------- |
2836 // ----------------------------------------------------------------------------- |
2438 // CCmmSession::ConnMethodUpdateL |
2837 // CCmmSession::DeleteConnMethodL |
2439 // ----------------------------------------------------------------------------- |
2838 // ----------------------------------------------------------------------------- |
2440 // |
2839 // |
2441 void CCmmSession::DeleteConnMethodL( const RMessage2& aMessage ) |
2840 void CCmmSession::DeleteConnMethodL( const RMessage2& aMessage ) |
2442 { |
2841 { |
2443 OstTraceFunctionEntry0( CCMMSESSION_DELETECONNMETHODL_ENTRY ); |
2842 OstTraceFunctionEntry0( CCMMSESSION_DELETECONNMETHODL_ENTRY ); |
2444 |
2843 |
2445 CCmmConnMethodInstance* connMethodInstance = |
2844 CCmmConnMethodInstance* connMethodInstance = |
2446 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
2845 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
|
2846 |
|
2847 // Embedded destinations cannot be deleted through connection method handle. |
|
2848 if ( connMethodInstance->IsEmbeddedDestination() ) |
|
2849 { |
|
2850 User::Leave( KErrNotSupported ); |
|
2851 } |
|
2852 |
|
2853 // Check if the Client has capabilities to delete this CM. |
|
2854 CheckCapabilitiesForProtectedCML( aMessage, connMethodInstance ); |
2447 |
2855 |
2448 iCache.CheckIfConnMethodCanBeDeletedL( *connMethodInstance ); |
2856 iCache.CheckIfConnMethodCanBeDeletedL( *connMethodInstance ); |
2449 iCache.DeleteConnMethodL( *connMethodInstance ); |
2857 iCache.DeleteConnMethodL( *connMethodInstance ); |
2450 // Ignore the boolean return value. It is always true, or the |
2858 // Ignore the boolean return value. It is always true, or the |
2451 // DeleteL()-call leaves. |
2859 // DeleteL()-call leaves. |
2639 OstTraceFunctionEntry0( CCMMSESSION_SETINTATTRIBUTEL_ENTRY ); |
3047 OstTraceFunctionEntry0( CCMMSESSION_SETINTATTRIBUTEL_ENTRY ); |
2640 |
3048 |
2641 CCmmConnMethodInstance* cm = |
3049 CCmmConnMethodInstance* cm = |
2642 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
3050 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
2643 |
3051 |
|
3052 // Check the capability needed if protected CM |
|
3053 // ECapabilityWriteDeviceData is checked earlier already. |
|
3054 CheckCapabilitiesForProtectedCML( aMessage, cm ); |
|
3055 |
2644 TUint32 attribute( aMessage.Int0() ); |
3056 TUint32 attribute( aMessage.Int0() ); |
2645 TUint32 value( aMessage.Int1() ); |
3057 TUint32 value( aMessage.Int1() ); |
2646 |
3058 |
2647 cm->SetIntAttributeL( attribute, value ); |
3059 cm->SetIntAttributeL( attribute, value ); |
2648 |
3060 |
2658 OstTraceFunctionEntry0( CCMMSESSION_SETBOOLATTRIBUTEL_ENTRY ); |
3070 OstTraceFunctionEntry0( CCMMSESSION_SETBOOLATTRIBUTEL_ENTRY ); |
2659 |
3071 |
2660 CCmmConnMethodInstance* cm = |
3072 CCmmConnMethodInstance* cm = |
2661 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
3073 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
2662 |
3074 |
|
3075 // Check the capability needed if protected CM |
|
3076 // ECapabilityWriteDeviceData is checked earlier already. |
|
3077 CheckCapabilitiesForProtectedCML( aMessage, cm ); |
|
3078 |
2663 TUint32 attribute( aMessage.Int0() ); |
3079 TUint32 attribute( aMessage.Int0() ); |
2664 TBool value( aMessage.Int1() ); |
3080 TBool value( aMessage.Int1() ); |
2665 |
3081 |
2666 cm->SetBoolAttributeL( attribute, value ); |
3082 cm->SetBoolAttributeL( attribute, value ); |
2667 |
3083 |
2676 { |
3092 { |
2677 OstTraceFunctionEntry0( CCMMSESSION_SETSTRINGATTRIBUTEL_ENTRY ); |
3093 OstTraceFunctionEntry0( CCMMSESSION_SETSTRINGATTRIBUTEL_ENTRY ); |
2678 |
3094 |
2679 CCmmConnMethodInstance* cm = |
3095 CCmmConnMethodInstance* cm = |
2680 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
3096 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
|
3097 |
|
3098 // Check the capability needed if protected CM |
|
3099 // ECapabilityWriteDeviceData is checked earlier already. |
|
3100 CheckCapabilitiesForProtectedCML( aMessage, cm ); |
2681 |
3101 |
2682 TUint32 attribute( aMessage.Int0() ); |
3102 TUint32 attribute( aMessage.Int0() ); |
2683 |
3103 |
2684 HBufC* value = HBufC::NewLC( aMessage.GetDesLengthL( 1 ) ); |
3104 HBufC* value = HBufC::NewLC( aMessage.GetDesLengthL( 1 ) ); |
2685 TPtr valuePtr( value->Des() ); |
3105 TPtr valuePtr( value->Des() ); |
2700 { |
3120 { |
2701 OstTraceFunctionEntry0( CCMMSESSION_SETSTRING8ATTRIBUTEL_ENTRY ); |
3121 OstTraceFunctionEntry0( CCMMSESSION_SETSTRING8ATTRIBUTEL_ENTRY ); |
2702 |
3122 |
2703 CCmmConnMethodInstance* cm = |
3123 CCmmConnMethodInstance* cm = |
2704 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
3124 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
|
3125 |
|
3126 // Check the capability needed if protected CM |
|
3127 // ECapabilityWriteDeviceData is checked earlier already. |
|
3128 CheckCapabilitiesForProtectedCML( aMessage, cm ); |
2705 |
3129 |
2706 TUint32 attribute( aMessage.Int0() ); |
3130 TUint32 attribute( aMessage.Int0() ); |
2707 |
3131 |
2708 HBufC8* value = HBufC8::NewLC( aMessage.GetDesLengthL( 1 ) ); |
3132 HBufC8* value = HBufC8::NewLC( aMessage.GetDesLengthL( 1 ) ); |
2709 TPtr8 valuePtr( value->Des() ); |
3133 TPtr8 valuePtr( value->Des() ); |
2879 TUint32 bearerType( aMessage.Int1() ); |
3303 TUint32 bearerType( aMessage.Int1() ); |
2880 |
3304 |
2881 CCmmDestinationInstance* destination = |
3305 CCmmDestinationInstance* destination = |
2882 ( CCmmDestinationInstance* )iDestinationObjects->AtL( destinationHandle ); |
3306 ( CCmmDestinationInstance* )iDestinationObjects->AtL( destinationHandle ); |
2883 |
3307 |
|
3308 // Check the protection and if protected check the needed capabilities. |
|
3309 CMManager::TProtectionLevel protLevel = |
|
3310 destination->CurrentProtectionLevelL(); |
|
3311 if ( protLevel == CMManager::EProtLevel1 ) |
|
3312 { |
|
3313 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
3314 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
3315 if ( capabilities == CPolicyServer::EFail ) |
|
3316 { |
|
3317 User::Leave( KErrPermissionDenied ); |
|
3318 } |
|
3319 } |
|
3320 |
2884 CCmmConnMethodInstance* connMethod = CCmmConnMethodInstance::NewLC( this, &iCache ); |
3321 CCmmConnMethodInstance* connMethod = CCmmConnMethodInstance::NewLC( this, &iCache ); |
2885 iCache.CreateConnMethodL( *connMethod, destination, bearerType, 0 ); |
3322 iCache.CreateConnMethodL( *connMethod, destination, bearerType, 0 ); |
2886 |
3323 |
2887 iConnMethodContainer->AddL( ( CObject* ) connMethod ); |
3324 iConnMethodContainer->AddL( ( CObject* ) connMethod ); |
2888 TInt handle = iConnMethodObjects->AddL( ( CObject* ) connMethod ); |
3325 TInt handle = iConnMethodObjects->AddL( ( CObject* ) connMethod ); |
2915 TUint32 connMethodId( aMessage.Int2() ); |
3352 TUint32 connMethodId( aMessage.Int2() ); |
2916 |
3353 |
2917 CCmmDestinationInstance* destination = |
3354 CCmmDestinationInstance* destination = |
2918 ( CCmmDestinationInstance* )iDestinationObjects->AtL( destinationHandle ); |
3355 ( CCmmDestinationInstance* )iDestinationObjects->AtL( destinationHandle ); |
2919 |
3356 |
|
3357 // Check the protection and if protected check the needed capabilities. |
|
3358 CMManager::TProtectionLevel protLevel = |
|
3359 destination->CurrentProtectionLevelL(); |
|
3360 if ( protLevel == CMManager::EProtLevel1 ) |
|
3361 { |
|
3362 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
3363 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
3364 if ( capabilities == CPolicyServer::EFail ) |
|
3365 { |
|
3366 User::Leave( KErrPermissionDenied ); |
|
3367 } |
|
3368 } |
|
3369 |
2920 CCmmConnMethodInstance* connMethod = |
3370 CCmmConnMethodInstance* connMethod = |
2921 CCmmConnMethodInstance::NewLC( this, &iCache ); |
3371 CCmmConnMethodInstance::NewLC( this, &iCache ); |
2922 // Will check if ID is available. |
3372 // Will check if ID is available. |
2923 iCache.CreateConnMethodL( *connMethod, destination, bearerType, connMethodId ); |
3373 iCache.CreateConnMethodL( *connMethod, destination, bearerType, connMethodId ); |
2924 |
3374 |
2997 |
3447 |
2998 OstTraceFunctionExit0( CCMMSESSION_CREATECOPYOFEXISTINGL_EXIT ); |
3448 OstTraceFunctionExit0( CCMMSESSION_CREATECOPYOFEXISTINGL_EXIT ); |
2999 } |
3449 } |
3000 |
3450 |
3001 // ----------------------------------------------------------------------------- |
3451 // ----------------------------------------------------------------------------- |
3002 // Creates a copy of an existing connection method and opens a handle to it. |
3452 // Opens a destination handle to the embedded destination that the provided |
|
3453 // connection method handle represents. |
3003 // ----------------------------------------------------------------------------- |
3454 // ----------------------------------------------------------------------------- |
3004 // |
3455 // |
3005 void CCmmSession::GetEmbeddedDestinationL( const RMessage2& aMessage ) |
3456 void CCmmSession::GetEmbeddedDestinationL( const RMessage2& aMessage ) |
3006 { |
3457 { |
3007 OstTraceFunctionEntry0( CCMMSESSION_GETEMBEDDEDDESTINATIONL_ENTRY ); |
3458 OstTraceFunctionEntry0( CCMMSESSION_GETEMBEDDEDDESTINATIONL_ENTRY ); |
3008 |
3459 |
3009 CCmmConnMethodInstance* connMethodInstance = |
3460 CCmmConnMethodInstance* connMethodInstance = |
3010 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
3461 ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() ); |
3011 |
3462 |
3012 if ( connMethodInstance->GetBearerType() != KUidEmbeddedDestination ) |
3463 // Check this connection method realy represents an embedded destination. |
|
3464 if ( !connMethodInstance->IsEmbeddedDestination() ) |
3013 { |
3465 { |
3014 User::Leave( KErrNotSupported ); |
3466 User::Leave( KErrNotSupported ); |
3015 } |
3467 } |
3016 |
3468 |
3017 TUint32 destinationId = connMethodInstance->GetId(); |
3469 TUint32 destinationId = connMethodInstance->GetId(); |
3056 { |
3508 { |
3057 // Removes from object index and destroys the object. |
3509 // Removes from object index and destroys the object. |
3058 iDestinationObjects->Remove( handle ); |
3510 iDestinationObjects->Remove( handle ); |
3059 User::Leave( error ); |
3511 User::Leave( error ); |
3060 } |
3512 } |
|
3513 |
3061 OstTraceFunctionExit0( CCMMSESSION_GETEMBEDDEDDESTINATIONL_EXIT ); |
3514 OstTraceFunctionExit0( CCMMSESSION_GETEMBEDDEDDESTINATIONL_EXIT ); |
3062 } |
3515 } |
3063 |
3516 |
|
3517 // ----------------------------------------------------------------------------- |
|
3518 // Check if CM is protected and if so then check the needed capabilities. |
|
3519 // ----------------------------------------------------------------------------- |
|
3520 // |
|
3521 void CCmmSession::CheckCapabilitiesForProtectedCML( |
|
3522 const RMessage2& aMessage, |
|
3523 CCmmConnMethodInstance* aConnectionMethodInstance ) |
|
3524 { |
|
3525 OstTraceFunctionEntry0( CCMMSESSION_CHECKCAPABILITIESFORPROTECTEDCML_ENTRY ); |
|
3526 |
|
3527 TBool prot = aConnectionMethodInstance->GetBoolAttributeL( CMManager::ECmProtected ); |
|
3528 if ( prot ) |
|
3529 { |
|
3530 CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass ); |
|
3531 capabilities = iServer.CapabilityCheckWithProtection( aMessage ); |
|
3532 if ( capabilities == CPolicyServer::EFail ) |
|
3533 { |
|
3534 User::Leave( KErrPermissionDenied ); |
|
3535 } |
|
3536 } |
|
3537 |
|
3538 OstTraceFunctionExit0( CCMMSESSION_CHECKCAPABILITIESFORPROTECTEDCML_EXIT ); |
|
3539 } |
|
3540 |
|
3541 // --------------------------------------------------------------------------- |
|
3542 // Check if there is space enough in the disk. |
|
3543 // --------------------------------------------------------------------------- |
|
3544 // |
|
3545 TBool CCmmSession::CheckSpaceBelowCriticalLevelL() |
|
3546 { |
|
3547 if ( !iFsConnected ) |
|
3548 { |
|
3549 TInt err = iFs.Connect(); |
|
3550 if ( err ) |
|
3551 { |
|
3552 // Error happened in connect --> disk space cannot be checked, |
|
3553 // --> return information that everything is ok. |
|
3554 return EFalse; |
|
3555 } |
|
3556 iFsConnected = ETrue; |
|
3557 } |
|
3558 |
|
3559 TBool belowCL = SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, KMinimumDiskSpace ); |
|
3560 |
|
3561 return belowCL; |
|
3562 } |
|
3563 |
3064 // End of file |
3564 // End of file |