os/security/contentmgmt/contentaccessfwfordrm/source/caf/data.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/source/caf/data.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,531 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <apmstd.h>
    1.23 +
    1.24 +#include <caf/data.h>
    1.25 +#include <caf/agentinterface.h>
    1.26 +#include "agentinfo.h"
    1.27 +#include <caf/agentfactory.h>
    1.28 +#include <caf/attributeset.h>
    1.29 +#include <caf/virtualpath.h>
    1.30 +#include "resolver.h"
    1.31 +#include "agentinfo.h"
    1.32 +#include <e32def.h>
    1.33 +
    1.34 +using namespace ContentAccess;
    1.35 +
    1.36 +EXPORT_C CData* CData::NewL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
    1.37 +	{
    1.38 +	CData *self = CData::NewLC(aVirtualPath, aIntent, aShareMode);
    1.39 +	CleanupStack::Pop(self);
    1.40 +	return self;
    1.41 +	}
    1.42 +
    1.43 +EXPORT_C CData* CData::NewLC(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
    1.44 +	{
    1.45 +	CData *self = new (ELeave) CData;
    1.46 +	CleanupStack::PushL(self);
    1.47 +	self->ConstructL(aVirtualPath, aIntent, aShareMode);
    1.48 +	return self;
    1.49 +	}
    1.50 +
    1.51 +EXPORT_C CData* CData::NewL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
    1.52 +	{
    1.53 +	CData *self = CData::NewLC(aFile, aUniqueId, aIntent);
    1.54 +	CleanupStack::Pop(self);
    1.55 +	return self;
    1.56 +	}
    1.57 +		
    1.58 +EXPORT_C CData* CData::NewLC(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
    1.59 +	{
    1.60 +	CData *self = new (ELeave) CData;
    1.61 +	CleanupStack::PushL(self);
    1.62 +	self->ConstructL(aFile, aUniqueId, aIntent);
    1.63 +	return self;
    1.64 +	}
    1.65 +
    1.66 +
    1.67 +EXPORT_C CData* CData::NewL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    1.68 +	{
    1.69 +	CData *self = CData::NewLC(aVirtualPath, aShareMode);
    1.70 +	CleanupStack::Pop(self);
    1.71 +	return self;
    1.72 +	}
    1.73 +
    1.74 +EXPORT_C CData* CData::NewLC(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    1.75 +	{
    1.76 +	CData *self = new (ELeave) CData;
    1.77 +	CleanupStack::PushL(self);
    1.78 +	self->ConstructL(aVirtualPath, aShareMode);
    1.79 +	return self;
    1.80 +	}
    1.81 +
    1.82 +EXPORT_C CData* CData::NewL(RFile& aFile, const TDesC& aUniqueId)
    1.83 +	{
    1.84 +	CData *self = CData::NewLC(aFile, aUniqueId);
    1.85 +	CleanupStack::Pop(self);
    1.86 +	return self;
    1.87 +	}
    1.88 +		
    1.89 +EXPORT_C CData* CData::NewLC(RFile& aFile, const TDesC& aUniqueId)
    1.90 +	{
    1.91 +	CData *self = new (ELeave) CData;
    1.92 +	CleanupStack::PushL(self);
    1.93 +	self->ConstructL(aFile, aUniqueId);
    1.94 +	return self;
    1.95 +	}
    1.96 +
    1.97 +
    1.98 +CData* CData::NewLC(TUid aUid,
    1.99 +					const TVirtualPathPtr& aVirtualPath,
   1.100 +					TIntent aIntent,
   1.101 +					TContentShareMode aShareMode)
   1.102 +	{
   1.103 +	CData* self = new(ELeave) CData();
   1.104 +	CleanupStack::PushL(self);
   1.105 +	self->ConstructL(aUid, aVirtualPath, aIntent, aShareMode);
   1.106 +	return self;
   1.107 +	}
   1.108 +
   1.109 +CData* CData::NewLC(TUid aUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
   1.110 +	{
   1.111 +	CData* self = new (ELeave) CData();
   1.112 +	CleanupStack::PushL(self);
   1.113 +	self->ConstructL(aUid, aFile, aUniqueId, aIntent);
   1.114 +	return self;
   1.115 +	}
   1.116 +
   1.117 +#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.118 +
   1.119 +EXPORT_C CData* CData::NewL(const TDesC8& aHeaderData)
   1.120 +	{
   1.121 +	CData* self = CData::NewLC(aHeaderData);
   1.122 +	CleanupStack::Pop(self);
   1.123 +	return self;
   1.124 +	}
   1.125 +		
   1.126 +EXPORT_C CData* CData::NewL(const TDesC8& aHeaderData, TIntent aIntent)
   1.127 +	{
   1.128 +	CData* self = CData::NewLC(aHeaderData, aIntent);
   1.129 +	CleanupStack::Pop(self);
   1.130 +	return self;
   1.131 +	}
   1.132 +		
   1.133 +EXPORT_C CData* CData::NewLC(const TDesC8& aHeaderData)
   1.134 +	{
   1.135 +	CData* self = new (ELeave) CData();
   1.136 +	CleanupStack::PushL(self);
   1.137 +	self->ConstructL(aHeaderData);
   1.138 +	return self;
   1.139 +	}
   1.140 +		
   1.141 +EXPORT_C CData* CData::NewLC(const TDesC8& aHeaderData, TIntent aIntent)
   1.142 +	{
   1.143 +	CData* self = new (ELeave) CData();
   1.144 +	CleanupStack::PushL(self);
   1.145 +	self->ConstructL(aHeaderData, aIntent);
   1.146 +	return self;
   1.147 +	}
   1.148 +		
   1.149 +CData* CData::NewLC(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent)
   1.150 +	{
   1.151 +	CData* self = new (ELeave) CData();
   1.152 +	CleanupStack::PushL(self);
   1.153 +	self->ConstructL(aAgentUid, aHeaderData, aIntent);
   1.154 +	return self;
   1.155 +	}
   1.156 +
   1.157 +#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.158 +
   1.159 +CData::CData()
   1.160 +	{ 
   1.161 +	}
   1.162 +
   1.163 +CData::~CData() 
   1.164 +	{ 
   1.165 +	// Destroy the agent implementation
   1.166 +	delete iAgentData;
   1.167 +	
   1.168 +	// close ECOM session, may result in the unloading of the DLL
   1.169 +	delete iAgentFactory;
   1.170 +	REComSession::FinalClose();
   1.171 +	}
   1.172 +
   1.173 +
   1.174 +void CData::ConstructL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
   1.175 +	{
   1.176 +	// Create the agent resolver which will contains a reference to
   1.177 +	// the agent responsible for this piece of content
   1.178 +	CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
   1.179 +	
   1.180 +	// Create a temporary buffer used to store the translated version of the URI
   1.181 +	HBufC* actualUri = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
   1.182 +	TPtr uri = actualUri->Des();
   1.183 +	
   1.184 +	// Find the agent who handles the file and translate the URI if it is pointing to a private directory 
   1.185 +	CAgentInfo& agentInfo = resolver->ResolveFileL(aVirtualPath.URI(), uri, aShareMode);
   1.186 +
   1.187 +	// Figure out the Uid of the agent
   1.188 +	TUid agentUid = agentInfo.Agent().ImplementationUid();
   1.189 +	
   1.190 +	// call internal CData::NewL()
   1.191 +	CData::ConstructL(agentUid, TVirtualPathPtr(*actualUri, aVirtualPath.UniqueId()), aIntent, aShareMode);
   1.192 +	
   1.193 +	CleanupStack::PopAndDestroy(2, resolver); // actualUri, resolver
   1.194 +	}
   1.195 +
   1.196 +void CData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
   1.197 +	{
   1.198 +	// Create the agent resolver which will contains a reference to
   1.199 +	// the agent responsible for this piece of content
   1.200 +	CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
   1.201 +	
   1.202 +	// Create a temporary buffer used to store the translated version of the URI
   1.203 +	HBufC* actualUri = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
   1.204 +	TPtr uri = actualUri->Des();
   1.205 +	
   1.206 +	// Find the agent who handles the file and translate the URI if it is pointing to a private directory 
   1.207 +	CAgentInfo& agentInfo = resolver->ResolveFileL(aVirtualPath.URI(), uri, aShareMode);
   1.208 +
   1.209 +	// Figure out the Uid of the agent
   1.210 +	TUid agentUid = agentInfo.Agent().ImplementationUid();
   1.211 +	
   1.212 +	// call internal CData::NewL()
   1.213 +	CData::ConstructL(agentUid, TVirtualPathPtr(*actualUri, aVirtualPath.UniqueId()), aShareMode);
   1.214 +	
   1.215 +	CleanupStack::PopAndDestroy(2, resolver); // actualUri, resolver
   1.216 +	}
   1.217 +
   1.218 +void CData::ConstructL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
   1.219 +	{
   1.220 +	// Find the agent who handles the file
   1.221 +	CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
   1.222 +	CAgentInfo& agentInfo = resolver->ResolveFileL(aFile);
   1.223 +
   1.224 +	// Figure out the Uid of the agent
   1.225 +	TUid agentUid = agentInfo.Agent().ImplementationUid();
   1.226 +
   1.227 +	// call other constructL now that we have the Uid
   1.228 +	CData::ConstructL(agentUid, aFile, aUniqueId, aIntent);
   1.229 +
   1.230 +	// Cleanup resolver after creating CData to unnecessary 
   1.231 +	// unloading and loading of agent plug-ins
   1.232 +	CleanupStack::PopAndDestroy(resolver); 
   1.233 +	}
   1.234 +
   1.235 +void CData::ConstructL(RFile& aFile, const TDesC& aUniqueId)
   1.236 +	{
   1.237 +	// Find the agent who handles the file
   1.238 +	CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
   1.239 +	CAgentInfo& agentInfo = resolver->ResolveFileL(aFile);
   1.240 +
   1.241 +	// Figure out the Uid of the agent
   1.242 +	TUid agentUid = agentInfo.Agent().ImplementationUid();
   1.243 +
   1.244 +	// call other constructL now that we have the Uid
   1.245 +	CData::ConstructL(agentUid, aFile, aUniqueId);
   1.246 +
   1.247 +	// Cleanup resolver after creating CData to unnecessary 
   1.248 +	// unloading and loading of agent plug-ins
   1.249 +	CleanupStack::PopAndDestroy(resolver); 
   1.250 +	}
   1.251 +
   1.252 +void CData::ConstructL(TUid aUid,
   1.253 +					   const TVirtualPathPtr& aVirtualPath,
   1.254 +					   TIntent aIntent,
   1.255 +					   TContentShareMode aShareMode)
   1.256 +	{
   1.257 +	CData::ConstructL(aUid, aVirtualPath, aShareMode);
   1.258 +
   1.259 +	// Ensure that client's intent is possible
   1.260 +	User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
   1.261 +	}
   1.262 +
   1.263 +void CData::ConstructL(TUid aUid,
   1.264 +					   const TVirtualPathPtr& aVirtualPath,
   1.265 +					   TContentShareMode aShareMode)
   1.266 +	{
   1.267 +	iAgentUid = aUid;
   1.268 +
   1.269 +	// create our own agent factory (de-facto session handle for ECOM)
   1.270 +	iAgentFactory = CAgentFactory::NewL(iAgentUid);
   1.271 +
   1.272 +	// Create an instance of the Agent's CAgentData
   1.273 +	iAgentData = iAgentFactory->CreateDataConsumerL(aVirtualPath, aShareMode);
   1.274 +
   1.275 +	}
   1.276 +
   1.277 +void CData::ConstructL(TUid aUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
   1.278 +	{
   1.279 +	CData::ConstructL(aUid, aFile, aUniqueId);
   1.280 +
   1.281 +	// Ensure that client's intent is possible
   1.282 +	User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
   1.283 +	}
   1.284 +
   1.285 +void CData::ConstructL(TUid aUid, RFile& aFile, const TDesC& aUniqueId)
   1.286 +	{
   1.287 +	iAgentUid = aUid;
   1.288 +
   1.289 +	// create our own agent factory (de-facto session handle for ECOM)
   1.290 +	iAgentFactory = CAgentFactory::NewL(iAgentUid);
   1.291 +
   1.292 +	// Create an instance of the agent's CAgentData
   1.293 +	// The agent must make a duplicate of the file handle
   1.294 +	iAgentData = iAgentFactory->CreateDataConsumerL(aFile, aUniqueId);
   1.295 +  	}
   1.296 +  
   1.297 +#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.298 +  	
   1.299 +void CData::ConstructL(const TDesC8& aHeaderData)
   1.300 +	{
   1.301 +	// Find the agent who handles the file
   1.302 +	CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
   1.303 +	CAgentInfo& agentInfo = resolver->ResolveFileL(aHeaderData);
   1.304 +	
   1.305 +	// Figure out the Uid of the agent
   1.306 +	TUid agentUid = agentInfo.Agent().ImplementationUid();
   1.307 +	CData::ConstructL(agentUid, aHeaderData);
   1.308 +	
   1.309 +	// Cleanup resolver after creating CData to unnecessary 
   1.310 +	// unloading and loading of agent plug-ins
   1.311 +	CleanupStack::PopAndDestroy(resolver); 
   1.312 +	}
   1.313 +
   1.314 +void CData::ConstructL(const TDesC8& aHeaderData, TIntent aIntent)
   1.315 +	{
   1.316 +	CData::ConstructL(aHeaderData);
   1.317 +	
   1.318 +	// Ensure that client's intent is possible
   1.319 +	User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
   1.320 +	}
   1.321 +	
   1.322 +void CData::ConstructL(TUid aAgentUid, const TDesC8& aHeaderData)
   1.323 +	{
   1.324 +	iAgentUid = aAgentUid;
   1.325 +	
   1.326 +	iAgentFactory = CAgentFactory::NewL(iAgentUid);
   1.327 +	// create an instance of agent's CAgentStreamData.
   1.328 +	iAgentData = iAgentFactory->CreateDataConsumerL(aHeaderData);
   1.329 +	}
   1.330 +
   1.331 +void CData::ConstructL(TUid aUid, const TDesC8& aHeaderData, TIntent aIntent)
   1.332 +	{
   1.333 +	CData::ConstructL(aUid, aHeaderData);
   1.334 +	
   1.335 +	// Ensure that client's intent is possible
   1.336 +	User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
   1.337 +	}
   1.338 +	
   1.339 +#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.340 +	
   1.341 +EXPORT_C void CData::DataSizeL(TInt& aSize)
   1.342 +	{
   1.343 +	// ask the agent for the data size of the current content object
   1.344 +	iAgentData->DataSizeL(aSize);
   1.345 +	}
   1.346 +
   1.347 +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.348 +EXPORT_C void CData::DataSize64L(TInt64& aSize)
   1.349 +	{
   1.350 +	// ask the agent for the data size of the current content object
   1.351 +	TRAPD(err, iAgentData->DataSize64L(aSize));
   1.352 +	if(err == KErrCANotSupported)
   1.353 +		{
   1.354 +		//fallback to 32bit API
   1.355 +		TInt size32;
   1.356 +		iAgentData->DataSizeL(size32);
   1.357 +		aSize = size32;
   1.358 +		}
   1.359 +	else
   1.360 +		User::LeaveIfError(err);
   1.361 +	}
   1.362 +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.363 +
   1.364 +EXPORT_C TInt CData::EvaluateIntent(TIntent aIntent)
   1.365 +	{
   1.366 +	// ask the agent to re-evaluate the intent on the current content object
   1.367 +	return iAgentData->EvaluateIntent(aIntent);
   1.368 +	}
   1.369 +
   1.370 +EXPORT_C TInt CData::ExecuteIntent(TIntent aIntent)
   1.371 +	{
   1.372 +	// ask the agent to re-evaluate the intent on the current content object
   1.373 +	return iAgentData->ExecuteIntent(aIntent);
   1.374 +	}
   1.375 +
   1.376 +EXPORT_C TInt CData::Read(TDes8& aDes) const
   1.377 +	{
   1.378 +	// ask the agent to read plaintext from the content object 
   1.379 +	return iAgentData->Read(aDes);
   1.380 +	}
   1.381 +
   1.382 +EXPORT_C TInt CData::Read(TDes8& aDes, TInt aLength) const
   1.383 +	{
   1.384 +	// ask the agent to read plaintext from the content object 
   1.385 +	return iAgentData->Read(aDes, aLength);
   1.386 +	}
   1.387 +
   1.388 +EXPORT_C void CData::Read(TDes8& aDes, 
   1.389 +						  TRequestStatus& aStatus) const
   1.390 +	{
   1.391 +	// ask the agent to read plaintext from the content object 
   1.392 +	iAgentData->Read(aDes, aStatus);
   1.393 +	}
   1.394 +
   1.395 +EXPORT_C void CData::Read(TDes8& aDes, 
   1.396 +						  TInt aLength, 
   1.397 +						  TRequestStatus& aStatus) const
   1.398 +	{
   1.399 +	// ask the agent to read plaintext from the content object 
   1.400 +	iAgentData->Read(aDes, aLength, aStatus);
   1.401 +	}
   1.402 +	
   1.403 +EXPORT_C void CData::ReadCancel(TRequestStatus &aStatus) const
   1.404 +	{
   1.405 +	iAgentData->ReadCancel(aStatus);
   1.406 +	}
   1.407 +	
   1.408 +#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.409 +
   1.410 +EXPORT_C TInt CData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputPacket) const
   1.411 +	{
   1.412 +	return iAgentData->Read(aEncryptedInputDataPacket, aDecryptedOutputPacket);
   1.413 +	}
   1.414 +		
   1.415 +EXPORT_C void CData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputPacket, TRequestStatus& aStatus) const
   1.416 +	{
   1.417 +	iAgentData->Read(aEncryptedInputDataPacket, aDecryptedOutputPacket, aStatus);
   1.418 +	}
   1.419 +
   1.420 +#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.421 +
   1.422 +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.423 +	EXPORT_C TInt CData::Read_Unused(TInt aPos, TDes8& aDes, 
   1.424 +								TInt aLength, TRequestStatus& aStatus) const
   1.425 +#else
   1.426 +	EXPORT_C TInt CData::Read(TInt aPos, TDes8& aDes, 
   1.427 +								TInt aLength, TRequestStatus& aStatus) const
   1.428 +#endif
   1.429 +	{
   1.430 +	// ask the agent to read plaintext from the content object 
   1.431 +	if(aPos<0)
   1.432 +		return KErrArgument;
   1.433 +	return iAgentData->Read(aPos, aDes, aLength, aStatus);
   1.434 +	}
   1.435 +
   1.436 +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.437 +EXPORT_C TInt CData::Read(TInt64 aPos, TDes8& aDes,
   1.438 +						  TInt aLength, TRequestStatus& aStatus) const
   1.439 +	{
   1.440 +	// If agent does not support 64bit Read, a fallback to 32bit Read is provided automatically
   1.441 +	// The above API method signature allows error codes to be returned
   1.442 +	// via two different routes (return code & aStatus). Should the async request 
   1.443 +	// dispatch fail then an error code is returned immediately via the 
   1.444 +	// aStatus parameter rather than via the return code of the function.	
   1.445 +
   1.446 +	// NOTE: it is not generally not recommended for functions to be able to return
   1.447 +	// error codes in two different ways as this places a bigger error-checking
   1.448 +	// burden on clients.
   1.449 +	if(aPos<0)
   1.450 +		return KErrArgument;
   1.451 +	
   1.452 +	TInt rval = iAgentData->Read64(aPos, aDes, aLength, aStatus);
   1.453 +	return (rval == KErrCANotSupported? iAgentData->Read((TInt)aPos, aDes, aLength, aStatus) : rval );
   1.454 +	}
   1.455 +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.456 +
   1.457 +EXPORT_C TInt CData::Seek(TSeek aMode,TInt& aPos) const
   1.458 +	{
   1.459 +	// ask the agent to seek witin the plaintext 
   1.460 +	return iAgentData->Seek(aMode, aPos);
   1.461 +	}
   1.462 +
   1.463 +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.464 +EXPORT_C TInt CData::Seek64(TSeek aMode,TInt64& aPos) const
   1.465 +	{
   1.466 +	// ask the agent to seek witin the plaintext 
   1.467 +	TInt rval64 = iAgentData->Seek64(aMode, aPos);
   1.468 +	if(rval64 == KErrCANotSupported)
   1.469 +		{
   1.470 +		//fallback to 32bit API
   1.471 +		TInt pos32 = I64INT(aPos);
   1.472 +		TInt rval32 = iAgentData->Seek(aMode, pos32);
   1.473 +		aPos = pos32;
   1.474 +		return rval32;
   1.475 +		}
   1.476 +	return rval64;
   1.477 +	}
   1.478 +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.479 +
   1.480 +EXPORT_C TInt CData::SetProperty(TAgentProperty aProperty, TInt aValue)
   1.481 +	{
   1.482 +	// Set a property within the agent
   1.483 +	return iAgentData->SetProperty(aProperty, aValue);
   1.484 +	}
   1.485 +
   1.486 +EXPORT_C TInt CData::GetAttribute(TInt aAttribute, TInt& aValue) const
   1.487 +	{
   1.488 +	// Get an attribute related to this content object
   1.489 +	return iAgentData->GetAttribute(aAttribute, aValue);
   1.490 +	}
   1.491 +
   1.492 +EXPORT_C TInt CData::GetAttributeSet(RAttributeSet& aAttributeSet) const
   1.493 +	{
   1.494 +	// Get a set of attributes related to this content object
   1.495 +	return iAgentData->GetAttributeSet(aAttributeSet);
   1.496 +	}
   1.497 +
   1.498 +EXPORT_C TInt CData::GetStringAttribute(TInt aAttribute, TDes& aValue) const
   1.499 +	{
   1.500 +	// Get a string attribute related to this content object
   1.501 +	return iAgentData->GetStringAttribute(aAttribute, aValue);
   1.502 +	}
   1.503 +
   1.504 +EXPORT_C TInt CData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const
   1.505 +	{
   1.506 +	// Get a set of string attributes related to this content object
   1.507 +	return iAgentData->GetStringAttributeSet(aStringAttributeSet);
   1.508 +	}
   1.509 +
   1.510 +#ifndef REMOVE_CAF1
   1.511 +EXPORT_C void CData::SetQosL(TQosAttribute aQosAttr, TInt aValue)
   1.512 +	{
   1.513 +	if(aQosAttr == EQosBufferSize)
   1.514 +		{
   1.515 +		User::LeaveIfError(iAgentData->SetProperty(EAgentPropertyBufferSize, aValue));
   1.516 +		}
   1.517 +	}
   1.518 +
   1.519 +EXPORT_C TBool CData::GetMimeTypeL(TDes8& aMimeType) const
   1.520 +	{
   1.521 +	TBuf16 <KMaxDataTypeLength> mimeType;
   1.522 +	TInt err = KErrNone;
   1.523 +	if(iAgentUid != KF32AgentImplUid)
   1.524 +		{
   1.525 +		err = iAgentData->GetStringAttribute(EMimeType, mimeType);
   1.526 +		if(err == KErrNone && mimeType.Length() != 0)
   1.527 +			{
   1.528 +			aMimeType.Copy(mimeType);
   1.529 +			return ETrue;
   1.530 +			}
   1.531 +		}
   1.532 +	return EFalse;
   1.533 +	}
   1.534 +#endif // REMOVE_CAF1