bluetooth/btstack/eirman/eirmanserver.cpp
branchRCL_3
changeset 18 1f10b9300be6
parent 17 32ba20339036
equal deleted inserted replaced
17:32ba20339036 18:1f10b9300be6
   207 	TEirTag tag;
   207 	TEirTag tag;
   208 	TCustomResult result = EFail; //Fail everything by default
   208 	TCustomResult result = EFail; //Fail everything by default
   209 	_LIT_SECURITY_POLICY_S0(KSDPSecurityPolicy, KSDPServerID);
   209 	_LIT_SECURITY_POLICY_S0(KSDPSecurityPolicy, KSDPServerID);
   210 	_LIT_SECURITY_POLICY_S0(KStackSecurityPolicy, KStackID);
   210 	_LIT_SECURITY_POLICY_S0(KStackSecurityPolicy, KStackID);
   211 	_LIT_SECURITY_POLICY_C1(KVendorSpecificDataSecurityPolicy, ECapabilityWriteDeviceData);
   211 	_LIT_SECURITY_POLICY_C1(KVendorSpecificDataSecurityPolicy, ECapabilityWriteDeviceData);
   212 	if(function == EEirManRegisterTag)
   212 	_LIT_SECURITY_POLICY_C1(KEirCommonSecurityPolicy, ECapabilityLocalServices);
   213 		{
   213 
   214 		tag = static_cast<TEirTag>(aMsg.Int0());
   214 	if(KEirCommonSecurityPolicy.CheckPolicy(aMsg))
   215 		switch(tag)
   215 		{
   216 			{
   216 		if(function == EEirManRegisterTag)
   217 			case EEirTagName:
   217 			{
   218 			case EEirTagTxPowerLevel:
   218 			tag = static_cast<TEirTag>(aMsg.Int0());
   219 				/** These must have come from the stack **/
   219 			switch(tag)
   220 				if(KStackSecurityPolicy.CheckPolicy(aMsg))
   220 				{
   221 					{
   221 				case EEirTagName:
   222 					result = EPass;
   222 				case EEirTagTxPowerLevel:
   223 					}
   223 					/** These must have come from the stack **/
   224 				break;
   224 					if(KStackSecurityPolicy.CheckPolicy(aMsg))
   225 			case EEirTagSdpUuid16:
   225 						{
   226 			case EEirTagSdpUuid32:
   226 						result = EPass;
   227 			case EEirTagSdpUuid128:
   227 						}
   228 				/** These must have come from SDP server **/
   228 					break;
   229 				if(KSDPSecurityPolicy.CheckPolicy(aMsg))
   229 				case EEirTagSdpUuid16:
   230 					{
   230 				case EEirTagSdpUuid32:
   231 					result = EPass;
   231 				case EEirTagSdpUuid128:
   232 					}
   232 					/** These must have come from SDP server **/
   233 				break;
   233 					if(KSDPSecurityPolicy.CheckPolicy(aMsg))
   234 			case EEirTagManufacturerSpecific:
   234 						{
   235 				/** To do this you must have write device data **/
   235 						result = EPass;
   236 				if(KVendorSpecificDataSecurityPolicy.CheckPolicy(aMsg))
   236 						}
   237 					{
   237 					break;
   238 					result = EPass;
   238 				case EEirTagManufacturerSpecific:
   239 					}
   239 					/** To do this you must have write device data **/
   240 				break;
   240 					if(KVendorSpecificDataSecurityPolicy.CheckPolicy(aMsg))
   241 			
   241 						{
   242 			case EEirTagFlags:
   242 						result = EPass;
   243 				/** At present no implementation of Flags is supported. 
   243 						}
   244 				    So we are rejecting this until an implementation is provided. **/
   244 					break;
   245 			default: //unknown or reserved tag, reject
   245 				case EEirTagFlags:
   246 				//no need to do anything 
   246 					/** At present no implementation of Flags is supported. 
   247 				break;
   247 					So we are rejecting this until an implementation is provided. **/
       
   248 				default: //unknown or reserved tag, reject
       
   249 					//no need to do anything 
       
   250 					break;
       
   251 				}
   248 			}
   252 			}
   249 		}
   253 		}
   250 	//Anything not covered by the above is invalid so do nothing and let it fail
   254 	//Anything not covered by the above is invalid so do nothing and let it fail
   251 	if(result == EFail)
   255 	if(result == EFail)
   252 		{
   256 		{