|
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: C interface to url loader |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef URLLOADERINT_H |
|
19 #define URLLOADERINT_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "nwx_ctx.h" // this file includes nwx_defs.h, which includes nwx_status.h |
|
23 #include "urlloader_urlresponse.h" |
|
24 #include "BrsrStatusCodes.h" |
|
25 |
|
26 #ifdef __cplusplus |
|
27 extern "C" { |
|
28 #endif |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 #define NW_NUM_INSTANCES 3 |
|
33 |
|
34 // MACROS |
|
35 |
|
36 // DATA TYPES |
|
37 |
|
38 // The "TEnterStatus", relates to what security state the page is going to. |
|
39 // This "page loading" status, is passed in HandleBrowserLoadEventL() using the |
|
40 // TBrCtlLoadEvent enum. (see brctldefs.h) |
|
41 // These constants must stay in sync with viewshellobserver.h |
|
42 //R |
|
43 |
|
44 enum TEnterStatus |
|
45 { |
|
46 EEnteringSecurePage, |
|
47 EExitingSecurePage, |
|
48 ESomeItemsNotSecure, |
|
49 ESubmittingToNonSecurePage, |
|
50 ERedirectConfirmation, |
|
51 ERepostConfirmation, |
|
52 ESecureItemInNonSecurePage |
|
53 // others to come |
|
54 }; |
|
55 |
|
56 // The following schemes are only those supported by the browser |
|
57 typedef enum |
|
58 { |
|
59 ESchemeInvalid, |
|
60 ESchemeUnknown, |
|
61 ESchemeHttps, |
|
62 ESchemeMailto, |
|
63 ESchemeFile, |
|
64 ESchemeHttp, |
|
65 ESchemeWtai, |
|
66 ESchemeTel |
|
67 } TUrlLoaderScheme; |
|
68 |
|
69 // Structure for holding context data |
|
70 typedef struct |
|
71 { |
|
72 void *uniqueNum[NW_NUM_INSTANCES+1]; |
|
73 void *contexts[NW_NUM_INSTANCES+1] [NW_NUM_CONTEXTS+1]; |
|
74 } NW_ContextArray_t; |
|
75 |
|
76 // Structure for holding extra request headers information |
|
77 typedef struct |
|
78 { |
|
79 NW_Uint8* accept; |
|
80 NW_Uint8* contentType; |
|
81 NW_Uint8* referer; |
|
82 NW_Uint8* boundary; |
|
83 NW_Uint32 contentLength; |
|
84 NW_Uint8* expectedContentType; |
|
85 } HttpRequestHeaders; |
|
86 |
|
87 typedef enum |
|
88 { |
|
89 ECookieFilter, |
|
90 ECacheFilter |
|
91 } TFilters; |
|
92 |
|
93 // FUNCTION PROTOTYPES |
|
94 |
|
95 // FORWARD DECLARATIONS |
|
96 |
|
97 // CLASS DECLARATION |
|
98 |
|
99 /** |
|
100 * Cancel all the pending requests due to a disconnect request. |
|
101 */ |
|
102 void UrlLoader_Disconnect(); |
|
103 |
|
104 /** |
|
105 * Cancel a specific request, identified by its id. |
|
106 */ |
|
107 void UrlLoader_Cancel(NW_Uint16 aTid); |
|
108 |
|
109 /** |
|
110 * Cancel all requests. |
|
111 */ |
|
112 void UrlLoader_CancelAll(); |
|
113 |
|
114 /** |
|
115 * Check if a specific url is in cache. |
|
116 */ |
|
117 NW_Bool UrlLoader_IsUrlInCache(NW_Ucs2* aUrl); |
|
118 |
|
119 /** |
|
120 * Get the number of entries in cache. |
|
121 */ |
|
122 NW_Uint32 UrlLoader_GetNumCacheEntries(); |
|
123 |
|
124 /** |
|
125 * Remove all the cached items. |
|
126 */ |
|
127 NW_Uint32 UrlLoader_ClearCache(); |
|
128 |
|
129 /** |
|
130 * Remove a specific item from cache, identified by its url. |
|
131 */ |
|
132 TBrowserStatusCode UrlLoader_ClearItemInCache(const NW_Ucs2* aUrl); |
|
133 |
|
134 /** |
|
135 * Set a header on a specic item, identified by its url. |
|
136 */ |
|
137 TBrowserStatusCode UrlLoader_SetHeaderInCache(const NW_Ucs2* aUrl, |
|
138 unsigned char* aName, |
|
139 NW_Ucs2* aValue); |
|
140 |
|
141 /** |
|
142 * Remove all the cookies. |
|
143 */ |
|
144 NW_Uint32 UrlLoader_ClearCookies(); |
|
145 |
|
146 /** |
|
147 * Free the loaders and close the session to the http stack. |
|
148 */ |
|
149 void UrlLoader_Shutdown(); |
|
150 |
|
151 /** |
|
152 * Make a load request to the loaders. |
|
153 * aUrl The request URL |
|
154 * aHeader The request headers or NULL if no request specific headers. |
|
155 * aData The body of the request. |
|
156 * aDataLen The body length of the request. |
|
157 * aMethod The method to use for the request could be |
|
158 * NW_URL_METHOD_GET or NW_URL_METHOD_POST. |
|
159 * aTransId The request's transaction id. |
|
160 * aLoadContext The load context that should be returned with the response. |
|
161 * aPartialLoadCallback The callback to call when a chunk is ready. |
|
162 * aCacheMode The cache mode, it is relevant only in case of http or https. |
|
163 * aDefaultHeadersMask A flag indicating what default headers should be used. |
|
164 * loadType The load type |
|
165 * aIsTopLevel Boolean ETrue if page is top level (images, css, etc are not top) |
|
166 * aIsScript Boolean ETrue if Request is being made by script. |
|
167 */ |
|
168 TBrowserStatusCode UrlLoader_Request(const NW_Ucs2* aUrl, |
|
169 void* aHeader, |
|
170 NW_Uint8* aData, |
|
171 NW_Uint32 aDataLen, |
|
172 NW_Uint8 aMethod, |
|
173 NW_Uint16* aTransId, |
|
174 void* aLoadContext, |
|
175 NW_Url_RespCallback_t* aLoadCallback, |
|
176 NW_Cache_Mode_t aCacheMode, |
|
177 NW_Uint32 aDefaultHeadersMask, |
|
178 NW_Uint8 loadType, |
|
179 NW_Bool aIsTopLevel, |
|
180 NW_Bool aIsScript, |
|
181 NW_Uint8 aReason, |
|
182 void* aLoadData); |
|
183 |
|
184 /** |
|
185 * Create a HttpHeaders structure with some or all of the following arguments. |
|
186 * Each field can contain a value, or can be NULL. |
|
187 * aAccept The accept header |
|
188 * aContentType The content type of the request body |
|
189 * aReferer The referer |
|
190 * aBoundary The boundry if it is a multipart |
|
191 * aContentLength The length of the request body |
|
192 */ |
|
193 void* UrlLoader_HeadersNew(const NW_Uint8* aAccept, |
|
194 const NW_Uint8* aContentType, |
|
195 const NW_Ucs2* aReferer, |
|
196 const NW_Uint8* aBoundary, |
|
197 NW_Uint32 aContentLength, |
|
198 const NW_Uint8* aExpectedContentType); |
|
199 |
|
200 /** |
|
201 * Free the headers structure. |
|
202 */ |
|
203 void UrlLoader_HeadersFree(void* aHeaders); |
|
204 |
|
205 /** |
|
206 * Copy the headers. |
|
207 */ |
|
208 void* UrlLoader_HeadersCopy(const void* aHeaders); |
|
209 |
|
210 /** |
|
211 * Load / Unload filter specified by UID. |
|
212 */ |
|
213 void UrlLoader_ChangeFilterLoadStatusL(TFilters aFilter, NW_Bool aLoad); |
|
214 |
|
215 /** |
|
216 * Update security status on the UrlLoader |
|
217 */ |
|
218 void UrlLoader_UpdateSecurityStatus(TBrowserStatusCode aLoadStatus, |
|
219 NW_Url_Resp_t* aResponse); |
|
220 |
|
221 /** |
|
222 * Determine the scheme of the URL. |
|
223 */ |
|
224 TUrlLoaderScheme UrlLoader_FindUrlScheme(const NW_Ucs2* aUrl); |
|
225 |
|
226 /** |
|
227 * Determine if the URL is handled by the browser. |
|
228 */ |
|
229 NW_Bool UrlLoader_IsBrowserScheme(const NW_Ucs2* aUrl); |
|
230 |
|
231 /** |
|
232 * Set Internet Access Point id to use for connection |
|
233 */ |
|
234 void UrlLoader_SetIAPid(NW_Uint32 aIapId); |
|
235 |
|
236 #ifdef __cplusplus |
|
237 } /* extern "C" */ |
|
238 #endif |
|
239 |
|
240 #endif // URLLOADERINT_H |
|
241 |
|
242 // End of File |