PageRenderTime 166ms CodeModel.GetById 60ms app.highlight 61ms RepoModel.GetById 40ms app.codeStats 0ms

/npapi/npfunctions.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 320 lines | 256 code | 14 blank | 50 comment | 6 complexity | 796ca91dde39af7bb64ff09fb5fb04ee MD5 | raw file
  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
 51typedef void         (* NP_LOADDS NPP_InitializeProcPtr)(void);
 52typedef void         (* NP_LOADDS NPP_ShutdownProcPtr)(void);
 53typedef NPError      (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
 54typedef NPError      (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
 55typedef NPError      (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
 56typedef NPError      (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
 57typedef NPError      (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
 58typedef int32_t      (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
 59typedef int32_t      (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
 60typedef void         (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
 61typedef void         (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
 62typedef int16_t      (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
 63typedef void         (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
 64/* Any NPObjects returned to the browser via NPP_GetValue should be retained
 65   by the plugin on the way out. The browser is responsible for releasing. */
 66typedef NPError      (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
 67typedef NPError      (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
 68typedef NPBool       (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
 69typedef void         (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
 70typedef void         (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
 71
 72typedef NPError      (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
 73typedef NPError      (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
 74typedef NPError      (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
 75typedef NPError      (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
 76typedef NPError      (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
 77typedef NPError      (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
 78typedef NPError      (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
 79typedef NPError      (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
 80typedef int32_t      (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
 81typedef NPError      (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
 82typedef void         (*NPN_StatusProcPtr)(NPP instance, const char* message);
 83/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
 84   depend on it sticking around and don't free it. */
 85typedef const char*  (*NPN_UserAgentProcPtr)(NPP instance);
 86typedef void*        (*NPN_MemAllocProcPtr)(uint32_t size);
 87typedef void         (*NPN_MemFreeProcPtr)(void* ptr);
 88typedef uint32_t     (*NPN_MemFlushProcPtr)(uint32_t size);
 89typedef void         (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
 90typedef void*        (*NPN_GetJavaEnvProcPtr)(void);
 91typedef void*        (*NPN_GetJavaPeerProcPtr)(NPP instance);
 92typedef void         (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
 93typedef void         (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
 94typedef void         (*NPN_ForceRedrawProcPtr)(NPP instance);
 95typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
 96typedef void         (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
 97typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
 98typedef bool         (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
 99typedef NPUTF8*      (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
100typedef int32_t      (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
101typedef NPObject*    (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
102typedef NPObject*    (*NPN_RetainObjectProcPtr)(NPObject *obj);
103typedef void         (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
104typedef bool         (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
105typedef bool         (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
106typedef bool         (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
107typedef bool         (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
108typedef bool         (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
109typedef bool         (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
110typedef bool         (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
111typedef bool         (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
112typedef void         (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
113typedef void         (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
114typedef void         (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
115typedef void         (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
116typedef bool         (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
117typedef void         (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
118typedef bool         (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
119typedef NPError      (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
120typedef NPError      (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
121typedef NPError      (*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);
122typedef uint32_t     (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
123typedef void         (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
124typedef NPError      (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
125typedef NPBool       (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
126typedef NPBool       (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
127typedef NPBool       (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
128typedef void         (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
129
130typedef struct _NPPluginFuncs {
131  uint16_t size;
132  uint16_t version;
133  NPP_NewProcPtr newp;
134  NPP_DestroyProcPtr destroy;
135  NPP_SetWindowProcPtr setwindow;
136  NPP_NewStreamProcPtr newstream;
137  NPP_DestroyStreamProcPtr destroystream;
138  NPP_StreamAsFileProcPtr asfile;
139  NPP_WriteReadyProcPtr writeready;
140  NPP_WriteProcPtr write;
141  NPP_PrintProcPtr print;
142  NPP_HandleEventProcPtr event;
143  NPP_URLNotifyProcPtr urlnotify;
144  void* javaClass;
145  NPP_GetValueProcPtr getvalue;
146  NPP_SetValueProcPtr setvalue;
147  NPP_GotFocusPtr gotfocus;
148  NPP_LostFocusPtr lostfocus;
149  NPP_URLRedirectNotifyPtr urlredirectnotify;
150} NPPluginFuncs;
151
152typedef struct _NPNetscapeFuncs {
153  uint16_t size;
154  uint16_t version;
155  NPN_GetURLProcPtr geturl;
156  NPN_PostURLProcPtr posturl;
157  NPN_RequestReadProcPtr requestread;
158  NPN_NewStreamProcPtr newstream;
159  NPN_WriteProcPtr write;
160  NPN_DestroyStreamProcPtr destroystream;
161  NPN_StatusProcPtr status;
162  NPN_UserAgentProcPtr uagent;
163  NPN_MemAllocProcPtr memalloc;
164  NPN_MemFreeProcPtr memfree;
165  NPN_MemFlushProcPtr memflush;
166  NPN_ReloadPluginsProcPtr reloadplugins;
167  NPN_GetJavaEnvProcPtr getJavaEnv;
168  NPN_GetJavaPeerProcPtr getJavaPeer;
169  NPN_GetURLNotifyProcPtr geturlnotify;
170  NPN_PostURLNotifyProcPtr posturlnotify;
171  NPN_GetValueProcPtr getvalue;
172  NPN_SetValueProcPtr setvalue;
173  NPN_InvalidateRectProcPtr invalidaterect;
174  NPN_InvalidateRegionProcPtr invalidateregion;
175  NPN_ForceRedrawProcPtr forceredraw;
176  NPN_GetStringIdentifierProcPtr getstringidentifier;
177  NPN_GetStringIdentifiersProcPtr getstringidentifiers;
178  NPN_GetIntIdentifierProcPtr getintidentifier;
179  NPN_IdentifierIsStringProcPtr identifierisstring;
180  NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
181  NPN_IntFromIdentifierProcPtr intfromidentifier;
182  NPN_CreateObjectProcPtr createobject;
183  NPN_RetainObjectProcPtr retainobject;
184  NPN_ReleaseObjectProcPtr releaseobject;
185  NPN_InvokeProcPtr invoke;
186  NPN_InvokeDefaultProcPtr invokeDefault;
187  NPN_EvaluateProcPtr evaluate;
188  NPN_GetPropertyProcPtr getproperty;
189  NPN_SetPropertyProcPtr setproperty;
190  NPN_RemovePropertyProcPtr removeproperty;
191  NPN_HasPropertyProcPtr hasproperty;
192  NPN_HasMethodProcPtr hasmethod;
193  NPN_ReleaseVariantValueProcPtr releasevariantvalue;
194  NPN_SetExceptionProcPtr setexception;
195  NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
196  NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
197  NPN_EnumerateProcPtr enumerate;
198  NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
199  NPN_ConstructProcPtr construct;
200  NPN_GetValueForURLPtr getvalueforurl;
201  NPN_SetValueForURLPtr setvalueforurl;
202  NPN_GetAuthenticationInfoPtr getauthenticationinfo;
203  NPN_ScheduleTimerPtr scheduletimer;
204  NPN_UnscheduleTimerPtr unscheduletimer;
205  NPN_PopUpContextMenuPtr popupcontextmenu;
206  NPN_ConvertPointPtr convertpoint;
207  NPN_HandleEventPtr handleevent;
208  NPN_UnfocusInstancePtr unfocusinstance;
209  NPN_URLRedirectResponsePtr urlredirectresponse;
210} NPNetscapeFuncs;
211
212#ifdef XP_MACOSX
213/*
214 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
215 * These can be called to retreive MIME information from the plugin dynamically
216 *
217 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
218 *       to get mime info from the plugin only on OSX and may not be supported 
219 *       in furture version -- use NP_GetMIMEDescription instead
220 */
221enum
222{
223 kBPSupportedMIMETypesStructVers_1    = 1
224};
225typedef struct _BPSupportedMIMETypes
226{
227 SInt32    structVersion;      /* struct version */
228 Handle    typeStrings;        /* STR# formated handle, allocated by plug-in */
229 Handle    infoStrings;        /* STR# formated handle, allocated by plug-in */
230} BPSupportedMIMETypes;
231OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
232#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
233typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
234typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
235#endif
236
237#if defined(_WIN32)
238#define OSCALL WINAPI
239#else
240#if defined(__OS2__)
241#define OSCALL _System
242#else
243#define OSCALL
244#endif
245#endif
246
247#if defined(XP_UNIX)
248/* GCC 3.3 and later support the visibility attribute. */
249#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
250#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
251#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
252#define NP_VISIBILITY_DEFAULT __global
253#else
254#define NP_VISIBILITY_DEFAULT
255#endif
256#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
257#endif
258
259#if defined(_WIN32) || defined (__OS2__)
260#ifdef __cplusplus
261extern "C" {
262#endif
263/* plugin meta member functions */
264#if defined(__OS2__)
265typedef struct _NPPluginData {   /* Alternate OS2 Plugin interface */
266  char *pMimeTypes;
267  char *pFileExtents;
268  char *pFileOpenTemplate;
269  char *pProductName;
270  char *pProductDescription;
271  unsigned long dwProductVersionMS;
272  unsigned long dwProductVersionLS;
273} NPPluginData;
274typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*);
275NPError OSCALL  NP_GetPluginData(NPPluginData * pPluginData);
276#endif
277typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
278NPError OSCALL  NP_GetEntryPoints(NPPluginFuncs* pFuncs);
279typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
280NPError OSCALL  NP_Initialize(NPNetscapeFuncs* bFuncs);
281typedef NPError (*NP_ShutdownFunc)(void);
282NPError OSCALL  NP_Shutdown(void);
283typedef char*   (*NP_GetMIMEDescriptionFunc)(void);
284char*           NP_GetMIMEDescription(void);
285#ifdef __cplusplus
286}
287#endif
288#endif
289
290#if defined(__OS2__)
291#pragma pack()
292#endif
293
294#ifdef XP_UNIX
295#ifdef __cplusplus
296extern "C" {
297#endif
298typedef char*      (*NP_GetPluginVersionFunc)(void);
299NP_EXPORT(char*)   NP_GetPluginVersion(void);
300typedef char*      (*NP_GetMIMEDescriptionFunc)(void);
301NP_EXPORT(char*)   NP_GetMIMEDescription(void);
302#ifdef XP_MACOSX
303typedef NPError    (*NP_InitializeFunc)(NPNetscapeFuncs*);
304NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
305typedef NPError    (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
306NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
307#else
308typedef NPError    (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
309NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
310#endif
311typedef NPError    (*NP_ShutdownFunc)(void);
312NP_EXPORT(NPError) NP_Shutdown(void);
313typedef NPError    (*NP_GetValueFunc)(void *, NPPVariable, void *);
314NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
315#ifdef __cplusplus
316}
317#endif
318#endif
319
320#endif /* npfunctions_h_ */