Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / modules / plugin / base / public / npfunctions.h
blobfea4aff2e375a3efaf22cde7df99c27a56cf63fe
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
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/
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.
15 * The Original Code is mozilla.org code.
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.
22 * Contributor(s):
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.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef npfunctions_h_
39 #define npfunctions_h_
41 #ifdef __OS2__
42 #pragma pack(1)
43 #endif
45 #include "npapi.h"
46 #include "npruntime.h"
48 typedef void (*NPP_InitializeProcPtr)();
49 typedef void (*NPP_ShutdownProcPtr)();
50 typedef NPError (*NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
51 typedef NPError (*NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
52 typedef NPError (*NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
53 typedef NPError (*NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
54 typedef NPError (*NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
55 typedef int32_t (*NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
56 typedef int32_t (*NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
57 typedef void (*NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
58 typedef void (*NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
59 typedef int16_t (*NPP_HandleEventProcPtr)(NPP instance, void* event);
60 typedef void (*NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
61 /* Any NPObjects returned to the browser via NPP_GetValue should be retained
62 by the plugin on the way out. The browser is responsible for releasing. */
63 typedef NPError (*NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
64 typedef NPError (*NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
66 typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
67 typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
68 typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
69 typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
70 typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
71 typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
72 typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
73 typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
74 typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
75 typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
76 typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
77 /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
78 depend on it sticking around and don't free it. */
79 typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
80 typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
81 typedef void (*NPN_MemFreeProcPtr)(void* ptr);
82 typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
83 typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
84 typedef void* (*NPN_GetJavaEnvProcPtr)();
85 typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
86 typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
87 typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
88 typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
89 typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
90 typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
91 typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
92 typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
93 typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
94 typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
95 typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
96 typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
97 typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
98 typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
99 typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
100 typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
101 typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
102 typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
103 typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
104 typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
105 typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
106 typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
107 typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
108 typedef bool (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
109 typedef bool (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
110 typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
111 typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
112 typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
114 typedef struct _NPPluginFuncs {
115 uint16_t size;
116 uint16_t version;
117 NPP_NewProcPtr newp;
118 NPP_DestroyProcPtr destroy;
119 NPP_SetWindowProcPtr setwindow;
120 NPP_NewStreamProcPtr newstream;
121 NPP_DestroyStreamProcPtr destroystream;
122 NPP_StreamAsFileProcPtr asfile;
123 NPP_WriteReadyProcPtr writeready;
124 NPP_WriteProcPtr write;
125 NPP_PrintProcPtr print;
126 NPP_HandleEventProcPtr event;
127 NPP_URLNotifyProcPtr urlnotify;
128 void* javaClass;
129 NPP_GetValueProcPtr getvalue;
130 NPP_SetValueProcPtr setvalue;
131 } NPPluginFuncs;
133 typedef struct _NPNetscapeFuncs {
134 uint16_t size;
135 uint16_t version;
136 NPN_GetURLProcPtr geturl;
137 NPN_PostURLProcPtr posturl;
138 NPN_RequestReadProcPtr requestread;
139 NPN_NewStreamProcPtr newstream;
140 NPN_WriteProcPtr write;
141 NPN_DestroyStreamProcPtr destroystream;
142 NPN_StatusProcPtr status;
143 NPN_UserAgentProcPtr uagent;
144 NPN_MemAllocProcPtr memalloc;
145 NPN_MemFreeProcPtr memfree;
146 NPN_MemFlushProcPtr memflush;
147 NPN_ReloadPluginsProcPtr reloadplugins;
148 NPN_GetJavaEnvProcPtr getJavaEnv;
149 NPN_GetJavaPeerProcPtr getJavaPeer;
150 NPN_GetURLNotifyProcPtr geturlnotify;
151 NPN_PostURLNotifyProcPtr posturlnotify;
152 NPN_GetValueProcPtr getvalue;
153 NPN_SetValueProcPtr setvalue;
154 NPN_InvalidateRectProcPtr invalidaterect;
155 NPN_InvalidateRegionProcPtr invalidateregion;
156 NPN_ForceRedrawProcPtr forceredraw;
157 NPN_GetStringIdentifierProcPtr getstringidentifier;
158 NPN_GetStringIdentifiersProcPtr getstringidentifiers;
159 NPN_GetIntIdentifierProcPtr getintidentifier;
160 NPN_IdentifierIsStringProcPtr identifierisstring;
161 NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
162 NPN_IntFromIdentifierProcPtr intfromidentifier;
163 NPN_CreateObjectProcPtr createobject;
164 NPN_RetainObjectProcPtr retainobject;
165 NPN_ReleaseObjectProcPtr releaseobject;
166 NPN_InvokeProcPtr invoke;
167 NPN_InvokeDefaultProcPtr invokeDefault;
168 NPN_EvaluateProcPtr evaluate;
169 NPN_GetPropertyProcPtr getproperty;
170 NPN_SetPropertyProcPtr setproperty;
171 NPN_RemovePropertyProcPtr removeproperty;
172 NPN_HasPropertyProcPtr hasproperty;
173 NPN_HasMethodProcPtr hasmethod;
174 NPN_ReleaseVariantValueProcPtr releasevariantvalue;
175 NPN_SetExceptionProcPtr setexception;
176 NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
177 NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
178 NPN_EnumerateProcPtr enumerate;
179 NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
180 NPN_ConstructProcPtr construct;
181 } NPNetscapeFuncs;
183 #ifdef XP_MACOSX
185 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
186 * These can be called to retreive MIME information from the plugin dynamically
188 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
189 * to get mime info from the plugin only on OSX and may not be supported
190 * in furture version -- use NP_GetMIMEDescription instead
192 enum
194 kBPSupportedMIMETypesStructVers_1 = 1
196 typedef struct _BPSupportedMIMETypes
198 SInt32 structVersion; /* struct version */
199 Handle typeStrings; /* STR# formated handle, allocated by plug-in */
200 Handle infoStrings; /* STR# formated handle, allocated by plug-in */
201 } BPSupportedMIMETypes;
202 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
203 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
204 typedef const char* (*NP_GetMIMEDescriptionProcPtr)();
205 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
206 #endif
208 #if defined(_WINDOWS)
209 #define OSCALL WINAPI
210 #else
211 #if defined(__OS2__)
212 #define OSCALL _System
213 #else
214 #define OSCALL
215 #endif
216 #endif
218 #if defined(XP_UNIX)
219 /* GCC 3.3 and later support the visibility attribute. */
220 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
221 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
222 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
223 #define NP_VISIBILITY_DEFAULT __global
224 #else
225 #define NP_VISIBILITY_DEFAULT
226 #endif
227 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
228 #endif
230 #if defined(_WINDOWS) || defined (__OS2__)
231 #ifdef __cplusplus
232 extern "C" {
233 #endif
234 /* plugin meta member functions */
235 #if defined(__OS2__)
236 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
237 char *pMimeTypes;
238 char *pFileExtents;
239 char *pFileOpenTemplate;
240 char *pProductName;
241 char *pProductDescription;
242 unsigned long dwProductVersionMS;
243 unsigned long dwProductVersionLS;
244 } NPPluginData;
245 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
246 #endif
247 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
248 NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
249 NPError OSCALL NP_Shutdown();
250 char* NP_GetMIMEDescription();
251 #ifdef __cplusplus
253 #endif
254 #endif
256 #if defined(__OS2__)
257 #pragma pack()
258 #endif
260 #ifdef XP_UNIX
261 #ifdef __cplusplus
262 extern "C" {
263 #endif
264 NP_EXPORT(char*) NP_GetPluginVersion();
265 NP_EXPORT(char*) NP_GetMIMEDescription();
266 #ifdef XP_MACOSX
267 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
268 NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
269 #else
270 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
271 #endif
272 NP_EXPORT(NPError) NP_Shutdown();
273 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
274 #ifdef __cplusplus
276 #endif
277 #endif
279 #endif /* npfunctions_h_ */