00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef SYMBIANTRANSPORTAGENT_H_
00036 #define SYMBIANTRANSPORTAGENT_H_
00037
00038 #include <coecntrl.h>
00039
00040 #include "base/globalsdef.h"
00041 #include <http\mhttptransactioncallback.h>
00042 #include <http\mhttpdatasupplier.h>
00043
00044 #include <http\rhttpsession.h>
00045 #include <http\rhttpheaders.h>
00046
00047 #include "http/URL.h"
00048 #include "http/Proxy.h"
00049 #include "http/TransportAgent.h"
00050
00051 BEGIN_NAMESPACE
00052
00058 class CSymbianTransportAgent : public CBase,
00059 public MHTTPTransactionCallback,
00060 public MHTTPDataSupplier,
00061 public TransportAgent
00062 {
00063 public:
00069 static CSymbianTransportAgent* NewL(URL& aUrl,Proxy& aProxy,
00070 unsigned int aResponseTimeout = DEFAULT_MAX_TIMEOUT,
00071 unsigned int aMaxMsgSize = DEFAULT_MAX_MSG_SIZE);
00072
00078 static CSymbianTransportAgent* NewLC(URL& aUrl,Proxy& aProxy,
00079 unsigned int aResponseTimeout = DEFAULT_MAX_TIMEOUT,
00080 unsigned int aMaxMsgSize = DEFAULT_MAX_MSG_SIZE);
00081
00086 ~CSymbianTransportAgent();
00087
00092 void ConnectL();
00093
00098 void SetIap(const TUint32& aIap);
00099
00100 private:
00105 void ConstructL(URL& aUrl);
00106
00111 CSymbianTransportAgent(URL& aUrl, Proxy& aProxy,
00112 unsigned int aResponseTimeout);
00113
00121 void SetHeaderL(RHTTPHeaders aHeaders,
00122 TInt aHdrField,
00123 const TDesC8& aHdrValue);
00124
00125
00126
00130 private:
00137 void MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent );
00138
00149 TInt MHFRunError( TInt aError,
00150 RHTTPTransaction aTransaction,
00151 const THTTPEvent& aEvent );
00152
00153
00159 void SetHttpClientError(TInt aStatus);
00160
00166 void SetHttpServerError(TInt aStatus);
00167
00168
00169
00170
00171 public:
00175 char* sendMessage(const char* msg);
00176
00177
00178
00179
00180 public:
00181 TBool GetNextDataPart(TPtrC8& aDataChunk);
00182 void ReleaseData();
00183 TInt OverallDataSize();
00184 TInt Reset();
00185
00186
00187 private:
00188
00189 TUint32 iIap;
00190
00191 RHTTPSession iHttpSession;
00192 RHTTPTransaction iHttpTransaction;
00193 MHTTPDataSupplier* iDataSupplier;
00194 HBufC8* iPostBody;
00195 HBufC8* iResponseBody;
00196 TBool iTransFailed;
00197 CActiveSchedulerWait* iASWait;
00198 };
00199
00200 END_NAMESPACE
00201
00202 #endif //SYMBIANTRANSPORTAGENT_H_