|
1 /* |
|
2 * Copyright (c) 2003 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 the License "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: Creating and deleting of url response |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef URLRESPONSE_H |
|
20 #define URLRESPONSE_H |
|
21 |
|
22 #ifdef __cplusplus |
|
23 extern "C" { |
|
24 #endif |
|
25 // INCLUDES |
|
26 #include "nwx_defs.h" |
|
27 #include "nwx_buffer.h" |
|
28 #include "BrsrStatusCodes.h" |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // DATA TYPES |
|
35 typedef enum { |
|
36 NW_CACHE_NORMAL, // Normal Http load, use cache if not stale |
|
37 NW_CACHE_HISTPREV, // History Prev load, use cache even if stale, |
|
38 // unless must-revalidate |
|
39 NW_CACHE_NOCACHE, // Do not use cache, even if fresh |
|
40 NW_CACHE_ONLYCACHE // Only load from cache, for loading saved deck |
|
41 } NW_Cache_Mode_t; |
|
42 |
|
43 |
|
44 typedef struct NW_Url_Resp_s |
|
45 { |
|
46 NW_Ucs2 *uri; // The original URL of the request |
|
47 // NULL terminated |
|
48 NW_Buffer_t *body; // The body of the request |
|
49 void *headers; // The response headers |
|
50 NW_Uint8 *contentTypeString; // The string representation of content type |
|
51 NW_Ucs2 *contentTypeString16; // The string representation of content type |
|
52 NW_Uint8 *contentLocationString; // The string representation of Content Base header |
|
53 NW_Bool noStore; // HTTP cache-control directive. |
|
54 NW_Uint8 *boundary; // The string representation of boundary (multipart) |
|
55 NW_Ucs2 *lastModified; // The string representation of last-modified header. Used by ECMAScript |
|
56 NW_Uint16 charset; // WAP encoding of response's character set |
|
57 NW_Uint8 *charsetString; // The charset string |
|
58 NW_Uint8 byteOrder; // Byte order: big-endian or little-endian for 2-byte charset or single byte |
|
59 NW_Uint32 httpStatus; // Response status as received from server |
|
60 NW_Uint8 method; // Method used for the final request |
|
61 NW_Uint16 transId; // The transaction id of the response |
|
62 void* certInfo; // The certificate information |
|
63 NW_Uint32 contentLength; // The content length of the response. Used only for HEAD requests |
|
64 } NW_Url_Resp_t; |
|
65 |
|
66 |
|
67 // A URLPartialResponseCallback is passed into this component to receive partial response |
|
68 typedef TBrowserStatusCode (NW_Url_RespCallback_t) |
|
69 (TBrowserStatusCode status, // The load status |
|
70 NW_Uint16 transId, // The transaction id of the response |
|
71 NW_Int32 chunkIndex, // chunk index |
|
72 void *loadContext, // A context to pass back with the response |
|
73 NW_Url_Resp_t *resp); // The response structure |
|
74 |
|
75 // FUNCTION PROTOTYPES |
|
76 |
|
77 // FORWARD DECLARATIONS |
|
78 |
|
79 /** |
|
80 * Create a url response structure |
|
81 * aUri The response URL, NULL terminated. |
|
82 * aBody The body of the request. |
|
83 * aBodyLength The length of the body of the request. |
|
84 * aHeaders The response headers. |
|
85 * aContentTypeString The string representation of the content type. |
|
86 * aCharset The WAP encoding of the response's character set. |
|
87 * aCharsetString The response's character set. |
|
88 * aHttpStatus The response status, as received from the server. |
|
89 * aMethod The method used for the final request. |
|
90 * aTransId The transaction id of the response. |
|
91 * aContentLength The content length of the response. Used only for HEAD requests. |
|
92 */ |
|
93 |
|
94 NW_Url_Resp_t* UrlLoader_UrlResponseNew(const NW_Ucs2 *aUri, |
|
95 NW_Uint8 *aBody, |
|
96 NW_Uint32 aBodyLength, |
|
97 void *aHeaders, |
|
98 NW_Uint8 *aContentTypeString, |
|
99 NW_Uint8 *aContentLocationString, |
|
100 NW_Bool noStore, |
|
101 NW_Uint8 *aBoundaryString, |
|
102 NW_Ucs2 *aLastModified, |
|
103 NW_Uint16 aCharset, |
|
104 NW_Uint8 *aCharsetString, |
|
105 NW_Uint32 aHttpStatus, |
|
106 NW_Uint8 aMethod, |
|
107 NW_Uint16 aTransId, |
|
108 NW_Uint32 aContentLength); |
|
109 /*//R |
|
110 NW_Url_Resp_t* UrlLoader_UrlResponseNew(const NW_Ucs2 *aUri, |
|
111 const NW_Uint8 *aBody, |
|
112 NW_Uint32 aBodyLength, |
|
113 void *aHeaders, |
|
114 const NW_Uint8 *aContentTypeString, |
|
115 const NW_Uint8 *aContentLocationString, |
|
116 NW_Bool noStore, |
|
117 const NW_Uint8 *aBoundaryString, |
|
118 const NW_Ucs2 *aLastModified, |
|
119 const NW_Uint16 aCharset, |
|
120 NW_Uint8 *aCharsetString, |
|
121 NW_Uint32 aHttpStatus, |
|
122 NW_Uint8 aMethod, |
|
123 NW_Uint16 aTransId, |
|
124 NW_Uint32 aContentLength); |
|
125 */ |
|
126 |
|
127 /** |
|
128 * Free a url response structure |
|
129 */ |
|
130 void UrlLoader_UrlResponseDelete(NW_Url_Resp_t* aResp); |
|
131 |
|
132 |
|
133 #ifdef __cplusplus |
|
134 } /* extern "C" */ |
|
135 #endif |
|
136 |
|
137 #endif // URLRESPONSE_H |
|
138 |
|
139 // End of File |