|
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 * Example file/test code to demonstrate how to develop a TestExecute Server |
|
16 * Developers should take this project as a template and substitute their own |
|
17 * code at the __EDIT_ME__ tags |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 #include "tsis.h" |
|
25 #include "recognize.h" |
|
26 #include "parsesisfile.h" |
|
27 #include "verifyintegrity.h" |
|
28 #include "verifysignature.h" |
|
29 #include "performocsp.h" |
|
30 |
|
31 // Tests |
|
32 |
|
33 namespace Swi |
|
34 { |
|
35 namespace Sis |
|
36 { |
|
37 namespace Test |
|
38 { |
|
39 |
|
40 _LIT(KServerName,"tsis"); |
|
41 |
|
42 CTestParserServer* CTestParserServer::NewL() |
|
43 { |
|
44 CTestParserServer* server = new (ELeave) CTestParserServer(); |
|
45 CleanupStack::PushL(server); |
|
46 User::LeaveIfError(server->iFs.Connect()); |
|
47 |
|
48 // Make the file session sharable |
|
49 User::LeaveIfError(server->iFs.ShareAuto()); |
|
50 |
|
51 // CServer base class call |
|
52 server->StartL(KServerName); |
|
53 CleanupStack::Pop(server); |
|
54 return server; |
|
55 } |
|
56 |
|
57 /* |
|
58 * return a CTestStep derived instance |
|
59 * Implementation of CTestServer pure virtual |
|
60 */ |
|
61 CTestStep* CTestParserServer::CreateTestStep(const TDesC& aStepName) |
|
62 { |
|
63 // Create a new step depending on the name, if we run out of memory we return NULL |
|
64 // since we cannot leave. |
|
65 if (aStepName == KParseStep) |
|
66 { |
|
67 return new CParseStep(*this); |
|
68 } |
|
69 if (aStepName == KVerifyIntegrityStep) |
|
70 { |
|
71 return new CVerifyIntegrityStep(*this, EFalse); |
|
72 } |
|
73 if (aStepName == KNewVerifyIntegrityStep) |
|
74 { |
|
75 return new CVerifyIntegrityStep(*this, ETrue); |
|
76 } |
|
77 if (aStepName == KRecognizeStep) |
|
78 { |
|
79 return new CRecognizeStep(); |
|
80 } |
|
81 if (aStepName == KVerifySignatureStep) |
|
82 { |
|
83 return new CVerifySignatureStep(*this); |
|
84 } |
|
85 if (aStepName == KPerformOCSPStep) |
|
86 { |
|
87 return new CPerformOCSPStep(*this); |
|
88 } |
|
89 return NULL; |
|
90 } |
|
91 |
|
92 } // namespace Swi::Sis::Test |
|
93 |
|
94 } // namespace Swi::Sis |
|
95 |
|
96 } //namespace Swi |
|
97 |
|
98 |
|
99 LOCAL_C void MainL() |
|
100 { |
|
101 // Leave the hooks in for platform security |
|
102 #if (defined __DATA_CAGING__) |
|
103 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
104 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
105 #endif |
|
106 CActiveScheduler* sched=NULL; |
|
107 sched=new(ELeave) CActiveScheduler; |
|
108 CActiveScheduler::Install(sched); |
|
109 // __EDIT_ME__ Your server name |
|
110 Swi::Sis::Test::CTestParserServer* server = NULL; |
|
111 // Create the CTestServer derived server |
|
112 // __EDIT_ME__ Your server name |
|
113 TRAPD(err,server = Swi::Sis::Test::CTestParserServer::NewL()); |
|
114 if(!err) |
|
115 { |
|
116 // Sync with the client and enter the active scheduler |
|
117 RProcess::Rendezvous(KErrNone); |
|
118 sched->Start(); |
|
119 } |
|
120 delete server; |
|
121 delete sched; |
|
122 } |
|
123 |
|
124 /* |
|
125 * return standard error code on exit |
|
126 */ |
|
127 GLDEF_C TInt E32Main() |
|
128 { |
|
129 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
130 if(cleanup == NULL) |
|
131 { |
|
132 return KErrNoMemory; |
|
133 } |
|
134 TRAP_IGNORE(MainL()); |
|
135 delete cleanup; |
|
136 return KErrNone; |
|
137 } |
|
138 |