1 /* |
|
2 * Copyright (c) 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: CXcapHttpTransport |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __XCAPHTTPTRANSPORT__ |
|
22 #define __XCAPHTTPTRANSPORT__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <http.h> |
|
26 #include <XdmCredentials.h> |
|
27 |
|
28 //COMMON CONSTANTS |
|
29 _LIT( KTransportLogFile, "HttpTransport" ); |
|
30 const TInt KTransportLogBufMaxSize = 2000; |
|
31 _LIT( KTransportDateFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S.%C%:3"); |
|
32 const TInt KMaxSubmitSize = 1024; |
|
33 const TInt KMaxHeaderNameLen = 32; |
|
34 const TInt KMaxHeaderValueLen = 128; |
|
35 const TInt KBufferMaxSize = 2048; |
|
36 |
|
37 //FORWARD DECLARATIONS |
|
38 class CXdmLogWriter; |
|
39 class MMsgConnManager; |
|
40 class CXcapHttpReqGet; |
|
41 class CXcapHttpReqPut; |
|
42 class CXcapHttpReqDelete; |
|
43 class CXcapHttpAuthManager; |
|
44 |
|
45 // CLASS DECLARATION |
|
46 class CXcapHttpTransport : public CBase |
|
47 |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Symbian OS default constructor. |
|
53 */ |
|
54 IMPORT_C static CXcapHttpTransport* NewL( const TDesC& aRootUri, |
|
55 MMsgConnManager& aConnManager, |
|
56 const TXdmCredentials& aDigestCredentials ); |
|
57 |
|
58 /** |
|
59 * A global logging function for 8 bit data. |
|
60 * @param aCommand command to be handled |
|
61 */ |
|
62 IMPORT_C TPtrC8 RootUri(); |
|
63 |
|
64 /** |
|
65 * Send one IMPS message. |
|
66 */ |
|
67 IMPORT_C CXcapHttpReqGet* GetL( const TDesC& aUri ); |
|
68 |
|
69 /** |
|
70 * Send one IMPS message. |
|
71 */ |
|
72 IMPORT_C CXcapHttpReqPut* PutL( const TDesC& aUri ); |
|
73 |
|
74 /** |
|
75 * Send one IMPS message. |
|
76 */ |
|
77 IMPORT_C CXcapHttpReqDelete* DeleteL( const TDesC& aUri ); |
|
78 |
|
79 /** |
|
80 * Stores the address of the proxy currently in use |
|
81 * @param aProxy Address of the HTTP proxy server |
|
82 */ |
|
83 IMPORT_C void SetRootUriL( const TDesC& aRootUri ); |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 */ |
|
88 IMPORT_C virtual ~CXcapHttpTransport(); |
|
89 |
|
90 public: //New functions |
|
91 |
|
92 /** |
|
93 * A global logging function for 8 bit data. |
|
94 * @param aCommand command to be handled |
|
95 */ |
|
96 static TXdmCredentials& Credentials(); |
|
97 |
|
98 #ifdef _DEBUG |
|
99 |
|
100 /** |
|
101 * A global logging function for 8 bit data. |
|
102 * @param aCommand command to be handled |
|
103 */ |
|
104 void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const; |
|
105 |
|
106 /** |
|
107 * A global logging function for 16 bit data. |
|
108 * @param aCommand command to be handled |
|
109 */ |
|
110 void WriteToLog( TRefByValue<const TDesC> aFmt,... ) const; |
|
111 |
|
112 #endif //_DEBUG |
|
113 |
|
114 private: |
|
115 |
|
116 /** |
|
117 * C++ default constructor. |
|
118 */ |
|
119 CXcapHttpTransport( MMsgConnManager& aConnManager ); |
|
120 |
|
121 /** |
|
122 * Symbian OS default constructor. |
|
123 * @param aMimeType MIME type of the messages |
|
124 */ |
|
125 void ConstructL( const TDesC& aRootUri, const TXdmCredentials& aDigestCredentials ); |
|
126 |
|
127 /** |
|
128 * Symbian OS default constructor. |
|
129 * @param aMimeType MIME type of the messages |
|
130 */ |
|
131 HBufC8* ConstructRequestUriLC( const TDesC& aDocumentSelector ); |
|
132 |
|
133 /** |
|
134 * Initialises an HTTP session |
|
135 */ |
|
136 void InitialiseSessionL(); |
|
137 |
|
138 private: //Data |
|
139 |
|
140 TBool iCredValidity; |
|
141 TBool iSessionClosed; |
|
142 HBufC8* iRootUri; |
|
143 HBufC8* iProxyBuffer; |
|
144 RHTTPSession iHttpSession; |
|
145 CXdmLogWriter* iLogWriter; |
|
146 MMsgConnManager& iConnManager; |
|
147 CXcapHttpAuthManager* iAuthManager; |
|
148 }; |
|
149 |
|
150 #endif |
|
151 |
|
152 // End of File |
|