contentmgmt/contentaccessfwfordrm/source/f32agent/f32agentdata.cpp
branchRCL_3
changeset 61 641f389e9157
parent 45 030c4fbc13d7
child 62 a71299154b21
equal deleted inserted replaced
60:f18401adf8e1 61:641f389e9157
    41 	self->ConstructL(aFile, aUniqueId);
    41 	self->ConstructL(aFile, aUniqueId);
    42 	CleanupStack::Pop(self);
    42 	CleanupStack::Pop(self);
    43 	return self;
    43 	return self;
    44 	}
    44 	}
    45 
    45 
       
    46 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    47 
       
    48 CF32AgentData* CF32AgentData::NewL(const TDesC8& aHeaderData)
       
    49 	{
       
    50 	CF32AgentData* self = new (ELeave) CF32AgentData;
       
    51 	CleanupStack::PushL(self);
       
    52 	self->ConstructL(aHeaderData);
       
    53 	CleanupStack::Pop(self);
       
    54 	return self;
       
    55 	}
       
    56 	
       
    57 void CF32AgentData::ConstructL(const TDesC8& aHeaderData)
       
    58 	{
       
    59 	if(aHeaderData.Length() > 0)
       
    60 		iHeaderData = aHeaderData.AllocL();
       
    61 	else
       
    62 		User::Leave(KErrMissingWmdrmHeaderData);
       
    63 	}
       
    64 	
       
    65 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
    46 
    66 
    47 CF32AgentData::CF32AgentData()
    67 CF32AgentData::CF32AgentData()
    48 	{
    68 	{
    49 	}
    69 	}
    50 
    70 
    57 		iFs.Close();
    77 		iFs.Close();
    58 		}
    78 		}
    59 
    79 
    60 	delete iVirtualPath;
    80 	delete iVirtualPath;
    61 	
    81 	
       
    82 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    83 	delete iHeaderData;			
       
    84 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
    62 	}
    85 	}
    63   
    86   
    64 void CF32AgentData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    87 void CF32AgentData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    65 	{
    88 	{
    66 	iVirtualPath = CVirtualPath::NewL(aVirtualPath);
    89 	iVirtualPath = CVirtualPath::NewL(aVirtualPath);
   209 		}
   232 		}
   210 	}
   233 	}
   211 
   234 
   212 TInt CF32AgentData::GetAttribute(TInt aAttribute, TInt& aValue)
   235 TInt CF32AgentData::GetAttribute(TInt aAttribute, TInt& aValue)
   213 	{
   236 	{
       
   237 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   238 	if(iHeaderData)
       
   239 		{
       
   240 		return TF32DefaultAttributes::GetAttribute(*iHeaderData, aAttribute, aValue);
       
   241 		}
       
   242 		
       
   243 	else if(iVirtualPath)
       
   244 		{
       
   245 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iVirtualPath->URI());
       
   246 		}
       
   247 		
       
   248 	else
       
   249 		{
       
   250 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
       
   251 		}
       
   252 #else
   214 	if(iVirtualPath)
   253 	if(iVirtualPath)
   215 		{
   254 		{
   216 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iVirtualPath->URI());
   255 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iVirtualPath->URI());
   217 		}
   256 		}
   218 	else
   257 	else
   219 		{
   258 		{
   220 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   259 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   221 		}
   260 		}
       
   261 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   222 	}
   262 	}
   223 
   263 
   224 TInt CF32AgentData::GetAttributeSet(RAttributeSet& aAttributeSet)
   264 TInt CF32AgentData::GetAttributeSet(RAttributeSet& aAttributeSet)
   225 	{
   265 	{
       
   266 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   267 	if(iHeaderData)
       
   268 		{
       
   269 		return TF32DefaultAttributes::GetAttributeSet(*iHeaderData, aAttributeSet);
       
   270 		}
       
   271 		
       
   272 	else if(iVirtualPath)
       
   273 		{
       
   274 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iVirtualPath->URI());
       
   275 		}
       
   276 			
       
   277 	else
       
   278 		{
       
   279 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
       
   280 		}
       
   281 #else
   226 	if(iVirtualPath)
   282 	if(iVirtualPath)
   227 		{
   283 		{
   228 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iVirtualPath->URI());
   284 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iVirtualPath->URI());
   229 		}	
   285 		}	
   230 	else
   286 	else
   231 		{
   287 		{
   232 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
   288 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
   233 		}	
   289 		}	
       
   290 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT		
   234 	}
   291 	}
   235 
   292 
   236 TInt CF32AgentData::GetStringAttribute(TInt aAttribute, TDes& aValue)
   293 TInt CF32AgentData::GetStringAttribute(TInt aAttribute, TDes& aValue)
   237 	{
   294 	{
       
   295 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   296 	if(iHeaderData)
       
   297 		{
       
   298 		return TF32DefaultAttributes::GetStringAttribute(*iHeaderData, aAttribute, aValue);
       
   299 		}
       
   300 	
       
   301 	else if(iVirtualPath)
       
   302 		{
       
   303 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iVirtualPath->URI());
       
   304 		}
       
   305 	else
       
   306 		{
       
   307 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
       
   308 		}
       
   309 #else
   238 	if(iVirtualPath)
   310 	if(iVirtualPath)
   239 		{
   311 		{
   240 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iVirtualPath->URI());
   312 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iVirtualPath->URI());
   241 		}
   313 		}
   242 	else
   314 	else
   243 		{
   315 		{
   244 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
   316 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
   245 		}
   317 		}
       
   318 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT	
   246 	}
   319 	}
   247 
   320 
   248 TInt CF32AgentData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet)
   321 TInt CF32AgentData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet)
   249 	{
   322 	{
       
   323 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   324 	if(iHeaderData)
       
   325 		{
       
   326 		return TF32DefaultAttributes::GetStringAttributeSet(*iHeaderData, aStringAttributeSet);
       
   327 		}
       
   328 		
       
   329 	else if(iVirtualPath)
       
   330 		{
       
   331 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iVirtualPath->URI());
       
   332 		}
       
   333 	else
       
   334 		{
       
   335 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
       
   336 		}
       
   337 #else
   250 	if(iVirtualPath)
   338 	if(iVirtualPath)
   251 		{
   339 		{
   252 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iVirtualPath->URI());
   340 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iVirtualPath->URI());
   253 		}
   341 		}
   254 	else
   342 	else
   255 		{
   343 		{
   256 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
   344 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
   257 		}
   345 		}
       
   346 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   258 	}
   347 	}
   259 
   348 
   260 CF32AgentUi& CF32AgentData::AgentUiL()
   349 CF32AgentUi& CF32AgentData::AgentUiL()
   261 	{
   350 	{
   262 	if(!iAgentUi)
   351 	if(!iAgentUi)
   265 		iAgentUi = TF32AgentUiFactory::CreateF32AgentUiL();
   354 		iAgentUi = TF32AgentUiFactory::CreateF32AgentUiL();
   266 		}
   355 		}
   267 	return *iAgentUi;
   356 	return *iAgentUi;
   268 	}
   357 	}
   269 
   358 
   270 
   359 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   360 
       
   361 TInt CF32AgentData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket)
       
   362 	{
       
   363 	if(aEncryptedInputDataPacket.Length() <= 0)
       
   364 		{
       
   365 		return KErrInsufficientDataPacketLength;
       
   366 		}
       
   367 	
       
   368 	aDecryptedOutputDataPacket = aEncryptedInputDataPacket;
       
   369 	return KErrNone;
       
   370 	}
       
   371 			
       
   372 void CF32AgentData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket, TRequestStatus& aStatus)
       
   373 	{
       
   374 	TRequestStatus* status = &aStatus;
       
   375 	if(aEncryptedInputDataPacket.Length() <= 0)
       
   376 		{
       
   377 		User::RequestComplete(status, KErrInsufficientDataPacketLength);		
       
   378 		}
       
   379 	
       
   380 	aDecryptedOutputDataPacket = aEncryptedInputDataPacket;
       
   381 	User::RequestComplete(status, KErrNone);
       
   382 	}
       
   383 
       
   384 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT