94
|
1 |
/*
|
|
2 |
* Copyright (c) 1999 - 2001 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/*
|
|
19 |
$Workfile: nw_wml_core.h $
|
|
20 |
|
|
21 |
Purpose:
|
|
22 |
|
|
23 |
Class: WmlBrowser
|
|
24 |
|
|
25 |
Main browser engine class declaration. The exteral environment messages to this
|
|
26 |
engine through the constructor, Start, Event, and *Resp methods. The core browser
|
|
27 |
object directs the URL Loader to get WML deck and card bytecode. It then processes
|
|
28 |
the WML tags and interfaces with an external UI system. The core browser also
|
|
29 |
interfaces with the WML script engine.
|
|
30 |
|
|
31 |
*/
|
|
32 |
|
|
33 |
#ifndef NW_WML_CORE_H
|
|
34 |
#define NW_WML_CORE_H
|
|
35 |
|
|
36 |
#ifdef __cplusplus
|
|
37 |
extern "C" {
|
|
38 |
#endif
|
|
39 |
|
|
40 |
#include "nwx_defs.h"
|
|
41 |
|
|
42 |
#include "nw_wml_defs.h"
|
|
43 |
#include "nw_wml_var.h"
|
|
44 |
#include "nw_wml_decoder.h"
|
|
45 |
#include "nw_wml_elements.h"
|
|
46 |
#include "nw_wml_list.h"
|
|
47 |
#include "nw_wml_api.h"
|
|
48 |
#include "nw_nvpair.h"
|
|
49 |
|
|
50 |
#include "nwx_mem.h"
|
|
51 |
#include "nwx_http_header.h"
|
|
52 |
#include "nwx_memseg.h"
|
|
53 |
#include "nwx_buffer.h"
|
|
54 |
#include "urlloader_urlresponse.h"
|
|
55 |
#include "BrsrStatusCodes.h"
|
|
56 |
|
|
57 |
#define MAX_NUMBER_INTRA_OEF 15 /* the value is so chosen that the call stack does not max out - Vishy*/
|
|
58 |
|
|
59 |
/*---------------------------------------------------------------------
|
|
60 |
* NW_Wml_History_t -- history stack element -- holds information needed
|
|
61 |
* to reconstruct the call to access a card we've been to recently.
|
|
62 |
--------------------------------------------------------------------*/
|
|
63 |
typedef struct {
|
|
64 |
NW_Ucs2 *req_url; /* the one sent in the request */
|
|
65 |
} NW_Wml_History_t;
|
|
66 |
|
|
67 |
|
|
68 |
typedef struct
|
|
69 |
{
|
|
70 |
NW_Ucs2 *load_url;
|
|
71 |
NW_Ucs2 *load_url_params;
|
|
72 |
NW_Http_Header_t *load_header;
|
|
73 |
NW_Bool load_prev;
|
|
74 |
NW_Uint32 timer_time;
|
|
75 |
NW_Bool timerProcessing;/* NW_TRUE: timer processing complete
|
|
76 |
NW_FALSE: timer processing not complete */
|
|
77 |
} NW_Wml_Script_State_t;
|
|
78 |
|
|
79 |
|
|
80 |
typedef struct _NW_Wml_t NW_Wml_t;
|
|
81 |
struct _NW_Wml_t {
|
|
82 |
void *browser_app; /* the user agent */
|
|
83 |
NW_Wml_VarList_t *var_list;
|
|
84 |
NW_Wml_VarList_t *param_list;
|
|
85 |
NW_Wml_Task_e curr_task;
|
|
86 |
NW_Ucs2 *history_resp_url;
|
|
87 |
NW_DeckDecoder_t *decoder;
|
|
88 |
NW_Wml_Element_t **card_els;
|
|
89 |
NW_Int16 prev_task_id;
|
|
90 |
NW_Int16 do_type_prev_id;
|
|
91 |
NW_Wml_Script_State_t script_state;
|
|
92 |
NW_Bool hasFocus;
|
|
93 |
NW_Int16 outstandingLoadCount;
|
|
94 |
NW_Mem_Segment_Id_t mem_segment_general;
|
|
95 |
NW_Mem_Segment_Id_t mem_segment_card; /* DON'T ACCESS THIS FIELD DIRECTLY */
|
|
96 |
const NW_WmlApi_t *wml_api; /* user agent call backs */
|
|
97 |
NW_Uint16 IntraDeck_OefCounter; /* This counter is used to keep track of the number of
|
|
98 |
intra-deck OnEnterforward has occured continuously*/
|
|
99 |
NW_Bool oefNavigation; /* NW_TRUE = nav within oef/oeb navigation, NW_FALSE otherwise */
|
|
100 |
};
|
|
101 |
|
|
102 |
/* Type for emptyOk parameter to NW_WmlInput_ValidateInput(). */
|
|
103 |
typedef enum NW_WmlInput_EmptyOk_e {
|
|
104 |
NW_WmlInput_EmptyOk_None,
|
|
105 |
NW_WmlInput_EmptyOk_True,
|
|
106 |
NW_WmlInput_EmptyOk_False
|
|
107 |
} NW_WmlInput_EmptyOk_t;
|
|
108 |
|
|
109 |
|
|
110 |
/* macros */
|
|
111 |
#define DISPLAY_API thisObj->wml_api->display
|
|
112 |
#define TIMER_API thisObj->wml_api->timer
|
|
113 |
|
|
114 |
/* interface from the user agent */
|
|
115 |
TBrowserStatusCode NW_Wml_Init(NW_Wml_t *that,
|
|
116 |
const NW_WmlApi_t *wmlapi,
|
|
117 |
void *usrAgent);
|
|
118 |
|
|
119 |
/* Use this function to init the wml 1.x interpreter
|
|
120 |
from the HED Wml content handler */
|
|
121 |
TBrowserStatusCode NW_Wml_InitFromShell(NW_Wml_t *that,
|
|
122 |
const NW_Ucs2 *url,
|
|
123 |
const NW_WmlApi_t *wmlapi,
|
|
124 |
void *usrAgent);
|
|
125 |
|
|
126 |
TBrowserStatusCode NW_Wml_GetVersion(NW_Wml_t *that, NW_Uint8 *version);
|
|
127 |
|
|
128 |
TBrowserStatusCode NW_Wml_Start(NW_Wml_t* that, NW_Ucs2 *initialUrl);
|
|
129 |
|
|
130 |
TBrowserStatusCode NW_Wml_ReStart(NW_Wml_t *that, TBrowserStatusCode status);
|
|
131 |
|
|
132 |
TBrowserStatusCode NW_Wml_Exit(NW_Wml_t *that);
|
|
133 |
|
|
134 |
TBrowserStatusCode NW_Wml_GetAttribute(NW_Wml_t *that, NW_Uint16 el_id, NW_Wml_Attr_t tag, NW_Ucs2 **ret_string);
|
|
135 |
|
|
136 |
TBrowserStatusCode NW_Wml_GetElementType(NW_Wml_t *that, NW_Uint16 el_id, NW_Wml_ElType_e *el_type, NW_Wml_Element_t **el);
|
|
137 |
|
|
138 |
TBrowserStatusCode NW_Wml_GetDefault(NW_Wml_t *that, NW_Uint16 el_id, NW_Ucs2 **ret_string);
|
|
139 |
|
|
140 |
TBrowserStatusCode NW_Wml_GUIEvent(NW_Wml_t* that, NW_Uint16 id, void *value);
|
|
141 |
|
|
142 |
TBrowserStatusCode NW_Wml_GetCurrURL(NW_Wml_t *that, NW_Ucs2 **ret_string);
|
|
143 |
|
|
144 |
TBrowserStatusCode NW_Wml_GetCurrReqURL(NW_Wml_t *that, NW_Ucs2 **ret_string);
|
|
145 |
|
|
146 |
TBrowserStatusCode NW_Wml_GetPrevId(NW_Wml_t *that, NW_Int16 *id);
|
|
147 |
|
|
148 |
NW_Bool NW_WmlInput_ValidateValue(NW_Ucs2* input_value,
|
|
149 |
NW_Ucs2* format,
|
|
150 |
NW_WmlInput_EmptyOk_t emptyok,
|
|
151 |
NW_Bool partial_validation_ok,
|
|
152 |
NW_Uint32 docPublicId);
|
|
153 |
|
|
154 |
/* Returns the document public ID */
|
|
155 |
TBrowserStatusCode NW_Wml_GetPublicId(NW_Wml_t *that, NW_Uint32 *publicId);
|
|
156 |
|
|
157 |
/* Note: The NW_Wml_GetImage function is obsolete on Rainbow 2.0 and is only provided for
|
|
158 |
compatability with WAVE. To load images use the image loader. */
|
|
159 |
|
|
160 |
/* helper function to retrieve the absolute url for the image element SRC*/
|
|
161 |
TBrowserStatusCode NW_Wml_GetImageUrl(NW_Wml_t *that, NW_Uint16 imgel_id, NW_Ucs2 **ret_string);
|
|
162 |
|
|
163 |
/* helper function to retrieve the absolute url for the image element with LOCALSRC */
|
|
164 |
TBrowserStatusCode NW_Wml_GetLocalImageUrl(NW_Wml_t *that, NW_Uint16 imgel_id, NW_Ucs2 **ret_string);
|
|
165 |
|
|
166 |
TBrowserStatusCode NW_Wml_Timeout(void *that);
|
|
167 |
|
|
168 |
/* user agents should call this function when they gain focus */
|
|
169 |
TBrowserStatusCode NW_Wml_GainFocus(NW_Wml_t *that);
|
|
170 |
|
|
171 |
/* user agents should call this function when they loose focus */
|
|
172 |
TBrowserStatusCode NW_Wml_LoseFocus(NW_Wml_t *that);
|
|
173 |
|
|
174 |
/* interface from the script interpreter */
|
|
175 |
TBrowserStatusCode NW_Wml_GetVar(NW_Wml_t* that, const NW_Ucs2 *var_name, NW_Ucs2 **ret_string);
|
|
176 |
|
|
177 |
NW_Wml_Var_t *NW_Wml_NextVar(NW_Wml_t* thisObj, NW_Wml_Var_t *current);
|
|
178 |
|
|
179 |
TBrowserStatusCode NW_Wml_SetVar(NW_Wml_t *that, const NW_Ucs2 *varName, const NW_Ucs2 *varValue);
|
|
180 |
|
|
181 |
void NW_Wml_UnsetVar(NW_Wml_t *that, NW_Ucs2 *varName);
|
|
182 |
|
|
183 |
void NW_Wml_LoadPrev(NW_Wml_t *that);
|
|
184 |
|
|
185 |
void NW_Wml_NewContext(NW_Wml_t *that);
|
|
186 |
|
|
187 |
/* does a newcontext but leaves the top history entry intact. */
|
|
188 |
void NW_Wml_NewContextFromScript(NW_Wml_t *that);
|
|
189 |
|
|
190 |
void NW_Wml_LoadUrl(NW_Wml_t *that, NW_Ucs2 *url, NW_Ucs2 *param, NW_Http_Header_t *header);
|
|
191 |
|
|
192 |
TBrowserStatusCode NW_Wml_DisplayCard(NW_Wml_t* thisObj, NW_Bool cancelRequest);
|
|
193 |
|
|
194 |
TBrowserStatusCode NW_Wml_LoadWmlResp(NW_Wml_t *thisObj, NW_Buffer_t* responseBuffer, NW_Bool contentWasPlainText, NW_Url_Resp_t* response);
|
|
195 |
|
|
196 |
void NW_Wml_ClearTaskVariables(NW_Wml_t *that);
|
|
197 |
|
|
198 |
TBrowserStatusCode NW_Wml_ApplyTaskVariables(NW_Wml_t *that);
|
|
199 |
|
|
200 |
TBrowserStatusCode NW_Wml_HasOptionIntrinsicEvents(NW_Wml_t *that, NW_Wml_Element_t* option_el, NW_Bool execute);
|
|
201 |
TBrowserStatusCode NW_Wml_HasOnpick(NW_Wml_t *that, NW_Uint16 el_id );
|
|
202 |
|
|
203 |
NW_Mem_Segment_Id_t NW_Wml_GetCardSegment(NW_Wml_t *thisObj);
|
|
204 |
TBrowserStatusCode NW_Wml_FreeCardSegment(NW_Wml_t *that);
|
|
205 |
|
|
206 |
TBrowserStatusCode NW_Wml_HandleIntraDocRequest (NW_Wml_t *thisObj, NW_Wml_Task_e task,
|
|
207 |
NW_Bool historicRequest, const NW_Ucs2 *url);
|
|
208 |
|
|
209 |
TBrowserStatusCode NW_Wml_CancelAllLoads (NW_Wml_t *thisObj);
|
|
210 |
|
|
211 |
void NW_Wml_HandleError (NW_Wml_t *thisObj, NW_Int16 errorClass, NW_Int16 error);
|
|
212 |
|
|
213 |
TBrowserStatusCode NW_Wml_ProcessSetvarElements(NW_Wml_t *thisObj);
|
|
214 |
|
|
215 |
#ifdef __cplusplus
|
|
216 |
} /* extern "C" */
|
|
217 |
#endif
|
|
218 |
|
|
219 |
#endif /* NW_WML_CORE_H */
|