os/security/cryptoservices/certificateandkeymgmt/tpkcs12intgrtn/src/tpkcs12libtestserver.cpp
Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #include "tpkcs12libtestserver.h"
21 #include "tpkcs12libteststep.h"
24 _LIT(KServerName, "tpkcs12libtest");
25 CPKCS12LibTestServer* CPKCS12LibTestServer::NewL()
27 * @return - Instance of the test server
28 * Called inside the Mail() function to create and start the
29 * CTestServer derived server
33 CPKCS12LibTestServer* server = new (ELeave) CPKCS12LibTestServer();
34 CleanupStack::PushL(server);
35 server->ConstructL(KServerName);
36 CleanupStack::Pop(server);
41 CTestStep* CPKCS12LibTestServer::CreateTestStep(const TDesC& aStepName)
43 * @return - A CTestStep derived instance
44 * Implementation of CTestServer pure virtual
47 CTestStep* testStep = NULL;
49 if(aStepName == KStep)
51 testStep = new CPKCS12LibTestStep();
53 if(aStepName == KTPKCS12OOMStep)
55 testStep = new CTPKCS12OOMStep();
61 // Just an E32Main and a MainL()
64 * Much simpler, uses the new Rendezvous() call to sync with the client
67 // Leave the hooks in for platform security
68 #if (defined __DATA_CAGING__)
69 RProcess().DataCaging(RProcess::EDataCagingOn);
70 RProcess().SecureApi(RProcess::ESecureApiOn);
72 CActiveScheduler* sched=NULL;
73 sched=new(ELeave) CActiveScheduler;
74 CActiveScheduler::Install(sched);
75 // __EDIT_ME__ Your server name
76 CPKCS12LibTestServer* server = NULL;
77 // Create the CTestServer derived server
78 // __EDIT_ME__ Your server name
79 TRAPD(err,server = CPKCS12LibTestServer::NewL());
82 // Sync with the client and enter the active scheduler
83 RProcess::Rendezvous(KErrNone);
91 GLDEF_C TInt E32Main()
93 * @return - Standard Epoc error code on exit
96 CTrapCleanup* cleanup = CTrapCleanup::New();
102 // This if statement is here just to shut up RVCT, which would otherwise warn
103 // that err was set but never used
112 // Create a thread in the calling process
113 // Emulator typhoon and earlier
114 #if (defined __WINS__ && !defined EKA2)
115 TInt ThreadFunc (TAny* /*aParam*/)
117 * @return - Server exit code
119 * Server Thread function. Guts of the code in the MainL() function
125 EXPORT_C TInt WinsMain()
127 * @return - Standard Epoc error codes
128 * 1st and only ordinal, called by the client API to initialise the server
131 _LIT(KThread,"Thread");
133 // __EDIT_ME__ - Make sure the TBuf is large enough
134 TBuf<KMaxTestExecuteNameLength> threadName(KServerName);
135 // Create a hopefully unique thread name and use the ThreadFunc
136 threadName.Append(KThread);
137 const TInt KMaxHeapSize = 0x1000000; ///< Allow a 1Mb max heap
138 TInt err = thread.Create(threadName, ThreadFunc, KDefaultStackSize,
139 KMinHeapSize, KMaxHeapSize,
140 NULL, EOwnerProcess);
148 GLDEF_C TInt E32Dll(enum TDllReason)