|
1 // Copyright (c) 2003-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 __CHTTPCONNECTFILTER_H__ |
|
17 #define __CHTTPCONNECTFILTER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <http/mhttpfilter.h> |
|
21 #include <http/rhttpsession.h> |
|
22 #include <stringpool.h> |
|
23 |
|
24 #include "mhttpconnectobserver.h" |
|
25 #include "thttpconnectcallback.h" |
|
26 |
|
27 class CHttpConnectFilter : public CBase, |
|
28 public MHTTPFilter, |
|
29 public MHttpConnectObserver |
|
30 { |
|
31 public: |
|
32 |
|
33 static CHttpConnectFilter* NewL(RHTTPSession aSession); |
|
34 virtual ~CHttpConnectFilter(); |
|
35 |
|
36 private: // methods from MHTTPFilterBase |
|
37 |
|
38 virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
39 virtual void MHFSessionRunL(const THTTPSessionEvent& aEvent); |
|
40 virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
41 virtual TInt MHFSessionRunError(TInt aError, const THTTPSessionEvent& aEvent); |
|
42 |
|
43 private: // methods from MHTTPFilter |
|
44 |
|
45 virtual void MHFUnload(RHTTPSession aSession, THTTPFilterHandle aHandle); |
|
46 virtual void MHFLoad(RHTTPSession aSession, THTTPFilterHandle aHandle); |
|
47 |
|
48 private: // methods from MHttpConnectObserver |
|
49 |
|
50 virtual void ConnectCompleteL(TInt aConnectId); |
|
51 virtual void ConnectErrorL(TInt aConnectId); |
|
52 virtual void FailPendingTransactions(TInt aConnectId); |
|
53 |
|
54 private: |
|
55 |
|
56 class TPendingTransaction |
|
57 { |
|
58 public: |
|
59 |
|
60 inline TPendingTransaction(); |
|
61 inline TPendingTransaction(RHTTPTransaction aTransaction, TInt aId); |
|
62 |
|
63 public: |
|
64 |
|
65 RHTTPTransaction iPendingTransaction; |
|
66 TInt iConnectId; |
|
67 |
|
68 }; |
|
69 |
|
70 private: |
|
71 |
|
72 CHttpConnectFilter(RHTTPSession aSession); |
|
73 void ConstructL(); |
|
74 |
|
75 TInt FindConnectRequest(RStringF aTunnelHost, RStringF aProxy); |
|
76 TInt CreateConnectTransactionL(RStringF aTunnelHost, RStringF aProxy, RStringF aUserAgent, RStringF aProfile); |
|
77 void CloseConnectTransaction(TInt aConnectId); |
|
78 |
|
79 private: |
|
80 |
|
81 TInt iLoadCount; |
|
82 RHTTPSession iSession; |
|
83 const TStringTable& iStringTable; |
|
84 RStringPool iStringPool; |
|
85 |
|
86 THttpConnectCallback iCallback; |
|
87 |
|
88 RArray<RHTTPTransaction> iConnectTransactions; |
|
89 RArray<TPendingTransaction> iPendingTransactions; |
|
90 |
|
91 RHTTPTransaction iNewConnectTransaction; |
|
92 TBool iCloseConnectTransaction; |
|
93 |
|
94 }; |
|
95 |
|
96 inline CHttpConnectFilter::TPendingTransaction::TPendingTransaction() |
|
97 { |
|
98 } |
|
99 |
|
100 inline CHttpConnectFilter::TPendingTransaction::TPendingTransaction( |
|
101 RHTTPTransaction aTransaction, |
|
102 TInt aId |
|
103 ) |
|
104 : iPendingTransaction(aTransaction), iConnectId(aId) |
|
105 { |
|
106 } |
|
107 |
|
108 #endif //__CHTTPCONNECTFILTER_H_ |