bluetooth/btstack/common/btsap.cpp
branchRCL_3
changeset 56 015fa7494bd2
parent 0 29b1cd4cb562
equal deleted inserted replaced
49:10183c6d2913 56:015fa7494bd2
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 //Diagnostic string for security check failures, in builds without platsec
    25 //Diagnostic string for security check failures, in builds without platsec
    26 //diagnostics this will be NULL.
    26 //diagnostics this will be NULL.
    27 const char* const KBT_SAP_NAME_DIAG = __PLATSEC_DIAGNOSTIC_STRING("Bluetooth SAP");
    27 const char* const KBT_SAP_NAME_DIAG = __PLATSEC_DIAGNOSTIC_STRING("Bluetooth SAP");
    28 
    28 
    29 CBluetoothSAP::CBluetoothSAP(CBTSecMan& aSecMan, CBTCodServiceMan& aCodMan)
    29 CBluetoothSAP::CBluetoothSAP(CBTSecMan& aSecMan, CBTCodServiceMan& aCodMan)
    30 : iSecMan(aSecMan), iCodMan(aCodMan)
    30 : iSecMan(aSecMan), iCodMan(aCodMan), iNoSecurityRequired(EFalse)
    31 	{
    31 	{
    32 	}
    32 	}
    33 
    33 
    34 void CBluetoothSAP::ConstructL()
    34 void CBluetoothSAP::ConstructL()
    35 	{
    35 	{
   164 
   164 
   165 	TRAPD(err, SecMan().AccessRequestL(secReqs,
   165 	TRAPD(err, SecMan().AccessRequestL(secReqs,
   166 						aSAPWithSecuritySettings.Override(RemoteAddress()),
   166 						aSAPWithSecuritySettings.Override(RemoteAddress()),
   167 						RemoteAddress(),
   167 						RemoteAddress(),
   168 						aSecurityModeFourOutgoing ? EGeneralBondingSecurityMode4Outgoing : EGeneralBonding, // We are doing general bonding
   168 						aSecurityModeFourOutgoing ? EGeneralBondingSecurityMode4Outgoing : EGeneralBonding, // We are doing general bonding
       
   169 						aSAPWithSecuritySettings.iNoSecurityRequired,
   169 						const_cast<MAccessRequestResponseHandler&>(handler)));
   170 						const_cast<MAccessRequestResponseHandler&>(handler)));
   170 
   171 
   171 	if (err != KErrNone)
   172 	if (err != KErrNone)
   172 		{
   173 		{
   173 		// complete request now...
   174 		// complete request now...
   271 				
   272 				
   272 		        TUint16 newServiceBits = *reinterpret_cast<const TUint16*>(aOption.Ptr());
   273 		        TUint16 newServiceBits = *reinterpret_cast<const TUint16*>(aOption.Ptr());
   273 				rerr = SetCodServiceBits(newServiceBits);	// The service bits are saved and then registered when SAP becomes live
   274 				rerr = SetCodServiceBits(newServiceBits);	// The service bits are saved and then registered when SAP becomes live
   274 				}
   275 				}
   275 				break;	
   276 				break;	
   276 
   277 			case KBTSetNoSecurityRequired:
       
   278 				{
       
   279 				__ASSERT_DEBUG(iSecurityChecker, User::Panic(KSECURITY_PANIC, EBTPanicNullSecurityChecker));
       
   280 				rerr = iSecurityChecker->CheckPolicy(KSDP_SID_PROT_SERV, KBT_SAP_NAME_DIAG);
       
   281 				if (rerr == KErrNone)
       
   282 					{
       
   283 					iNoSecurityRequired = *reinterpret_cast<const TBool*>(aOption.Ptr());
       
   284 					}
       
   285 				}
       
   286 				break;
       
   287 			case KBTSecurityDeviceOverride:
       
   288 				{
       
   289 				rerr = SetDeviceOverride(aOption); 
       
   290 				}
       
   291 				break;
   277 			default:
   292 			default:
   278 				// Unhandled SetOpt name
   293 				// Unhandled SetOpt name
   279 				rerr = KErrNotSupported;
   294 				rerr = KErrNotSupported;
   280 				break;
   295 				break;
   281 			}
   296 			}