os/security/contentmgmt/referencedrmagent/tcaf/source/cafserver.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/referencedrmagent/tcaf/source/cafserver.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,296 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-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 +* Example file/test code to demonstrate how to develop a TestExecute Server
    1.19 +* Developers should take this project as a template and substitute their own
    1.20 +* code at the __EDIT_ME__ tags
    1.21 +* for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    1.22 +* in the process of the client. The client initialises the server by calling the
    1.23 +* one and only ordinal.
    1.24 +*
    1.25 +*/
    1.26 +
    1.27 +
    1.28 +#include "cafserver.h"
    1.29 +#include "cafstep.h"
    1.30 +#include "bitsetstep.h"
    1.31 +#include "Consumerstep.h"
    1.32 +#include "contentstep.h"
    1.33 +#include "RecognizerStep.h"
    1.34 +#include "ManagerStep.h"
    1.35 +#include "RightsManagerStep.h"
    1.36 +#include "SupplierStep.h"
    1.37 +#include "oomstep.h"
    1.38 +#include "CafUtilsStep.h"
    1.39 +#include "CleanupStep.h"
    1.40 +
    1.41 +
    1.42 +CCAFServer* CCAFServer::NewL()
    1.43 +	{
    1.44 +	CCAFServer * server = new (ELeave) CCAFServer();
    1.45 +	CleanupStack::PushL(server);
    1.46 +	User::LeaveIfError(server->iFs.Connect());
    1.47 +
    1.48 +	// Make the file session sharable
    1.49 +	User::LeaveIfError(server->iFs.ShareProtected());
    1.50 +
    1.51 +	// CServer base class call	
    1.52 +	RProcess handle = RProcess();
    1.53 +	TParsePtrC serverName(handle.FileName());
    1.54 +	server->StartL(serverName.Name());
    1.55 +
    1.56 +	CleanupStack::Pop(server);
    1.57 +	return server;
    1.58 +	}
    1.59 +
    1.60 +// EKA2 much simpler
    1.61 +// Just an E32Main and a MainL()
    1.62 +LOCAL_C void MainL()
    1.63 +/*
    1.64 + * Much simpler, uses the new Rendezvous() call to sync with the client
    1.65 + */
    1.66 +	{
    1.67 +	// Leave the hooks in for platform security
    1.68 +#if (defined __DATA_CAGING__)
    1.69 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.70 +	RProcess().SecureApi(RProcess::ESecureApiOn);
    1.71 +#endif
    1.72 +	CActiveScheduler* sched=NULL;
    1.73 +	sched=new(ELeave) CActiveScheduler;
    1.74 +	CActiveScheduler::Install(sched);
    1.75 +	// __EDIT_ME__ Your server name
    1.76 +	CCAFServer* server = NULL;
    1.77 +	// Create the CTestServer derived server
    1.78 +	// __EDIT_ME__ Your server name
    1.79 +	TRAPD(err,server = CCAFServer::NewL());
    1.80 +	if(!err)
    1.81 +		{
    1.82 +		// Sync with the client and enter the active scheduler
    1.83 +		RProcess::Rendezvous(KErrNone);
    1.84 +		sched->Start();
    1.85 +		}
    1.86 +	delete server;
    1.87 +	delete sched;
    1.88 +	}
    1.89 +
    1.90 +GLDEF_C TInt E32Main()
    1.91 +/*
    1.92 + * return standard error code on exit
    1.93 + */
    1.94 +	{
    1.95 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.96 +	if(cleanup == NULL)
    1.97 +		{
    1.98 +		return KErrNoMemory;
    1.99 +		}
   1.100 +	TRAP_IGNORE(MainL());
   1.101 +	delete cleanup;
   1.102 +	return KErrNone;
   1.103 +    }
   1.104 +
   1.105 +// Create a thread in the calling process
   1.106 +// Emulator typhoon and earlier
   1.107 +
   1.108 +CTestStep* CCAFServer::CreateTestStep(const TDesC& aStepName)
   1.109 +/*
   1.110 + * return a CTestStep derived instance
   1.111 + * Implementation of CTestServer pure virtual
   1.112 + */
   1.113 +	{
   1.114 +	CTestStep* testStep = NULL;
   1.115 +	// They are created "just in time" when the worker thread is created
   1.116 +	if(aStepName == KCAFSizeStep)
   1.117 +		testStep = new CCAFSizeStep(*this);
   1.118 +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.119 +	else if(aStepName == KCAFSizeStep64)
   1.120 +		testStep = new CCAFSizeStep64(*this);
   1.121 +	else if(aStepName == KCAFSeekReadStep64)
   1.122 +		testStep = new CCAFSeekReadStep64(*this);
   1.123 +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   1.124 +	else if(aStepName == KCAFSeekReadStep)
   1.125 +		testStep = new CCAFSeekReadStep(*this);
   1.126 +	else if(aStepName == KBasicBitsetStep)
   1.127 +		testStep = new CBasicBitsetStep();
   1.128 +	else if(aStepName == KBitsetListStep)
   1.129 +		testStep = new CBitsetListStep();
   1.130 +	else if(aStepName == KBitsetEqualityStep)
   1.131 +		testStep = new CBitsetEqualityStep();
   1.132 +	else if(aStepName == KBitsetCopyStep)
   1.133 +		testStep = new CBitsetCopyStep();
   1.134 +	else if(aStepName == KBitsetSerialiseStep)
   1.135 +		testStep = new CBitsetSerialiseStep();
   1.136 +	else if(aStepName == KBitsetPanicStep)
   1.137 +		testStep = new CBitsetPanicStep();
   1.138 +	else if(aStepName == KCAFMultiThreadCDataStep)
   1.139 +		testStep = new CCAFMultiThreadCDataStep(*this);
   1.140 +	else if(aStepName == KCAFShareModeStep)
   1.141 +		testStep = new CCAFShareModeStep(*this);
   1.142 +	else if(aStepName == KCAFMimeTypeCDataStep)
   1.143 +		testStep = new CCAFMimeTypeCDataStep(*this);
   1.144 +	else if(aStepName == KCAFRecognizeStep)
   1.145 +		testStep = new CCAFRecognizeStep(*this);
   1.146 +	else if(aStepName == KCAFRecognizerSpeedStep)
   1.147 +		testStep = new CCAFRecognizerSpeedStep(*this);
   1.148 +	else if(aStepName == KCAFBufferSizeStep)
   1.149 +		testStep = new CCAFBufferSizeStep(*this);
   1.150 +	else if(aStepName == KCAFDeleteStep)
   1.151 +		testStep = new CCAFDeleteStep(*this);
   1.152 +	else if(aStepName == KCAFCopyFileStep)
   1.153 +		testStep = new CCAFCopyFileStep(*this);
   1.154 +	else if(aStepName == KCAFRenameFileStep)
   1.155 +		testStep = new CCAFRenameFileStep(*this);
   1.156 +	else if(aStepName == KCAFMkDirStep)
   1.157 +		testStep = new CCAFMkDirStep(*this);
   1.158 +	else if(aStepName == KCAFMkDirAllStep)
   1.159 +		testStep = new CCAFMkDirAllStep(*this);
   1.160 +	else if(aStepName == KCAFRmDirStep)
   1.161 +		testStep = new CCAFRmDirStep(*this);
   1.162 +	else if(aStepName == KCAFGetDirStep)
   1.163 +		testStep = new CCAFGetDirStep(*this);
   1.164 +	else if(aStepName == KCAFManagerNotifyStep)
   1.165 +		testStep = new CCAFManagerNotifyStep(*this);
   1.166 +	else if(aStepName == KCAFManagerSetPropertyStep)
   1.167 +		testStep = new CCAFManagerSetPropertyStep(*this);
   1.168 +	else if(aStepName == KCAFManagerDisplayInfoStep)
   1.169 +		testStep = new CCAFManagerDisplayInfoStep(*this);
   1.170 +	else if(aStepName == KCAFManagerListAgentsStep)
   1.171 +		testStep = new CCAFManagerListAgentsStep(*this);
   1.172 +	else if(aStepName == KCAFManagerAgentSpecificStep)
   1.173 +		testStep = new CCAFManagerAgentSpecificStep(*this);
   1.174 +	else if(aStepName == KCAFManagerDisplayConfigStep)
   1.175 +		testStep = new CCAFManagerDisplayConfigStep(*this);
   1.176 +	else if(aStepName == KCAFManagerAttributeStep)
   1.177 +		testStep = new CCAFManagerAttributeStep(*this);
   1.178 +	else if(aStepName == KCAFManagerAttributeSetStep)
   1.179 +		testStep = new CCAFManagerAttributeSetStep(*this);
   1.180 +	else if(aStepName == KCAFManagerStringAttributeStep)
   1.181 +		testStep = new CCAFManagerStringAttributeStep(*this);
   1.182 +	else if(aStepName == KCAFManagerStringAttributeSetStep)
   1.183 +		testStep = new CCAFManagerStringAttributeSetStep(*this);
   1.184 +	else if(aStepName == KCAFRightsManagerStep)
   1.185 +		testStep = new CCAFRightsManagerStep(*this);
   1.186 +	else if(aStepName == KCAFRightsManagerListStep)
   1.187 +		testStep = new CCAFRightsManagerListStep(*this);
   1.188 +	else if(aStepName == KCAFAttributesStep)
   1.189 +		testStep = new CCAFAttributesStep(*this);
   1.190 +	else if(aStepName == KCAFStringAttributesStep)
   1.191 +		testStep = new CCAFStringAttributesStep(*this);
   1.192 +	else if(aStepName == KCAFApparcStep)
   1.193 +		testStep = new CCAFApparcStep(*this);
   1.194 +	else if(aStepName == KCAFSupplierStep)
   1.195 +		testStep = new CCafSupplierStep(*this);
   1.196 +	else if(aStepName == KCAFSupplierAsyncStep)
   1.197 +		testStep = new CCafSupplierAsyncStep(*this);
   1.198 +	else if(aStepName == KCAFClientOutputSupplierStep)
   1.199 +		testStep = new CCafClientOutputSupplierStep(*this);
   1.200 +	else if(aStepName == KCAFSupplierSerializeStep)
   1.201 +		testStep = new CCAFSupplierSerializeStep(*this);
   1.202 +	else if(aStepName == KCAFContentAttributeStep)
   1.203 +		testStep = new CCAFContentAttributeStep(*this);
   1.204 +	else if(aStepName == KCAFContentAttributeSetStep)
   1.205 +		testStep = new CCAFContentAttributeSetStep(*this);
   1.206 +	else if(aStepName == KCAFContentStringAttributeStep)
   1.207 +		testStep = new CCAFContentStringAttributeStep(*this);
   1.208 +	else if(aStepName == KCAFContentStringAttributeSetStep)
   1.209 +		testStep = new CCAFContentStringAttributeSetStep(*this);	
   1.210 +	else if(aStepName == KCAFContentNotifyStep)
   1.211 +		testStep = new CCAFContentNotifyStep(*this);	
   1.212 +	else if(aStepName == KCAFContentSetPropertyStep)
   1.213 +		testStep = new CCAFContentSetPropertyStep(*this);	
   1.214 +	else if(aStepName == KCAFContentDisplayInfoStep)
   1.215 +		testStep = new CCAFContentDisplayInfoStep(*this);	
   1.216 +	else if(aStepName == KCAFContentAgentSpecificStep)
   1.217 +		testStep = new CCAFContentAgentSpecificStep(*this);	
   1.218 +	else if(aStepName == KCAFContentRequestRightsStep)
   1.219 +		testStep = new CCAFContentRequestRightsStep(*this);	
   1.220 +	else if(aStepName == KCAFContentEmbeddedObjectsStep)
   1.221 +		testStep = new CCAFContentEmbeddedObjectsStep(*this);	
   1.222 +	else if(aStepName == KCAFContentEmbeddedObjectTypeStep)
   1.223 +		testStep = new CCAFContentEmbeddedObjectTypeStep(*this);	
   1.224 +	else if(aStepName == KCAFContentSearchStep)
   1.225 +		testStep = new CCAFContentSearchStep(*this);	
   1.226 +	else if(aStepName == KCAFContentContainerStep)
   1.227 +		testStep = new CCAFContentContainerStep(*this);	
   1.228 +	else if(aStepName == KCAFDataAttributeStep)
   1.229 +		testStep = new CCAFDataAttributeStep(*this);
   1.230 +	else if(aStepName == KCAFDataAttributeSetStep)
   1.231 +		testStep = new CCAFDataAttributeSetStep(*this);
   1.232 +	else if(aStepName == KCAFDataStringAttributeStep)
   1.233 +		testStep = new CCAFDataStringAttributeStep(*this);
   1.234 +	else if(aStepName == KCAFDataStringAttributeSetStep)
   1.235 +		testStep = new CCAFDataStringAttributeSetStep(*this);	
   1.236 +	else if(aStepName == KCAFOomStep)
   1.237 +		testStep = new CCafOomStep(*this);
   1.238 +	else if(aStepName == KCAFHandleSizeStep)
   1.239 +		testStep = new CCAFHandleSizeStep(*this);
   1.240 +	else if(aStepName == KCAFHandleSeekReadStep)
   1.241 +		testStep = new CCAFHandleSeekReadStep(*this);
   1.242 +	else if(aStepName == KCAFHandleMultiThreadCDataStep)
   1.243 +		testStep = new CCAFHandleMultiThreadCDataStep(*this);	
   1.244 +	else if(aStepName == KCAFContentIteratorStep)
   1.245 +		testStep = new CCAFContentIteratorStep(*this);	
   1.246 +	else if(aStepName == KCAFCDirStreamStep)
   1.247 +		testStep = new CCafCDirStreamStep(*this);	
   1.248 +	else if(aStepName == KCAFRAttributeSetStreamStep)
   1.249 +		testStep = new CCafRAttributeSetStreamStep(*this);	
   1.250 +	else if(aStepName == KCAFRStringAttributeSetStreamStep)
   1.251 +		testStep = new CCafRStringAttributeSetStreamStep(*this);	
   1.252 +	else if(aStepName == KCAFSupplierOutputFileStreamStep)
   1.253 +		testStep = new CCafSupplierOutputFileStreamStep(*this);	
   1.254 +	else if(aStepName == KCAFMetaDataArrayStep)
   1.255 +		testStep = new CCafMetaDataArrayStep(*this);	
   1.256 +	else if(aStepName == KCAFEmbeddedObjectStep)
   1.257 +		testStep = new CCafEmbeddedObjectStep(*this);	
   1.258 +	else if(aStepName == KCAFVirtualPathStep)
   1.259 +		testStep = new CCafVirtualPathStep(*this);	
   1.260 +	else if(aStepName == KCAFRightsInfoStep)
   1.261 +		testStep = new CCafRightsInfoStep(*this);	
   1.262 +	else if(aStepName == KCAFStreamablePtrArrayStep)
   1.263 +		testStep = new CCafStreamablePtrArrayStep(*this);
   1.264 +#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY
   1.265 +	else if(aStepName == KCAFHTTPRequestHeadersStep)
   1.266 +		testStep = new CCAFHTTPRequestHeadersStep(*this);
   1.267 +#endif
   1.268 +	else if(aStepName == KCAFExecuteIntentStep)
   1.269 +		testStep = new CCAFExecuteIntentStep(*this);			
   1.270 +	else if(aStepName == KCAF_DEF077443_Step)
   1.271 +		testStep = new CCAF_DEF077443_Step(*this);
   1.272 +	else if(aStepName == KCAFTestCleanupStep)
   1.273 +		testStep = new CCAFTestCleanupStep(*this);
   1.274 +	else if(aStepName == KCAFDRMFileOpenPerformanceStep)
   1.275 +		testStep = new CCAFDRMFileOpenPerformanceTest(*this);
   1.276 +	else if(aStepName == KCAFManagerDisplayInfoByFileHandleStep)
   1.277 +		testStep = new CCAFManagerDisplayInfoByFileHandleStep(*this);
   1.278 +	else if(aStepName == KCAFManagerAttributeByFileHandleStep)
   1.279 +		testStep = new CCAFManagerAttributeByFileHandleStep(*this);
   1.280 +	else if(aStepName == KCAFManagerAttributeSetByFileHandleStep)
   1.281 +		testStep = new CCAFManagerAttributeSetByFileHandleStep(*this);
   1.282 +	else if(aStepName == KCAFManagerStringAttributeByFileHandleStep)
   1.283 +		testStep = new CCAFManagerStringAttributeByFileHandleStep(*this);
   1.284 +	else if(aStepName == KCAFManagerStringAttributeSetByFileHandleStep)
   1.285 +		testStep = new CCAFManagerStringAttributeSetByFileHandleStep(*this);
   1.286 +#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
   1.287 +    else if(aStepName == KCAFHelperStep)     
   1.288 +        testStep = new CCafHelperStep();     
   1.289 +    else if(aStepName == KWmdrmCAFContentStep)     
   1.290 +        testStep = new CWmdrmCAFContentStep();     
   1.291 +    else if(aStepName == KWmdrmCAFDataStep)     
   1.292 +        testStep = new CWmdrmCAFDataStep();     
   1.293 +    else if(aStepName == KWmdrmCAFReadStep)     
   1.294 +        testStep = new CWmdrmCAFReadStep();     
   1.295 +#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   1.296 +	
   1.297 +	return testStep;
   1.298 +	}
   1.299 +