networksecurity/tlsprovider/Test/ttlscertcache/ttlscertcacheserver.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "ttlscertcacheserver.h"
       
    17 
       
    18 #include "updateentrystep.h"
       
    19 #include "entrystatusstep.h"
       
    20 
       
    21 _LIT(KServerName,"ttlscertcache");
       
    22 
       
    23 CTlsCertCacheServer* CTlsCertCacheServer::NewL()
       
    24 /**
       
    25  * @return - Instance of the test server
       
    26  * Called inside the MainL() function to create and start the
       
    27  * CTestServer derived server.
       
    28  */
       
    29 	{
       
    30 	
       
    31 	CTlsCertCacheServer* server = new (ELeave) CTlsCertCacheServer();
       
    32 	CleanupStack::PushL(server);
       
    33 	// CServer base class call
       
    34 	server->StartL(KServerName);
       
    35 	CleanupStack::Pop(server);
       
    36 	return server;
       
    37 	}
       
    38 
       
    39 LOCAL_C void MainL()
       
    40 /**
       
    41  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    42  */
       
    43 	{
       
    44 	CActiveScheduler* sched=NULL;
       
    45 	sched=new(ELeave) CActiveScheduler;
       
    46 	CActiveScheduler::Install(sched);
       
    47 	
       
    48 	CTlsCertCacheServer* server = NULL;
       
    49 	// Create the CTestServer derived server	
       
    50 	TRAPD(err,server = CTlsCertCacheServer::NewL());
       
    51 	if(!err)
       
    52 		{
       
    53 		// Sync with the client and enter the active scheduler
       
    54 		RProcess::Rendezvous(KErrNone);
       
    55 		sched->Start();
       
    56 		}
       
    57 	delete server;
       
    58 	delete sched;
       
    59 	}
       
    60 	
       
    61 TInt E32Main()
       
    62 	{
       
    63 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    64 	TInt err = KErrNoMemory;
       
    65 	if (cleanup)
       
    66 		{
       
    67 		TRAP(err, MainL());
       
    68 		}
       
    69 	return err;
       
    70 	}
       
    71 
       
    72 
       
    73 CTestStep* CTlsCertCacheServer::CreateTestStep(const TDesC& aStepName)
       
    74 	{
       
    75 	
       
    76 	CTestStep* step = NULL;
       
    77 	
       
    78 	if (aStepName == KUpdateEntryStep)
       
    79 		{
       
    80 		step = new CUpdateEntryStep;
       
    81 		}
       
    82 	else if (aStepName == KEntryStatus)
       
    83 		{
       
    84 		step = new CEntryStatusStep;
       
    85 		}
       
    86 
       
    87 	return step;
       
    88 	}