installationservices/swi/test/tsisfile/tsisocsp.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * tsis.cpp
       
    16 * Example file/test code to demonstrate how to develop a TestExecute Server
       
    17 * Developers should take this project as a template and substitute their own
       
    18 * code at the __EDIT_ME__ tags
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #include <e32std.h>
       
    24 
       
    25 #include "tsis.h"
       
    26 #include "recognize.h"
       
    27 #include "parsesisfile.h"
       
    28 #include "verifyintegrity.h"
       
    29 #include "verifysignature.h"
       
    30 #include "performocsp.h"
       
    31 
       
    32 // Tests
       
    33 
       
    34 namespace Swi
       
    35 {
       
    36 namespace Sis
       
    37 {
       
    38 namespace Test
       
    39 {
       
    40 
       
    41 _LIT(KServerName,"tsis");
       
    42 
       
    43 CTestParserServer* CTestParserServer::NewL()
       
    44 	{
       
    45 	CTestParserServer* server = new (ELeave) CTestParserServer();
       
    46 	CleanupStack::PushL(server);
       
    47 	User::LeaveIfError(server->iFs.Connect());
       
    48 
       
    49 	// Make the file session sharable
       
    50 	User::LeaveIfError(server->iFs.ShareAuto());
       
    51 
       
    52 	// CServer base class call
       
    53 	server->StartL(KServerName);
       
    54 	CleanupStack::Pop(server);
       
    55 	return server;
       
    56 	}
       
    57 
       
    58 /*
       
    59  * return a CTestStep derived instance
       
    60  * Implementation of CTestServer pure virtual
       
    61  */	
       
    62 CTestStep* CTestParserServer::CreateTestStep(const TDesC& aStepName)
       
    63 	{
       
    64 	// Create a new step depending on the name, if we run out of memory we return NULL
       
    65 	// since we cannot leave.
       
    66 	if (aStepName == KParseStep)
       
    67 		{
       
    68 		return new CParseStep(*this);
       
    69 		}
       
    70 	if (aStepName == KVerifySignatureStep)
       
    71 		{
       
    72 		return new CVerifySignatureStep(*this);		
       
    73 		}				
       
    74 	if (aStepName == KPerformOCSPStep)
       
    75 		{
       
    76 		return new CPerformOCSPStep(*this);		
       
    77 		}				
       
    78 	return NULL;
       
    79 	}
       
    80 
       
    81 } // namespace Swi::Sis::Test
       
    82 	
       
    83 } // namespace Swi::Sis
       
    84 
       
    85 } //namespace Swi
       
    86 
       
    87 
       
    88 
       
    89 LOCAL_C void MainL()
       
    90 	{
       
    91 	// Leave the hooks in for platform security
       
    92 #if (defined __DATA_CAGING__)
       
    93 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    94 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    95 #endif
       
    96 	CActiveScheduler* sched=NULL;
       
    97 	sched=new(ELeave) CActiveScheduler;
       
    98 	CActiveScheduler::Install(sched);
       
    99 	// __EDIT_ME__ Your server name
       
   100 	Swi::Sis::Test::CTestParserServer* server = NULL;
       
   101 	// Create the CTestServer derived server
       
   102 	// __EDIT_ME__ Your server name
       
   103 	TRAPD(err,server = Swi::Sis::Test::CTestParserServer::NewL());
       
   104 	if(!err)
       
   105 		{
       
   106 		// Sync with the client and enter the active scheduler
       
   107 		RProcess::Rendezvous(KErrNone);
       
   108 		sched->Start();
       
   109 		}
       
   110 	delete server;
       
   111 	delete sched;
       
   112 	}
       
   113 
       
   114 /*
       
   115  * return standard error code on exit
       
   116  */
       
   117 GLDEF_C TInt E32Main()
       
   118 	{
       
   119 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   120 	if(cleanup == NULL)
       
   121 		{
       
   122 		return KErrNoMemory;
       
   123 		}
       
   124 	TRAPD(err,MainL());
       
   125 	delete cleanup;
       
   126 	return KErrNone;
       
   127     }
       
   128