|
1 /* |
|
2 * Copyright (c) 2002-2005 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 "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: Header description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 #ifndef SEN_HTTP_CHANNEL_IMPL_H |
|
29 #define SEN_HTTP_CHANNEL_IMPL_H |
|
30 |
|
31 // INCLUDES |
|
32 #include <badesca.h> |
|
33 #include <http/mhttpauthenticationcallback.h> |
|
34 #include <flogger.h> |
|
35 #include <es_sock.h> |
|
36 #include <commdbconnpref.h> |
|
37 |
|
38 #include "senhttpchannel.h" |
|
39 #include "MSenElement.h" |
|
40 #include "SenIdentityProvider.h" |
|
41 #include "senpointermap.h" |
|
42 #include "senmtomtxnstate.h" |
|
43 |
|
44 _LIT(KColon, ":"); |
|
45 |
|
46 // Multipart message |
|
47 _LIT8(KMimeAccept, "*/*"); |
|
48 |
|
49 // Panics |
|
50 _LIT(KUnrecognisedValueTypeOfContentTypePanicText, "ContentType has unrecognised value"); |
|
51 |
|
52 // FORWARD DECLARATIONS |
|
53 class CSenHttpEventHandler; |
|
54 class CSenTxnState; |
|
55 class CSenAtomEntry; |
|
56 //class CSenMtomTxnState; |
|
57 class MSenIdentityManager; |
|
58 //class CSenElement; |
|
59 class CSenLayeredHttpTransportProperties; |
|
60 |
|
61 // CLASS DECLARATION |
|
62 class CSenHttpChannelImpl : public CSenHttpChannel, |
|
63 public MHTTPAuthenticationCallback |
|
64 { |
|
65 public: |
|
66 static CSenHttpChannelImpl* NewL(MSenIdentityManager& aManager); |
|
67 static CSenHttpChannelImpl* NewLC(MSenIdentityManager& aManager); |
|
68 static CSenHttpChannelImpl* NewL(MSenIdentityManager& aManager, TUint32 aIapId); |
|
69 static CSenHttpChannelImpl* NewLC(MSenIdentityManager& aManager, TUint32 aIapId); |
|
70 |
|
71 virtual ~CSenHttpChannelImpl(); |
|
72 |
|
73 void HandleResponseHeadersL(RHTTPTransaction aTransaction); |
|
74 void HandleResponseBodyDataL(RHTTPTransaction aTransaction); |
|
75 void HandleResponseL(RHTTPTransaction aTransaction); |
|
76 void HandleRunErrorL(RHTTPTransaction aTransaction, TInt aError); |
|
77 void HandleRedirectRequiresConfirmationL(RHTTPTransaction aTransaction); |
|
78 |
|
79 // Functions from base classes |
|
80 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
81 const TDesC8& aUri, |
|
82 const TDesC8& aContent, |
|
83 CSenLayeredHttpTransportProperties& aProps); |
|
84 |
|
85 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
86 const TDesC8& aUri, |
|
87 CSenSoapEnvelope2& aContent, |
|
88 CSenLayeredHttpTransportProperties& aProps); |
|
89 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
90 const TDesC8& aUri, |
|
91 CSenAtomEntry& aContent, |
|
92 CSenLayeredHttpTransportProperties& aProps); |
|
93 |
|
94 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
95 const TDesC8& aUri, |
|
96 const RFile& aFile, |
|
97 CSenLayeredHttpTransportProperties& aProps); |
|
98 |
|
99 |
|
100 virtual void SetProxyL(const TDesC8& aProxyHostBaseAddr, |
|
101 TInt aProxyPort); |
|
102 virtual void SetProxyL(const TDesC8& aProxyAddrStr); |
|
103 virtual void SetHttpVersionL(TInt aVersion); |
|
104 virtual void SetProxyUsageL(TBool aProxyUsage); |
|
105 virtual void SetSecureDialogL(TBool aSecureDialog); |
|
106 |
|
107 TInt CancelTransaction(const TInt aTxnId); |
|
108 void CancelAllTransactions(); |
|
109 |
|
110 void SetExplicitIapDefined(TBool aExplicitIapDefined); |
|
111 /* |
|
112 * Getter for currently effective IAP ID |
|
113 * @param aIapId will be assigned to hold |
|
114 * the value of that Internet Access Point |
|
115 * identifier (an unsigned integer utilized |
|
116 * by CommsDB API). |
|
117 * @return EFalse, if IAP ID has not been |
|
118 * specified. Otherwise, returns ETrue. |
|
119 */ |
|
120 virtual TBool EffectiveIapId(TUint32 &aIapId); |
|
121 |
|
122 // Helper, for file logging. |
|
123 //RFileLogger* Log() const; |
|
124 void NotifyMoreBodyL(); |
|
125 |
|
126 // Functions from MHTTPAuthenticationCallback |
|
127 virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm, |
|
128 RStringF aAuthenticationType, |
|
129 RString& aUsername, |
|
130 RString& aPassword); |
|
131 void EnableTimeOutL(TInt aTxnId, TInt aTimeOutSec); |
|
132 void DisableTimeOutL(TInt aTxnId); |
|
133 virtual TInt32 UsedIap(); |
|
134 |
|
135 protected: |
|
136 CSenHttpChannelImpl(MSenIdentityManager& aManager); |
|
137 |
|
138 void AddRequestHeadersL(RHTTPHeaders& aHeaders, CSenLayeredHttpTransportProperties& aProps); |
|
139 void AppendNewTxnStateL(CSenTxnState* aTxnState); |
|
140 void DeleteTxnState(TInt aTxnId); |
|
141 CSenTxnState* FindTxnState(TInt aTxnId, TInt* aIndex = NULL); |
|
142 /** |
|
143 * Applies new IAP preferencies to current HTTP Session (RHTTPSession) |
|
144 * @param aIapId new IAP ID |
|
145 * @param aDialogPref shows is IAPDialog allowed or not |
|
146 * @param aConnection is the connection to be attached to HTTP session |
|
147 * @param aSocketServer is the socket server to be attached to HTTP session |
|
148 * Leaves with system-wide error code if preferences cannot be set. |
|
149 */ |
|
150 TInt SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer ); |
|
151 TInt SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer ); |
|
152 |
|
153 //void SetupConnectionWithIapPrefsL( TUint32 aIapId, RConnection& aConnection, RSocketServ& aSocketServer ); |
|
154 //void AttachSocketServerAndConnectionWithHttpSession( TUint32 aIapId, RConnection& aConnection, RSocketServ& aSocketServer ); |
|
155 |
|
156 void ConstructL(); |
|
157 void ConstructL( TUint32 aIapId ); |
|
158 |
|
159 |
|
160 private: |
|
161 |
|
162 // New functions |
|
163 |
|
164 |
|
165 TPtrC8 SoapActionL(MSenElement& aSoapEnvelope); |
|
166 TInt SubmitRequestL(MSenResponseObserver& aObserver, |
|
167 const TDesC8& aUri, |
|
168 const TDesC8* aContentType = NULL, |
|
169 const TDesC8* aContent = NULL); |
|
170 |
|
171 TInt SubmitRequestL(MSenResponseObserver& aObserver, |
|
172 const TDesC8& aUri, |
|
173 MSenElement& aMessage, |
|
174 const TDesC8* aContentType = NULL); |
|
175 |
|
176 TInt InvokeHttpMethodL(CSenTxnState* aTxnState, |
|
177 CSenLayeredHttpTransportProperties& aProps); |
|
178 |
|
179 void ListFilters(); |
|
180 void DumpRespHeadersL(RHTTPTransaction& aTrans); |
|
181 void DumpBodyData(const TDesC8& aData); |
|
182 TInt ContentTypeParamValueL(const RHTTPHeaders& aResponseHeaders, |
|
183 const RStringF& aContent, |
|
184 const TPtrC8& aParamName, |
|
185 SenMultiPartUtils::TMultiPartContentType& aMultiPartContentType); |
|
186 |
|
187 protected: |
|
188 RSocketServ iSockServ; |
|
189 RConnection iConnection; |
|
190 TUint32 iIapId; |
|
191 TUint32 iUsedIapId; |
|
192 TUint32 iSnapId; |
|
193 RStringPool iStringPool; |
|
194 RHTTPSession iSess; |
|
195 CSenHttpEventHandler* iTransObs; |
|
196 //RFileLogger iLog; |
|
197 |
|
198 private: |
|
199 |
|
200 CArrayPtrFlat<CSenTxnState>* iTxnStates; |
|
201 MSenIdentityManager& iManager; |
|
202 TInt iBasicConnectionTries; |
|
203 CSenIdentityProvider* iSessionAuthentication; // NOT owned |
|
204 TBool iPasswordFromUser; // Is ETrue if data from identitymanager is |
|
205 TPtrC8 iContentType; // content type of usual response |
|
206 TBool iExplicitIapDefined; |
|
207 HBufC8* iProxyHostPort; |
|
208 TBool iXopResponse; |
|
209 TBool iDeflateFilter;//Is true if deflate filter loaded for a session |
|
210 TBool iHasHttpContentType; |
|
211 SenMultiPartUtils::TMultiPartContentType iMultiPartContentType; // content type of MultiPart response |
|
212 RHTTPTransaction iHttpTransaction ; |
|
213 }; |
|
214 |
|
215 #endif //SEN_HTTP_CHANNEL_IMPL_H |
|
216 |
|
217 // End of file |