HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
npfunctions.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is mozilla.org code.
16  *
17  * The Initial Developer of the Original Code is
18  * Netscape Communications Corporation.
19  * Portions created by the Initial Developer are Copyright (C) 1998
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 #ifndef npfunctions_h_
39 #define npfunctions_h_
40 
41 #ifdef __OS2__
42 #pragma pack(1)
43 #define NP_LOADDS _System
44 #else
45 #define NP_LOADDS
46 #endif
47 
48 #include "npapi.h"
49 #include "npruntime.h"
50 
51 typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
52 typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
53 typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
54 typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
55 typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
56 typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
57 typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
58 typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
59 typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
60 typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
61 typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
62 /* Any NPObjects returned to the browser via NPP_GetValue should be retained
63  by the plugin on the way out. The browser is responsible for releasing. */
64 typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
65 typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
66 typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
67 typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
68 typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
69 typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
70 typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
71 typedef void (* NP_LOADDS NPP_DidCompositePtr)(NPP instance);
72 
73 typedef NPError (* NP_LOADDS NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
74 typedef NPError (* NP_LOADDS NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
75 typedef NPError (* NP_LOADDS NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
76 typedef NPError (* NP_LOADDS NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
77 typedef NPError (* NP_LOADDS NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
78 typedef NPError (* NP_LOADDS NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
79 typedef NPError (* NP_LOADDS NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
80 typedef NPError (* NP_LOADDS NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
81 typedef int32_t (* NP_LOADDS NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
82 typedef NPError (* NP_LOADDS NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
83 typedef void (* NP_LOADDS NPN_StatusProcPtr)(NPP instance, const char* message);
84 /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
85  depend on it sticking around and don't free it. */
86 typedef const char* (* NP_LOADDS NPN_UserAgentProcPtr)(NPP instance);
87 typedef void* (* NP_LOADDS NPN_MemAllocProcPtr)(uint32_t size);
88 typedef void (* NP_LOADDS NPN_MemFreeProcPtr)(void* ptr);
89 typedef uint32_t (* NP_LOADDS NPN_MemFlushProcPtr)(uint32_t size);
90 typedef void (* NP_LOADDS NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
91 typedef void* (* NP_LOADDS NPN_GetJavaEnvProcPtr)(void);
92 typedef void* (* NP_LOADDS NPN_GetJavaPeerProcPtr)(NPP instance);
93 typedef void (* NP_LOADDS NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
94 typedef void (* NP_LOADDS NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
95 typedef void (* NP_LOADDS NPN_ForceRedrawProcPtr)(NPP instance);
96 typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
97 typedef void (* NP_LOADDS NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
98 typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierProcPtr)(int32_t intid);
99 typedef bool (* NP_LOADDS NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
100 typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
101 typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
102 typedef NPObject* (* NP_LOADDS NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
103 typedef NPObject* (* NP_LOADDS NPN_RetainObjectProcPtr)(NPObject *obj);
104 typedef void (* NP_LOADDS NPN_ReleaseObjectProcPtr)(NPObject *obj);
105 typedef bool (* NP_LOADDS NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
106 typedef bool (* NP_LOADDS NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
107 typedef bool (* NP_LOADDS NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
108 typedef bool (* NP_LOADDS NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
109 typedef bool (* NP_LOADDS NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
110 typedef bool (* NP_LOADDS NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
111 typedef bool (* NP_LOADDS NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
112 typedef bool (* NP_LOADDS NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
113 typedef void (* NP_LOADDS NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
114 typedef void (* NP_LOADDS NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
115 typedef void (* NP_LOADDS NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
116 typedef void (* NP_LOADDS NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
117 typedef bool (* NP_LOADDS NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
118 typedef void (* NP_LOADDS NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
119 typedef bool (* NP_LOADDS NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
120 typedef NPError (* NP_LOADDS NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
121 typedef NPError (* NP_LOADDS NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
122 typedef NPError (* NP_LOADDS NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen);
123 typedef uint32_t (* NP_LOADDS NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
124 typedef void (* NP_LOADDS NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
125 typedef NPError (* NP_LOADDS NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
126 typedef NPBool (* NP_LOADDS NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
127 typedef NPBool (* NP_LOADDS NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
128 typedef NPBool (* NP_LOADDS NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
129 typedef void (* NP_LOADDS NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
130 typedef NPError (* NP_LOADDS NPN_InitAsyncSurfacePtr)(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
131 typedef NPError (* NP_LOADDS NPN_FinalizeAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface);
132 typedef void (* NP_LOADDS NPN_SetCurrentAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface, NPRect *changed);
133 
134 typedef struct _NPPluginFuncs {
135  uint16_t size;
136  uint16_t version;
137  NPP_NewProcPtr newp;
138  NPP_DestroyProcPtr destroy;
139  NPP_SetWindowProcPtr setwindow;
140  NPP_NewStreamProcPtr newstream;
141  NPP_DestroyStreamProcPtr destroystream;
142  NPP_StreamAsFileProcPtr asfile;
143  NPP_WriteReadyProcPtr writeready;
144  NPP_WriteProcPtr write;
145  NPP_PrintProcPtr print;
146  NPP_HandleEventProcPtr event;
147  NPP_URLNotifyProcPtr urlnotify;
148  void* javaClass;
149  NPP_GetValueProcPtr getvalue;
150  NPP_SetValueProcPtr setvalue;
151  NPP_GotFocusPtr gotfocus;
152  NPP_LostFocusPtr lostfocus;
153  NPP_URLRedirectNotifyPtr urlredirectnotify;
154  NPP_ClearSiteDataPtr clearsitedata;
155  NPP_GetSitesWithDataPtr getsiteswithdata;
156  NPP_DidCompositePtr didComposite;
157 } NPPluginFuncs;
158 
159 typedef struct _NPNetscapeFuncs {
160  uint16_t size;
161  uint16_t version;
162  NPN_GetURLProcPtr geturl;
163  NPN_PostURLProcPtr posturl;
164  NPN_RequestReadProcPtr requestread;
165  NPN_NewStreamProcPtr newstream;
166  NPN_WriteProcPtr write;
167  NPN_DestroyStreamProcPtr destroystream;
168  NPN_StatusProcPtr status;
169  NPN_UserAgentProcPtr uagent;
170  NPN_MemAllocProcPtr memalloc;
171  NPN_MemFreeProcPtr memfree;
172  NPN_MemFlushProcPtr memflush;
173  NPN_ReloadPluginsProcPtr reloadplugins;
174  NPN_GetJavaEnvProcPtr getJavaEnv;
175  NPN_GetJavaPeerProcPtr getJavaPeer;
176  NPN_GetURLNotifyProcPtr geturlnotify;
177  NPN_PostURLNotifyProcPtr posturlnotify;
178  NPN_GetValueProcPtr getvalue;
179  NPN_SetValueProcPtr setvalue;
180  NPN_InvalidateRectProcPtr invalidaterect;
181  NPN_InvalidateRegionProcPtr invalidateregion;
182  NPN_ForceRedrawProcPtr forceredraw;
183  NPN_GetStringIdentifierProcPtr getstringidentifier;
184  NPN_GetStringIdentifiersProcPtr getstringidentifiers;
185  NPN_GetIntIdentifierProcPtr getintidentifier;
186  NPN_IdentifierIsStringProcPtr identifierisstring;
187  NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
188  NPN_IntFromIdentifierProcPtr intfromidentifier;
189  NPN_CreateObjectProcPtr createobject;
190  NPN_RetainObjectProcPtr retainobject;
191  NPN_ReleaseObjectProcPtr releaseobject;
192  NPN_InvokeProcPtr invoke;
193  NPN_InvokeDefaultProcPtr invokeDefault;
194  NPN_EvaluateProcPtr evaluate;
195  NPN_GetPropertyProcPtr getproperty;
196  NPN_SetPropertyProcPtr setproperty;
197  NPN_RemovePropertyProcPtr removeproperty;
198  NPN_HasPropertyProcPtr hasproperty;
199  NPN_HasMethodProcPtr hasmethod;
200  NPN_ReleaseVariantValueProcPtr releasevariantvalue;
201  NPN_SetExceptionProcPtr setexception;
202  NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
203  NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
204  NPN_EnumerateProcPtr enumerate;
205  NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
206  NPN_ConstructProcPtr construct;
207  NPN_GetValueForURLPtr getvalueforurl;
208  NPN_SetValueForURLPtr setvalueforurl;
209  NPN_GetAuthenticationInfoPtr getauthenticationinfo;
210  NPN_ScheduleTimerPtr scheduletimer;
211  NPN_UnscheduleTimerPtr unscheduletimer;
212  NPN_PopUpContextMenuPtr popupcontextmenu;
213  NPN_ConvertPointPtr convertpoint;
214  NPN_HandleEventPtr handleevent;
215  NPN_UnfocusInstancePtr unfocusinstance;
216  NPN_URLRedirectResponsePtr urlredirectresponse;
217  NPN_InitAsyncSurfacePtr initasyncsurface;
218  NPN_FinalizeAsyncSurfacePtr finalizeasyncsurface;
219  NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface;
221 
222 #ifdef XP_MACOSX
223 /*
224  * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
225  * These can be called to retreive MIME information from the plugin dynamically
226  *
227  * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
228  * to get mime info from the plugin only on OSX and may not be supported
229  * in furture version -- use NP_GetMIMEDescription instead
230  */
231 enum
232 {
233  kBPSupportedMIMETypesStructVers_1 = 1
234 };
235 typedef struct _BPSupportedMIMETypes
236 {
237  SInt32 structVersion; /* struct version */
238  Handle typeStrings; /* STR# formated handle, allocated by plug-in */
239  Handle infoStrings; /* STR# formated handle, allocated by plug-in */
240 } BPSupportedMIMETypes;
241 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
242 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
243 typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
244 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
245 #endif
246 
247 #if defined(_WIN32)
248 #define OSCALL WINAPI
249 #else
250 #if defined(__OS2__)
251 #define OSCALL _System
252 #else
253 #define OSCALL
254 #endif
255 #endif
256 
257 #if defined(XP_UNIX)
258 /* GCC 3.3 and later support the visibility attribute. */
259 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
260 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
261 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
262 #define NP_VISIBILITY_DEFAULT __global
263 #else
264 #define NP_VISIBILITY_DEFAULT
265 #endif
266 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
267 #endif
268 
269 #if defined(_WIN32) || defined (__OS2__)
270 #ifdef __cplusplus
271 extern "C" {
272 #endif
273 /* plugin meta member functions */
274 #if defined(__OS2__)
275 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
276  char *pMimeTypes;
277  char *pFileExtents;
278  char *pFileOpenTemplate;
279  char *pProductName;
280  char *pProductDescription;
281  unsigned long dwProductVersionMS;
282  unsigned long dwProductVersionLS;
283 } NPPluginData;
284 typedef NPError (OSCALL *NP_GetPluginDataFunc)(NPPluginData*);
285 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
286 #endif
287 typedef NPError (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
288 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
289 typedef NPError (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
290 NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
291 typedef NPError (OSCALL *NP_ShutdownFunc)(void);
292 NPError OSCALL NP_Shutdown(void);
293 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
294 const char* NP_GetMIMEDescription(void);
295 #ifdef __cplusplus
296 }
297 #endif
298 #endif
299 
300 #if defined(__OS2__)
301 #pragma pack()
302 #endif
303 
304 #ifdef XP_UNIX
305 #ifdef __cplusplus
306 extern "C" {
307 #endif
308 typedef char* (*NP_GetPluginVersionFunc)(void);
309 NP_EXPORT(char*) NP_GetPluginVersion(void);
310 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
311 NP_EXPORT(const char*) NP_GetMIMEDescription(void);
312 #ifdef XP_MACOSX
313 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
314 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
315 typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
316 NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
317 #else
318 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
319 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
320 #endif
321 typedef NPError (*NP_ShutdownFunc)(void);
322 NP_EXPORT(NPError) NP_Shutdown(void);
323 typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
324 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
325 #ifdef __cplusplus
326 }
327 #endif
328 #endif
329 
330 #endif /* npfunctions_h_ */
Definition: npapi.h:178
Definition: npapi.h:516
Definition: npapi.h:186
Definition: npapi.h:562
Definition: npfunctions.h:159
Definition: npruntime.h:100
Definition: npruntime.h:295
Definition: npfunctions.h:134
Definition: npapi.h:227
Definition: npapi.h:249
Definition: npapi.h:213
Definition: npapi.h:206
Definition: npruntime.h:323
Definition: npruntime.h:85
Definition: npapi.h:219