|
1 // Copyright (c) 2006-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 #ifndef __SECURECONNECTION_H__ |
|
17 #define __SECURECONNECTION_H__ |
|
18 |
|
19 #include <testexecutestepbase.h> |
|
20 #include <securesocket.h> |
|
21 #include <secdlgimpldefs.h> |
|
22 #include <http.h> |
|
23 |
|
24 //_LIT( KSecureConnection, "SecureConnection" ); |
|
25 _LIT( KUrl, "url" ); |
|
26 _LIT( KServerAuthenticationResponse, "SAResponse" ); |
|
27 _LIT( KClientAuthenticationResponse1, "CAResponse1" ); |
|
28 _LIT( KClientAuthenticationResponse2, "CAResponse2" ); |
|
29 _LIT( KKeyStorePassPhrase, "KeyStorePassPhrase" ); |
|
30 _LIT(KTlsSecureConnectionTestStep,"TSecureConnection"); |
|
31 |
|
32 /* |
|
33 //Diglog input data |
|
34 _LIT( KServerAuthenticationDlg, "ServerAuthDlg"); |
|
35 _LIT( KSADescription, "Server Authentication Dialog"); |
|
36 _LIT( KCTSecureConnectionStepDlg, "ClientAuthDlg"); |
|
37 _LIT( KCADescription, "Client Authentication Dialog"); |
|
38 _LIT( KKeyStorePassPhrase, "KeyStorePassPhrase"); |
|
39 _LIT( KDlgResponse1, "Response1"); |
|
40 _LIT( KDlgResponse2, "Response2"); |
|
41 */ |
|
42 // t_secdlg filenames |
|
43 _LIT(KTSecDlgInputFile, "\\t_secdlg_in.dat"); |
|
44 _LIT(KTSecDlgOutputFile, "\\t_secdlg_out.dat"); |
|
45 |
|
46 |
|
47 class CCommunicate; |
|
48 class CSimpleHttpClient; |
|
49 class CTSecureConnectionStep : public CTestStep |
|
50 { |
|
51 public: |
|
52 CTSecureConnectionStep(const TDesC& aStepName); |
|
53 ~CTSecureConnectionStep(); |
|
54 TVerdict doTestStepPreambleL(); |
|
55 TVerdict doTestStepL(); |
|
56 TVerdict doTestStepPostambleL(); |
|
57 void ReceiveTestResult(const TInt& aErrorCode, TVerdict aVerdict); |
|
58 |
|
59 private: |
|
60 void WriteDialogRecordL(RFileWriteStream& aStream, |
|
61 TSecurityDialogOperation aOp, |
|
62 const TDesC& aLabelSpec, |
|
63 const TDesC& aResponse1, |
|
64 const TDesC& aResponse2); |
|
65 static void InitCommsL(); |
|
66 void ConvertDlgConfigL(); |
|
67 private: |
|
68 CSimpleHttpClient* iHttp; |
|
69 RFs iFs; |
|
70 CActiveScheduler* iScheduler; |
|
71 }; |
|
72 |
|
73 class CHttpEventHandler : public CBase, public MHTTPTransactionCallback |
|
74 { |
|
75 public: |
|
76 static CHttpEventHandler* NewL(CTSecureConnectionStep* aStep); |
|
77 static CHttpEventHandler* NewLC(CTSecureConnectionStep* aStep); |
|
78 |
|
79 // methods from MHTTPTransactionCallback |
|
80 virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
81 virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
82 private: |
|
83 void ConstructL(CTSecureConnectionStep* aStep); |
|
84 MHTTPDataSupplier* iRespBody; |
|
85 CTSecureConnectionStep* iTestStep; |
|
86 }; |
|
87 |
|
88 class CSimpleHttpClient : public CBase |
|
89 { |
|
90 public: |
|
91 static CSimpleHttpClient* NewL(CTSecureConnectionStep* aStep); |
|
92 static CSimpleHttpClient* NewLC(CTSecureConnectionStep* aStep); |
|
93 virtual ~CSimpleHttpClient(); |
|
94 void StartClientL(TDesC& aUrl); |
|
95 protected: |
|
96 void ConstructL(CTSecureConnectionStep* aStep); |
|
97 private: |
|
98 void InvokeHttpMethodL(const TDesC8& aUri, const RStringF aMethod); |
|
99 void SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue); |
|
100 private: |
|
101 RHTTPSession iSess; |
|
102 RHTTPTransaction iTrans; |
|
103 CHttpEventHandler* iTransObs; |
|
104 CTSecureConnectionStep* iTestStep; |
|
105 }; |
|
106 |
|
107 #endif |
|
108 |
|
109 |
|
110 |