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