|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef T_CATALOGSHTTPTYPES_H |
|
20 #define T_CATALOGSHTTPTYPES_H |
|
21 |
|
22 #include <HttpDownloadMgrCommon.h> |
|
23 |
|
24 class MCatalogsHttpOperation; |
|
25 |
|
26 /** |
|
27 * HTTP events |
|
28 */ |
|
29 |
|
30 /** |
|
31 * HTTP operation states |
|
32 */ |
|
33 enum TCatalogsHttpOperationState |
|
34 { |
|
35 /** |
|
36 * The operation has been created. This is the initial state |
|
37 * of the operation and no event will be sent for it. |
|
38 */ |
|
39 ECatalogsHttpOpCreated, |
|
40 |
|
41 /** |
|
42 * The operation is in progress |
|
43 */ |
|
44 ECatalogsHttpOpInProgress, |
|
45 |
|
46 /** |
|
47 * The operation is on pause. |
|
48 * The operation is not automatically resumed from this state |
|
49 */ |
|
50 ECatalogsHttpOpPaused, |
|
51 |
|
52 /** |
|
53 * The operation is in the operation queue waiting for its |
|
54 * execution. |
|
55 * |
|
56 * The difference between ECatalogsHttpOpPaused |
|
57 * and ECatalogsHttpOpQueued is that the operation goes to the |
|
58 * former state if the client pauses the operation. The latter state |
|
59 * is entered automatically if the limit for concurrently executing |
|
60 * operations would be otherwise exceeded. |
|
61 * |
|
62 * The operation will be automatically resumed. |
|
63 */ |
|
64 ECatalogsHttpOpQueued, |
|
65 |
|
66 /** |
|
67 * The operation is complete |
|
68 */ |
|
69 ECatalogsHttpOpCompleted, |
|
70 |
|
71 /** |
|
72 * The operation failed |
|
73 * |
|
74 * This event is not sent to observers. Handle failures in HandleHttpError() |
|
75 * Transport uses this internally. |
|
76 */ |
|
77 ECatalogsHttpOpFailed, |
|
78 |
|
79 |
|
80 /** |
|
81 * Not supported yet |
|
82 * @ Fix this |
|
83 */ |
|
84 ECatalogsHttpOpMediaRemoved, |
|
85 ECatalogsHttpOpMediaInserted, |
|
86 |
|
87 /** |
|
88 * The operation can be paused. Event for this will be sent |
|
89 * only after ECatalogsHttpOpNonPausable |
|
90 */ |
|
91 ECatalogsHttpOpPausable, |
|
92 |
|
93 /** |
|
94 * The operation cannot currently be paused |
|
95 */ |
|
96 ECatalogsHttpOpNonPausable, |
|
97 |
|
98 /** |
|
99 * The operation is already running |
|
100 */ |
|
101 ECatalogsHttpOpAlreadyRunning, |
|
102 |
|
103 /** |
|
104 * The operation is being deleted |
|
105 */ |
|
106 ECatalogsHttpOpDeleting |
|
107 }; |
|
108 |
|
109 |
|
110 /** |
|
111 * HTTP operation state progress |
|
112 */ |
|
113 enum TCatalogsHttpProgressState |
|
114 { |
|
115 /** |
|
116 * Initial state of the operation |
|
117 */ |
|
118 ECatalogsHttpNone, |
|
119 |
|
120 /** |
|
121 * The operation has started. |
|
122 * Event about this is sent only for downloads |
|
123 */ |
|
124 ECatalogsHttpStarted, |
|
125 |
|
126 /** |
|
127 * The operation is creating a network connection. |
|
128 * Event about this is sent only for downloads |
|
129 */ |
|
130 ECatalogsHttpCreatingConnection, |
|
131 |
|
132 /** |
|
133 * The operation has created a network connection |
|
134 * with the server. |
|
135 */ |
|
136 ECatalogsHttpConnected, |
|
137 |
|
138 /** |
|
139 * Network connection has been suspended. |
|
140 * Event about this is sent only for downloads |
|
141 */ |
|
142 ECatalogsHttpConnectionSuspended, |
|
143 |
|
144 /** |
|
145 * Network connection was disconnected. |
|
146 * Event about this is sent only for downloads |
|
147 */ |
|
148 ECatalogsHttpDisconnected, |
|
149 |
|
150 /** |
|
151 * The download has started |
|
152 * Event about this is sent only for downloads |
|
153 */ |
|
154 ECatalogsHttpDownloadStarted, |
|
155 |
|
156 |
|
157 /** |
|
158 * The operation has received the content type header |
|
159 * @note There won't be a separate ECatalogsHttpResponseHeaderReceived |
|
160 * event for content type receival. |
|
161 */ |
|
162 ECatalogsHttpContentTypeReceived, |
|
163 |
|
164 /** |
|
165 * Event about this is sent only for downloads |
|
166 */ |
|
167 ECatalogsHttpSubmitIssued, |
|
168 |
|
169 /** |
|
170 * The operation has received a response header |
|
171 */ |
|
172 ECatalogsHttpResponseHeaderReceived, |
|
173 |
|
174 /** |
|
175 * The operation has received a part of the response body. |
|
176 * |
|
177 * Transaction observers should request the body when handling |
|
178 * this event since the body will be lost after the handler exits. |
|
179 * |
|
180 * For downloads the body is empty since it is written straight to |
|
181 * a file. |
|
182 */ |
|
183 ECatalogsHttpResponseBodyReceived, |
|
184 |
|
185 /** |
|
186 * The download has been redirected permanently. |
|
187 * Transactions don't support redirection. |
|
188 * Event about this is sent only for downloads |
|
189 */ |
|
190 ECatalogsHttpRedirectedPermanently, |
|
191 |
|
192 /** |
|
193 * The download has been redirected temporarily. It shouldn't be |
|
194 * paused because there's no guarantee that it can be resumed correctly |
|
195 * Transactions don't support redirection. |
|
196 * Event about this is sent only for downloads |
|
197 */ |
|
198 ECatalogsHttpRedirectedTemporarily, |
|
199 |
|
200 /** |
|
201 * |
|
202 * Event about this is sent only for downloads |
|
203 */ |
|
204 ECatalogsHttpNameChanged, |
|
205 |
|
206 /** |
|
207 * |
|
208 * Event about this is sent only for downloads |
|
209 */ |
|
210 ECatalogsHttpContentTypeChanged, |
|
211 |
|
212 /** |
|
213 * |
|
214 * Event about this is sent only for downloads |
|
215 */ |
|
216 ECatalogsHttpMovingContentFile, |
|
217 |
|
218 /** |
|
219 * |
|
220 * Event about this is sent only for downloads |
|
221 */ |
|
222 ECatalogsHttpContentFileMoved, |
|
223 |
|
224 ECatalogsHttpDone = ECatalogsHttpContentFileMoved |
|
225 |
|
226 }; |
|
227 |
|
228 |
|
229 |
|
230 /** |
|
231 * Error types |
|
232 */ |
|
233 enum TCatalogsHttpErrorType |
|
234 { |
|
235 ECatalogsHttpErrorGeneral = 0, |
|
236 ECatalogsHttpErrorHttp |
|
237 }; |
|
238 |
|
239 |
|
240 /** |
|
241 * HTTP event |
|
242 */ |
|
243 struct TCatalogsHttpEvent |
|
244 { |
|
245 /// State of the operation |
|
246 TCatalogsHttpOperationState iOperationState; |
|
247 |
|
248 /// Progress of the operation state |
|
249 TCatalogsHttpProgressState iProgressState; |
|
250 |
|
251 TCatalogsHttpEvent( const TCatalogsHttpOperationState& aOpState, |
|
252 const TCatalogsHttpProgressState& aPrState ) : |
|
253 iOperationState( aOpState ), iProgressState( aPrState ) |
|
254 { |
|
255 } |
|
256 }; |
|
257 |
|
258 |
|
259 /** |
|
260 * HTTP erros |
|
261 */ |
|
262 struct TCatalogsHttpError |
|
263 { |
|
264 /** |
|
265 * Defines the interpretation for iError |
|
266 */ |
|
267 TCatalogsHttpErrorType iType; |
|
268 |
|
269 /** |
|
270 * Error code. |
|
271 * |
|
272 * If iType is ECatalogsHttpErrorGeneral then this is a Symbian error |
|
273 * code. |
|
274 * If iType is ECatalogsHttpErrorHttp then this is a HTTP status code |
|
275 */ |
|
276 TInt iError; |
|
277 |
|
278 TCatalogsHttpError( const TCatalogsHttpErrorType& aType, TInt aError ) : |
|
279 iType( aType ), iError( aError ) |
|
280 { |
|
281 } |
|
282 }; |
|
283 |
|
284 /** |
|
285 * HTTP methods |
|
286 */ |
|
287 enum TCatalogsHttpMethod |
|
288 { |
|
289 ECatalogsHttpGet = 0, |
|
290 ECatalogsHttpPost, |
|
291 ECatalogsHttpPut, |
|
292 ECatalogsHttpHead |
|
293 }; |
|
294 |
|
295 |
|
296 /** |
|
297 * HTTP operation types |
|
298 */ |
|
299 enum TCatalogsHttpOperationType |
|
300 { |
|
301 ECatalogsHttpTransaction = 0, |
|
302 ECatalogsHttpDownload, |
|
303 ECatalogsHttpUpload |
|
304 }; |
|
305 |
|
306 |
|
307 |
|
308 /** |
|
309 * HTTP configuration events |
|
310 * INTERNAL |
|
311 * @see MCatalogsHttpConfigObserver |
|
312 * @see MCatalogsHttpConfig |
|
313 */ |
|
314 enum TCatalogsHttpConfigEvent |
|
315 { |
|
316 ECatalogsHttpCfgPriorityChanged = 0 |
|
317 }; |
|
318 |
|
319 |
|
320 /** |
|
321 * HTTP transaction types |
|
322 * INTERNAL |
|
323 */ |
|
324 enum TCatalogsHttpTransactionType |
|
325 { |
|
326 ECatalogsHttpTransactionNormal = 0, |
|
327 ECatalogsHttpTransactionDownload |
|
328 }; |
|
329 |
|
330 |
|
331 /** |
|
332 * Modes for getting HTTP headers in downloads |
|
333 * INTERNAL |
|
334 */ |
|
335 enum TCatalogsHttpHeaderMode |
|
336 { |
|
337 ECatalogsHttpHeaderModeDefault = 0, |
|
338 ECatalogsHttpHeaderModeForceHead, |
|
339 ECatalogsHttpHeaderModeNoHead |
|
340 }; |
|
341 |
|
342 /** |
|
343 * Maximum length for content types |
|
344 */ |
|
345 const TUint KCatalogsHttpMaxContentTypeLength = KMaxContentTypeLength; |
|
346 |
|
347 |
|
348 /** |
|
349 * The operation has been queued |
|
350 */ |
|
351 const TInt KCatalogsHttpOperationQueued = 1; |
|
352 |
|
353 /** |
|
354 * Type for HTTP operation arrays |
|
355 */ |
|
356 typedef RPointerArray<MCatalogsHttpOperation> |
|
357 RCatalogsHttpOperationArray; |
|
358 |
|
359 |
|
360 const TUint KCatalogsErrorHeaderPresent( 1234 ); |
|
361 |
|
362 _LIT8( KCatalogsHeaderErrorNumber, "catalogs-client-error-number" ); |
|
363 _LIT8( KCatalogsHeaderErrorMessage, "catalogs-client-error-message" ); |
|
364 |
|
365 // HTTP methods |
|
366 _LIT8( KCatalogsHttpPost, "POST" ); |
|
367 _LIT8( KCatalogsHttpGet, "GET" ); |
|
368 _LIT8( KCatalogsHttpHead, "HEAD" ); |
|
369 |
|
370 _LIT8( KCatalogsHttpHeaderHost, "Host" ); |
|
371 |
|
372 _LIT8( KCatalogsHttpHeaderContentDisposition, "Content-Disposition" ); |
|
373 |
|
374 /** |
|
375 * Options that can be set with MCatalogsHttpConfig::SetOptions() |
|
376 */ |
|
377 enum TCatalogsHttpOptions |
|
378 { |
|
379 ECatalogsHttpDisableHeadRequest = 1 |
|
380 }; |
|
381 |
|
382 #endif // T_CATALOGSHTTPTYPES_H |