os/ossrv/compressionlibs/ziplib/test/tef/ulibz/src/ulibzserver.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/compressionlibs/ziplib/test/tef/ulibz/src/ulibzserver.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,147 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Name        : ulibzserver.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 + 
    1.22 +
    1.23 +#include <c32comm.h>
    1.24 +
    1.25 +#if defined (__WINS__)
    1.26 +#define PDD_NAME		_L("ECDRV")
    1.27 +#else
    1.28 +#define PDD_NAME		_L("EUART1")
    1.29 +#define PDD2_NAME		_L("EUART2")
    1.30 +#define PDD3_NAME		_L("EUART3")
    1.31 +#define PDD4_NAME		_L("EUART4")
    1.32 +#endif
    1.33 +
    1.34 +#define LDD_NAME		_L("ECOMM")
    1.35 +
    1.36 +/**
    1.37 + * @file
    1.38 + *
    1.39 + * Pipe test server implementation
    1.40 + */
    1.41 +#include "ulibzserver.h"
    1.42 +#include "ulibz.h"
    1.43 +
    1.44 +
    1.45 +_LIT(KServerName, "ulibz");
    1.46 +
    1.47 +
    1.48 +ClibzTestServer* ClibzTestServer::NewL()
    1.49 +	{
    1.50 +	ClibzTestServer *server = new(ELeave) ClibzTestServer();
    1.51 +	CleanupStack::PushL(server);
    1.52 +	server->ConstructL(KServerName);
    1.53 +	CleanupStack::Pop(server);
    1.54 +	return server;
    1.55 +	}
    1.56 +
    1.57 +static void InitCommsL()
    1.58 +    {
    1.59 +    TInt ret = User::LoadPhysicalDevice(PDD_NAME);
    1.60 +    User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
    1.61 +
    1.62 +#ifndef __WINS__
    1.63 +    ret = User::LoadPhysicalDevice(PDD2_NAME);
    1.64 +    ret = User::LoadPhysicalDevice(PDD3_NAME);
    1.65 +    ret = User::LoadPhysicalDevice(PDD4_NAME);
    1.66 +#endif
    1.67 +
    1.68 +    ret = User::LoadLogicalDevice(LDD_NAME);
    1.69 +    User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
    1.70 +    ret = StartC32();
    1.71 +    User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
    1.72 +    }
    1.73 +
    1.74 +LOCAL_C void MainL()
    1.75 +	{
    1.76 +	// Leave the hooks in for platform security
    1.77 +#if (defined __DATA_CAGING__)
    1.78 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.79 +	RProcess().SecureApi(RProcess::ESecureApiOn);
    1.80 +#endif
    1.81 +	//InitCommsL();
    1.82 +	
    1.83 +	CActiveScheduler* sched=NULL;
    1.84 +	sched=new(ELeave) CActiveScheduler;
    1.85 +	CActiveScheduler::Install(sched);
    1.86 +	ClibzTestServer* server = NULL;
    1.87 +	// Create the CTestServer derived server
    1.88 +	TRAPD(err, server = ClibzTestServer::NewL());
    1.89 +	if(!err)
    1.90 +		{
    1.91 +		// Sync with the client and enter the active scheduler
    1.92 +		RProcess::Rendezvous(KErrNone);
    1.93 +		sched->Start();
    1.94 +		}
    1.95 +	delete server;
    1.96 +	delete sched;
    1.97 +	}
    1.98 +
    1.99 +/**
   1.100 + * Server entry point
   1.101 + * @return Standard Epoc error code on exit
   1.102 + */
   1.103 +TInt main()
   1.104 +	{
   1.105 +	__UHEAP_MARK;
   1.106 +	CTrapCleanup* cleanup = CTrapCleanup::New();
   1.107 +	if(cleanup == NULL) 
   1.108 +		{
   1.109 +		return KErrNoMemory;  
   1.110 +		}
   1.111 +	TRAP_IGNORE(MainL());
   1.112 +	delete cleanup;
   1.113 +	__UHEAP_MARKEND;
   1.114 +	
   1.115 +	return KErrNone;
   1.116 +	}
   1.117 +
   1.118 +CTestStep* ClibzTestServer::CreateTestStep(const TDesC& aStepName)
   1.119 +	{
   1.120 +	CTestStep* testStep = NULL;
   1.121 +
   1.122 +	// This server creates just one step but create as many as you want
   1.123 +	// They are created "just in time" when the worker thread is created
   1.124 +	// install steps
   1.125 +
   1.126 +	//steps for captest.
   1.127 +	
   1.128 +	 if(aStepName == KLibzcomp_decomp)
   1.129 +		{
   1.130 +		testStep = new CTestlibz(aStepName);
   1.131 +		}
   1.132 +		
   1.133 +		if(aStepName == KLibzdefl_Infl)
   1.134 +		{
   1.135 +		testStep = new CTestlibz(aStepName);
   1.136 +		}
   1.137 +		
   1.138 +		if(aStepName == KLibzgzio)
   1.139 +		{
   1.140 +		testStep = new CTestlibz(aStepName);
   1.141 +		}
   1.142 +		if(aStepName == KLibzversion)
   1.143 +		{
   1.144 +		testStep = new CTestlibz(aStepName);
   1.145 +		}
   1.146 +
   1.147 +	return testStep;
   1.148 +	}
   1.149 +
   1.150 +