diff -r abbed5a4b42a -r 8d540f55e491 tcpiputils/dnd/Test/te_dnssuffix/src/te_dnssuffixtestserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tcpiputils/dnd/Test/te_dnssuffix/src/te_dnssuffixtestserver.cpp Wed Sep 01 12:33:58 2010 +0100 @@ -0,0 +1,119 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Contains the implementation of TEF3.0 respective test server +// + + + +/** + @file + @internalTechnology +*/ + +#include "te_dnssuffixtestserver.h" + +/** +Function to instantiate TestServer. + +@return Returns the TestServer instance pointer. + +@internalTechnology +*/ +CDNSSuffixTestServer* CDNSSuffixTestServer::NewL() + { + CDNSSuffixTestServer* server = new (ELeave) CDNSSuffixTestServer(); + CleanupStack::PushL(server); + server->ConstructL(); + CleanupStack::Pop(server); + return server; + } + +/** +Function to instantiate TestBlock. + +This function is invoked by the TestEngine while parsing START_TEST_BLOCK command in the +script file. + +@return Returns the TestBlock instance pointer. + +@internalTechnology +*/ +CTestBlockController* CDNSSuffixTestServer::CreateTestBlock() + { + CTestBlockController* testBlockController=NULL; + TRAPD(err, testBlockController = CreateTestBlockL()); + if(err == KErrNone) + { + return testBlockController; + } + else + { + return NULL; + } + } + +/** +Function to instantiate TestBlock. + +@internalTechnology +*/ +CTestBlockController* CDNSSuffixTestServer::CreateTestBlockL() + { + return new (ELeave) CVirtualTunnelTestBlock(); + } + +/** +Function to kick start the TestServer. + +@internalTechnology +*/ +LOCAL_C void MainL() + { +#if (defined __DATA_CAGING__) + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CDNSSuffixTestServer* server = NULL; + TRAPD(err, server = CDNSSuffixTestServer::NewL()); + if(!err) + { + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } +/** +TestServer entry point. + +@return Returns KErrNone upon successfull completion, KErrNoMemory in low memory conditions. + +@internalTechnology +*/ +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAP_IGNORE(MainL()); + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + }