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
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.
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_
43 #define NP_LOADDS _System
49 #include "npruntime.h"
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
);
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
);
134 typedef void (* NP_LOADDS NPN_DummyPtr
)(void);
136 typedef struct _NPPluginFuncs
{
140 NPP_DestroyProcPtr destroy
;
141 NPP_SetWindowProcPtr setwindow
;
142 NPP_NewStreamProcPtr newstream
;
143 NPP_DestroyStreamProcPtr destroystream
;
144 NPP_StreamAsFileProcPtr asfile
;
145 NPP_WriteReadyProcPtr writeready
;
146 NPP_WriteProcPtr write
;
147 NPP_PrintProcPtr print
;
148 NPP_HandleEventProcPtr event
;
149 NPP_URLNotifyProcPtr urlnotify
;
151 NPP_GetValueProcPtr getvalue
;
152 NPP_SetValueProcPtr setvalue
;
153 NPP_GotFocusPtr gotfocus
;
154 NPP_LostFocusPtr lostfocus
;
155 NPP_URLRedirectNotifyPtr urlredirectnotify
;
156 NPP_ClearSiteDataPtr clearsitedata
;
157 NPP_GetSitesWithDataPtr getsiteswithdata
;
158 NPP_DidCompositePtr didComposite
;
161 typedef struct _NPNetscapeFuncs
{
164 NPN_GetURLProcPtr geturl
;
165 NPN_PostURLProcPtr posturl
;
166 NPN_RequestReadProcPtr requestread
;
167 NPN_NewStreamProcPtr newstream
;
168 NPN_WriteProcPtr write
;
169 NPN_DestroyStreamProcPtr destroystream
;
170 NPN_StatusProcPtr status
;
171 NPN_UserAgentProcPtr uagent
;
172 NPN_MemAllocProcPtr memalloc
;
173 NPN_MemFreeProcPtr memfree
;
174 NPN_MemFlushProcPtr memflush
;
175 NPN_ReloadPluginsProcPtr reloadplugins
;
176 NPN_GetJavaEnvProcPtr getJavaEnv
;
177 NPN_GetJavaPeerProcPtr getJavaPeer
;
178 NPN_GetURLNotifyProcPtr geturlnotify
;
179 NPN_PostURLNotifyProcPtr posturlnotify
;
180 NPN_GetValueProcPtr getvalue
;
181 NPN_SetValueProcPtr setvalue
;
182 NPN_InvalidateRectProcPtr invalidaterect
;
183 NPN_InvalidateRegionProcPtr invalidateregion
;
184 NPN_ForceRedrawProcPtr forceredraw
;
185 NPN_GetStringIdentifierProcPtr getstringidentifier
;
186 NPN_GetStringIdentifiersProcPtr getstringidentifiers
;
187 NPN_GetIntIdentifierProcPtr getintidentifier
;
188 NPN_IdentifierIsStringProcPtr identifierisstring
;
189 NPN_UTF8FromIdentifierProcPtr utf8fromidentifier
;
190 NPN_IntFromIdentifierProcPtr intfromidentifier
;
191 NPN_CreateObjectProcPtr createobject
;
192 NPN_RetainObjectProcPtr retainobject
;
193 NPN_ReleaseObjectProcPtr releaseobject
;
194 NPN_InvokeProcPtr invoke
;
195 NPN_InvokeDefaultProcPtr invokeDefault
;
196 NPN_EvaluateProcPtr evaluate
;
197 NPN_GetPropertyProcPtr getproperty
;
198 NPN_SetPropertyProcPtr setproperty
;
199 NPN_RemovePropertyProcPtr removeproperty
;
200 NPN_HasPropertyProcPtr hasproperty
;
201 NPN_HasMethodProcPtr hasmethod
;
202 NPN_ReleaseVariantValueProcPtr releasevariantvalue
;
203 NPN_SetExceptionProcPtr setexception
;
204 NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate
;
205 NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate
;
206 NPN_EnumerateProcPtr enumerate
;
207 NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall
;
208 NPN_ConstructProcPtr construct
;
209 NPN_GetValueForURLPtr getvalueforurl
;
210 NPN_SetValueForURLPtr setvalueforurl
;
211 NPN_GetAuthenticationInfoPtr getauthenticationinfo
;
212 NPN_ScheduleTimerPtr scheduletimer
;
213 NPN_UnscheduleTimerPtr unscheduletimer
;
214 NPN_PopUpContextMenuPtr popupcontextmenu
;
215 NPN_ConvertPointPtr convertpoint
;
216 NPN_HandleEventPtr handleevent
;
217 NPN_UnfocusInstancePtr unfocusinstance
;
218 NPN_URLRedirectResponsePtr urlredirectresponse
;
219 NPN_InitAsyncSurfacePtr initasyncsurface
;
220 NPN_FinalizeAsyncSurfacePtr finalizeasyncsurface
;
221 NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface
;
226 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
227 * These can be called to retreive MIME information from the plugin dynamically
229 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
230 * to get mime info from the plugin only on OSX and may not be supported
231 * in furture version -- use NP_GetMIMEDescription instead
235 kBPSupportedMIMETypesStructVers_1
= 1
237 typedef struct _BPSupportedMIMETypes
239 SInt32 structVersion
; /* struct version */
240 Handle typeStrings
; /* STR# formated handle, allocated by plug-in */
241 Handle infoStrings
; /* STR# formated handle, allocated by plug-in */
242 } BPSupportedMIMETypes
;
243 OSErr
BP_GetSupportedMIMETypes(BPSupportedMIMETypes
*mimeInfo
, UInt32 flags
);
244 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
245 typedef const char* (*NP_GetMIMEDescriptionProcPtr
)(void);
246 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr
)(BPSupportedMIMETypes
*, UInt32
);
250 #define OSCALL WINAPI
253 #define OSCALL _System
260 /* GCC 3.3 and later support the visibility attribute. */
261 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
262 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
263 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
264 #define NP_VISIBILITY_DEFAULT __global
266 #define NP_VISIBILITY_DEFAULT
268 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
271 #if defined(_WIN32) || defined (__OS2__)
275 /* plugin meta member functions */
277 typedef struct _NPPluginData
{ /* Alternate OS2 Plugin interface */
280 char *pFileOpenTemplate
;
282 char *pProductDescription
;
283 unsigned long dwProductVersionMS
;
284 unsigned long dwProductVersionLS
;
286 typedef NPError (OSCALL
*NP_GetPluginDataFunc
)(NPPluginData
*);
287 NPError OSCALL
NP_GetPluginData(NPPluginData
* pPluginData
);
289 typedef NPError (OSCALL
*NP_GetEntryPointsFunc
)(NPPluginFuncs
*);
290 NPError OSCALL
NP_GetEntryPoints(NPPluginFuncs
* pFuncs
);
291 typedef NPError (OSCALL
*NP_InitializeFunc
)(NPNetscapeFuncs
*);
292 NPError OSCALL
NP_Initialize(NPNetscapeFuncs
* bFuncs
);
293 typedef NPError (OSCALL
*NP_ShutdownFunc
)(void);
294 NPError OSCALL
NP_Shutdown(void);
295 typedef const char* (*NP_GetMIMEDescriptionFunc
)(void);
296 const char* NP_GetMIMEDescription(void);
310 typedef char* (*NP_GetPluginVersionFunc
)(void);
311 NP_EXPORT(char*) NP_GetPluginVersion(void);
312 typedef const char* (*NP_GetMIMEDescriptionFunc
)(void);
313 NP_EXPORT(const char*) NP_GetMIMEDescription(void);
315 typedef NPError (*NP_InitializeFunc
)(NPNetscapeFuncs
*);
316 NP_EXPORT(NPError
) NP_Initialize(NPNetscapeFuncs
* bFuncs
);
317 typedef NPError (*NP_GetEntryPointsFunc
)(NPPluginFuncs
*);
318 NP_EXPORT(NPError
) NP_GetEntryPoints(NPPluginFuncs
* pFuncs
);
320 typedef NPError (*NP_InitializeFunc
)(NPNetscapeFuncs
*, NPPluginFuncs
*);
321 NP_EXPORT(NPError
) NP_Initialize(NPNetscapeFuncs
* bFuncs
, NPPluginFuncs
* pFuncs
);
323 typedef NPError (*NP_ShutdownFunc
)(void);
324 NP_EXPORT(NPError
) NP_Shutdown(void);
325 typedef NPError (*NP_GetValueFunc
)(void *, NPPVariable
, void *);
326 NP_EXPORT(NPError
) NP_GetValue(void *future
, NPPVariable aVariable
, void *aValue
);
332 #endif /* npfunctions_h_ */