• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is mozilla.org code.
15  *
16  * The Initial Developer of the Original Code is
17  * Netscape Communications Corporation.
18  * Portions created by the Initial Developer are Copyright (C) 1998
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  *
23  * Alternatively, the contents of this file may be used under the terms of
24  * either the GNU General Public License Version 2 or later (the "GPL"), or
25  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26  * in which case the provisions of the GPL or the LGPL are applicable instead
27  * of those above. If you wish to allow use of your version of this file only
28  * under the terms of either the GPL or the LGPL, and not to allow others to
29  * use your version of this file under the terms of the MPL, indicate your
30  * decision by deleting the provisions above and replace them with the notice
31  * and other provisions required by the GPL or the LGPL. If you do not delete
32  * the provisions above, a recipient may use your version of this file under
33  * the terms of any one of the MPL, the GPL or the LGPL.
34  *
35  * ***** END LICENSE BLOCK ***** */
36 
37 
38  /*
39   *  Netscape client plug-in API spec
40   */
41 
42 
43 #ifndef _NPAPI_H_
44 #define _NPAPI_H_
45 
46 #ifdef INCLUDE_JAVA
47 #include "jri.h"                /* Java Runtime Interface */
48 #else
49 #define jref    void *
50 #define JRIEnv  void
51 #endif
52 
53 #ifdef _WIN32
54 #    ifndef XP_WIN
55 #        define XP_WIN 1
56 #    endif /* XP_WIN */
57 #endif /* _WIN32 */
58 
59 #ifdef __MWERKS__
60 #    define _declspec __declspec
61 #    ifdef macintosh
62 #        ifndef XP_MAC
63 #            define XP_MAC 1
64 #        endif /* XP_MAC */
65 #    endif /* macintosh */
66 #    ifdef __INTEL__
67 #        undef NULL
68 #        ifndef XP_WIN
69 #            define XP_WIN 1
70 #        endif /* __INTEL__ */
71 #    endif /* XP_PC */
72 #endif /* __MWERKS__ */
73 
74 #if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__) && !defined(XP_UNIX)
75 #   define XP_MACOSX
76 #endif
77 
78 #ifdef XP_MAC
79     #include <Quickdraw.h>
80     #include <Events.h>
81 #endif
82 
83 #if defined(XP_MACOSX) && defined(__LP64__)
84 #define NP_NO_QUICKDRAW
85 #define NP_NO_CARBON
86 #endif
87 
88 #ifdef XP_MACOSX
89     #include <ApplicationServices/ApplicationServices.h>
90     #include <OpenGL/OpenGL.h>
91 #ifndef NP_NO_CARBON
92     #include <Carbon/Carbon.h>
93 #endif
94 #endif
95 
96 #ifdef XP_UNIX
97     #include <X11/Xlib.h>
98     #include <X11/Xutil.h>
99     #include <stdio.h>
100 #endif
101 
102 #ifdef XP_WIN
103     #include <windows.h>
104 #endif
105 
106 /*----------------------------------------------------------------------*/
107 /*             Plugin Version Constants                                 */
108 /*----------------------------------------------------------------------*/
109 
110 #define NP_VERSION_MAJOR 0
111 #define NP_VERSION_MINOR 20
112 
113 
114 
115 /*----------------------------------------------------------------------*/
116 /*             Definition of Basic Types                                */
117 /*----------------------------------------------------------------------*/
118 
119 #ifndef _UINT16
120 #define _UINT16
121 typedef unsigned short uint16;
122 #endif
123 
124 #ifndef _UINT32
125 #define _UINT32
126 #ifdef __LP64__
127 typedef unsigned int uint32;
128 #else /* __LP64__ */
129 typedef unsigned long uint32;
130 #endif /* __LP64__ */
131 #endif
132 
133 #ifndef _INT16
134 #define _INT16
135 typedef short int16;
136 #endif
137 
138 #ifndef _INT32
139 #define _INT32
140 #ifdef __LP64__
141 typedef int int32;
142 #else /* __LP64__ */
143 typedef long int32;
144 #endif /* __LP64__ */
145 #endif
146 
147 #ifndef FALSE
148 #define FALSE (0)
149 #endif
150 #ifndef TRUE
151 #define TRUE (1)
152 #endif
153 #ifndef NULL
154 #define NULL (0L)
155 #endif
156 
157 typedef unsigned char    NPBool;
158 typedef int16            NPError;
159 typedef int16            NPReason;
160 typedef char*            NPMIMEType;
161 
162 
163 
164 /*----------------------------------------------------------------------*/
165 /*             Structures and definitions             */
166 /*----------------------------------------------------------------------*/
167 
168 #if !defined(__LP64__)
169 #if defined(XP_MAC) || defined(XP_MACOSX)
170 #pragma options align=mac68k
171 #endif
172 #endif /* __LP64__ */
173 
174 /*
175  *  NPP is a plug-in's opaque instance handle
176  */
177 typedef struct _NPP
178 {
179     void*    pdata;            /* plug-in private data */
180     void*    ndata;            /* netscape private data */
181 } NPP_t;
182 
183 typedef NPP_t*    NPP;
184 
185 
186 typedef struct _NPStream
187 {
188     void*        pdata;        /* plug-in private data */
189     void*        ndata;        /* netscape private data */
190     const char*  url;
191     uint32       end;
192     uint32       lastmodified;
193     void*        notifyData;
194     const char*  headers;      /* Response headers from host.
195                                 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
196                                 * Used for HTTP only; NULL for non-HTTP.
197                                 * Available from NPP_NewStream onwards.
198                                 * Plugin should copy this data before storing it.
199                                 * Includes HTTP status line and all headers,
200                                 * preferably verbatim as received from server,
201                                 * headers formatted as in HTTP ("Header: Value"),
202                                 * and newlines (\n, NOT \r\n) separating lines.
203                                 * Terminated by \n\0 (NOT \n\n\0). */
204 } NPStream;
205 
206 
207 typedef struct _NPByteRange
208 {
209     int32      offset;         /* negative offset means from the end */
210     uint32     length;
211     struct _NPByteRange* next;
212 } NPByteRange;
213 
214 
215 typedef struct _NPSavedData
216 {
217     int32    len;
218     void*    buf;
219 } NPSavedData;
220 
221 
222 typedef struct _NPRect
223 {
224     uint16    top;
225     uint16    left;
226     uint16    bottom;
227     uint16    right;
228 } NPRect;
229 
230 
231 #ifdef XP_UNIX
232 /*
233  * Unix specific structures and definitions
234  */
235 
236 /*
237  * Callback Structures.
238  *
239  * These are used to pass additional platform specific information.
240  */
241 enum {
242     NP_SETWINDOW = 1,
243     NP_PRINT
244 };
245 
246 typedef struct
247 {
248     int32        type;
249 } NPAnyCallbackStruct;
250 
251 typedef struct
252 {
253     int32           type;
254     Display*        display;
255     Visual*         visual;
256     Colormap        colormap;
257     unsigned int    depth;
258 } NPSetWindowCallbackStruct;
259 
260 typedef struct
261 {
262     int32            type;
263     FILE*            fp;
264 } NPPrintCallbackStruct;
265 
266 #endif /* XP_UNIX */
267 
268 /*
269  *   The following masks are applied on certain platforms to NPNV and
270  *   NPPV selectors that pass around pointers to COM interfaces. Newer
271  *   compilers on some platforms may generate vtables that are not
272  *   compatible with older compilers. To prevent older plugins from
273  *   not understanding a new browser's ABI, these masks change the
274  *   values of those selectors on those platforms. To remain backwards
275  *   compatible with differenet versions of the browser, plugins can
276  *   use these masks to dynamically determine and use the correct C++
277  *   ABI that the browser is expecting. This does not apply to Windows
278  *   as Microsoft's COM ABI will likely not change.
279  */
280 
281 #define NP_ABI_GCC3_MASK  0x10000000
282 /*
283  *   gcc 3.x generated vtables on UNIX and OSX are incompatible with
284  *   previous compilers.
285  */
286 #if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
287 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
288 #else
289 #define _NP_ABI_MIXIN_FOR_GCC3 0
290 #endif
291 
292 #define NP_ABI_MACHO_MASK 0x01000000
293 /*
294  *   On OSX, the Mach-O executable format is significantly
295  *   different than CFM. In addition to having a different
296  *   C++ ABI, it also has has different C calling convention.
297  *   You must use glue code when calling between CFM and
298  *   Mach-O C functions.
299  */
300 #if (defined(TARGET_RT_MAC_MACHO))
301 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
302 #else
303 #define _NP_ABI_MIXIN_FOR_MACHO 0
304 #endif
305 
306 
307 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
308 
309 /*
310  * List of variable names for which NPP_GetValue shall be implemented
311  */
312 typedef enum {
313     NPPVpluginNameString = 1,
314     NPPVpluginDescriptionString,
315     NPPVpluginWindowBool,
316     NPPVpluginTransparentBool,
317 
318     NPPVjavaClass,                /* Not implemented in WebKit */
319     NPPVpluginWindowSize,         /* Not implemented in WebKit */
320     NPPVpluginTimerInterval,      /* Not implemented in WebKit */
321 
322     NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */
323     NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */
324 
325     /* 12 and over are available on Mozilla builds starting with 0.9.9 */
326     NPPVjavascriptPushCallerBool = 12,  /* Not implemented in WebKit */
327     NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */
328     NPPVpluginNeedsXEmbed         = 14, /* Not implemented in WebKit */
329 
330     /* Get the NPObject for scripting the plugin. */
331     NPPVpluginScriptableNPObject  = 15,
332 
333     /* Get the plugin value (as \0-terminated UTF-8 string data) for
334      * form submission if the plugin is part of a form. Use
335      * NPN_MemAlloc() to allocate memory for the string data.
336      */
337     NPPVformValue = 16,    /* Not implemented in WebKit */
338 
339     NPPVpluginUrlRequestsDisplayedBool = 17, /* Not implemented in WebKit */
340 
341     /* Checks if the plugin is interested in receiving the http body of
342      * failed http requests (http status != 200).
343      */
344     NPPVpluginWantsAllNetworkStreams = 18,
345 
346 #ifdef XP_MACOSX
347     /* Used for negotiating drawing models */
348     NPPVpluginDrawingModel = 1000,
349     /* Used for negotiating event models */
350     NPPVpluginEventModel = 1001,
351     /* The plug-in text input vtable */
352     NPPVpluginTextInputFuncs = 1002,
353     /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
354     NPPVpluginCoreAnimationLayer = 1003
355 #endif
356 
357 #ifdef ANDROID
358     NPPFakeValueToForce32Bits = 0x7FFFFFFF
359 #endif
360 } NPPVariable;
361 
362 /*
363  * List of variable names for which NPN_GetValue is implemented by Mozilla
364  */
365 typedef enum {
366     NPNVxDisplay = 1,
367     NPNVxtAppContext,
368     NPNVnetscapeWindow,
369     NPNVjavascriptEnabledBool,
370     NPNVasdEnabledBool,
371     NPNVisOfflineBool,
372 
373     /* 10 and over are available on Mozilla builds starting with 0.9.4 */
374     NPNVserviceManager = (10 | NP_ABI_MASK),  /* Not implemented in WebKit */
375     NPNVDOMElement     = (11 | NP_ABI_MASK),  /* Not implemented in WebKit */
376     NPNVDOMWindow      = (12 | NP_ABI_MASK),  /* Not implemented in WebKit */
377     NPNVToolkit        = (13 | NP_ABI_MASK),  /* Not implemented in WebKit */
378     NPNVSupportsXEmbedBool = 14,              /* Not implemented in WebKit */
379 
380     /* Get the NPObject wrapper for the browser window. */
381     NPNVWindowNPObject = 15,
382 
383     /* Get the NPObject wrapper for the plugins DOM element. */
384     NPNVPluginElementNPObject = 16,
385 
386     NPNVSupportsWindowless = 17
387 
388 #ifdef XP_MACOSX
389     , NPNVpluginDrawingModel = 1000 /* The NPDrawingModel specified by the plugin */
390 
391 #ifndef NP_NO_QUICKDRAW
392     , NPNVsupportsQuickDrawBool = 2000 /* TRUE if the browser supports the QuickDraw drawing model */
393 #endif
394     , NPNVsupportsCoreGraphicsBool = 2001 /* TRUE if the browser supports the CoreGraphics drawing model */
395     , NPNVsupportsOpenGLBool = 2002 /* TRUE if the browser supports the OpenGL drawing model (CGL on Mac) */
396     , NPNVsupportsCoreAnimationBool = 2003 /* TRUE if the browser supports the CoreAnimation drawing model */
397 
398 #ifndef NP_NO_CARBON
399     , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
400 #endif
401     , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
402 
403     , NPNVbrowserTextInputFuncs = 1002 /* The browser text input vtable */
404 #endif /* XP_MACOSX */
405 
406 #ifdef ANDROID
407     , NPNFakeValueToForce32Bits = 0x7FFFFFFF
408 #endif
409 } NPNVariable;
410 
411 /*
412  * The type of a NPWindow - it specifies the type of the data structure
413  * returned in the window field.
414  */
415 typedef enum {
416     NPWindowTypeWindow = 1,
417     NPWindowTypeDrawable
418 } NPWindowType;
419 
420 #ifdef XP_MACOSX
421 
422 /*
423  * The drawing model for a Mac OS X plugin.  These are the possible values for the NPNVpluginDrawingModel variable.
424  */
425 
426 typedef enum {
427 #ifndef NP_NO_QUICKDRAW
428     NPDrawingModelQuickDraw = 0,
429 #endif
430     NPDrawingModelCoreGraphics = 1,
431     NPDrawingModelOpenGL = 2,
432     NPDrawingModelCoreAnimation = 3
433 } NPDrawingModel;
434 
435 /*
436  * The event model for a Mac OS X plugin. These are the possible values for the NPNVpluginEventModel variable.
437  */
438 
439 typedef enum {
440 #ifndef NP_NO_CARBON
441     NPEventModelCarbon = 0,
442 #endif
443     NPEventModelCocoa = 1,
444 } NPEventModel;
445 
446 typedef enum {
447     NPCocoaEventDrawRect = 1,
448     NPCocoaEventMouseDown,
449     NPCocoaEventMouseUp,
450     NPCocoaEventMouseMoved,
451     NPCocoaEventMouseEntered,
452     NPCocoaEventMouseExited,
453     NPCocoaEventMouseDragged,
454     NPCocoaEventKeyDown,
455     NPCocoaEventKeyUp,
456     NPCocoaEventFlagsChanged,
457     NPCocoaEventFocusChanged,
458     NPCocoaEventWindowFocusChanged,
459     NPCocoaEventScrollWheel,
460 } NPCocoaEventType;
461 
462 typedef struct _NPNSString NPNSString;
463 typedef struct _NPNSWindow NPNSWindow;
464 typedef struct _NPNSMenu NPNSMenu;
465 
466 typedef struct _NPCocoaEvent {
467     NPCocoaEventType type;
468     uint32 version;
469 
470     union {
471         struct {
472             uint32 modifierFlags;
473             double pluginX;
474             double pluginY;
475             int32 buttonNumber;
476             int32 clickCount;
477             double deltaX;
478             double deltaY;
479             double deltaZ;
480         } mouse;
481         struct {
482             uint32 modifierFlags;
483             NPNSString *characters;
484             NPNSString *charactersIgnoringModifiers;
485             NPBool isARepeat;
486             uint16 keyCode;
487         } key;
488         struct {
489             double x;
490             double y;
491             double width;
492             double height;
493         } draw;
494         struct {
495             NPBool hasFocus;
496         } focus;
497     } data;
498 } NPCocoaEvent;
499 
500 #endif
501 
502 typedef struct _NPWindow
503 {
504     void*    window;     /* Platform specific window handle */
505     int32    x;            /* Position of top left corner relative */
506     int32    y;            /*    to a netscape page.                    */
507     uint32    width;        /* Maximum window size */
508     uint32    height;
509     NPRect    clipRect;    /* Clipping rectangle in port coordinates */
510                         /* Used by MAC only.              */
511 #ifdef XP_UNIX
512     void *    ws_info;    /* Platform-dependent additonal data */
513 #endif /* XP_UNIX */
514     NPWindowType type;    /* Is this a window or a drawable? */
515 } NPWindow;
516 
517 
518 typedef struct _NPFullPrint
519 {
520     NPBool    pluginPrinted;    /* Set TRUE if plugin handled fullscreen */
521                             /*    printing                             */
522     NPBool    printOne;        /* TRUE if plugin should print one copy  */
523                             /*    to default printer                     */
524     void*    platformPrint;    /* Platform-specific printing info */
525 } NPFullPrint;
526 
527 typedef struct _NPEmbedPrint
528 {
529     NPWindow    window;
530     void*    platformPrint;    /* Platform-specific printing info */
531 } NPEmbedPrint;
532 
533 typedef struct _NPPrint
534 {
535     uint16    mode;                        /* NP_FULL or NP_EMBED */
536     union
537     {
538         NPFullPrint     fullPrint;        /* if mode is NP_FULL */
539         NPEmbedPrint    embedPrint;        /* if mode is NP_EMBED */
540     } print;
541 } NPPrint;
542 
543 #ifdef XP_MACOSX
544 typedef NPNSMenu NPMenu;
545 #else
546 typedef void * NPMenu;
547 #endif
548 
549 #if defined(XP_MAC) || defined(XP_MACOSX)
550 
551 #ifndef NP_NO_CARBON
552 typedef EventRecord    NPEvent;
553 #endif
554 
555 #elif defined(XP_WIN)
556 typedef struct _NPEvent
557 {
558     uint16   event;
559     uint32   wParam;
560     uint32   lParam;
561 } NPEvent;
562 #elif defined (XP_UNIX)
563 typedef XEvent NPEvent;
564 #else
565 typedef void*            NPEvent;
566 #endif /* XP_MAC */
567 
568 #if defined(XP_MAC)
569 typedef RgnHandle NPRegion;
570 #elif defined(XP_MACOSX)
571 /*
572  * NPRegion's type depends on the drawing model specified by the plugin (see NPNVpluginDrawingModel).
573  * NPQDRegion represents a QuickDraw RgnHandle and is used with the QuickDraw drawing model.
574  * NPCGRegion repesents a graphical region when using any other drawing model.
575  */
576 typedef void *NPRegion;
577 #ifndef NP_NO_QUICKDRAW
578 typedef RgnHandle NPQDRegion;
579 #endif
580 typedef CGPathRef NPCGRegion;
581 #elif defined(XP_WIN)
582 typedef HRGN NPRegion;
583 #elif defined(XP_UNIX)
584 typedef Region NPRegion;
585 #else
586 typedef void *NPRegion;
587 #endif /* XP_MAC */
588 
589 #ifdef XP_MACOSX
590 
591 /*
592  * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
593  * as its drawing model.
594  */
595 
596 typedef struct NP_CGContext
597 {
598     CGContextRef context;
599 #ifdef NP_NO_CARBON
600     NPNSWindow *window;
601 #else
602     void *window; // Can be either an NSWindow or a WindowRef depending on the event model
603 #endif
604 } NP_CGContext;
605 
606 /*
607  * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
608  * drawing model.
609  */
610 
611 typedef struct NP_GLContext
612 {
613     CGLContextObj context;
614 #ifdef NP_NO_CARBON
615     NPNSWindow *window;
616 #else
617     void *window; // Can be either an NSWindow or a WindowRef depending on the event model
618 #endif
619 } NP_GLContext;
620 
621 #endif /* XP_MACOSX */
622 
623 #if defined(XP_MAC) || defined(XP_MACOSX)
624 
625 /*
626  *  Mac-specific structures and definitions.
627  */
628 
629 #ifndef NP_NO_QUICKDRAW
630 
631 /*
632  * NP_Port is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelQuickDraw as its
633  * drawing model, or the plugin does not specify a drawing model.
634  *
635  * It is not recommended that new plugins use NPDrawingModelQuickDraw or NP_Port, as QuickDraw has been
636  * deprecated in Mac OS X 10.5.  CoreGraphics is the preferred drawing API.
637  *
638  * NP_Port is not available in 64-bit.
639  */
640 
641 typedef struct NP_Port
642 {
643     CGrafPtr     port;        /* Grafport */
644     int32        portx;        /* position inside the topmost window */
645     int32        porty;
646 } NP_Port;
647 
648 #endif /* NP_NO_QUICKDRAW */
649 
650 /*
651  *  Non-standard event types that can be passed to HandleEvent
652  */
653 #define getFocusEvent        (osEvt + 16)
654 #define loseFocusEvent        (osEvt + 17)
655 #define adjustCursorEvent   (osEvt + 18)
656 
657 #endif /* XP_MAC */
658 
659 
660 /*
661  * Values for mode passed to NPP_New:
662  */
663 #define NP_EMBED        1
664 #define NP_FULL         2
665 
666 /*
667  * Values for stream type passed to NPP_NewStream:
668  */
669 #define NP_NORMAL        1
670 #define NP_SEEK         2
671 #define NP_ASFILE        3
672 #define NP_ASFILEONLY        4
673 
674 #define NP_MAXREADY    (((unsigned)(~0)<<1)>>1)
675 
676 #if !defined(__LP64__)
677 #if defined(XP_MAC) || defined(XP_MACOSX)
678 #pragma options align=reset
679 #endif
680 #endif /* __LP64__ */
681 
682 
683 /*----------------------------------------------------------------------*/
684 /*             Error and Reason Code definitions            */
685 /*----------------------------------------------------------------------*/
686 
687 /*
688  *    Values of type NPError:
689  */
690 #define NPERR_BASE                            0
691 #define NPERR_NO_ERROR                        (NPERR_BASE + 0)
692 #define NPERR_GENERIC_ERROR                    (NPERR_BASE + 1)
693 #define NPERR_INVALID_INSTANCE_ERROR        (NPERR_BASE + 2)
694 #define NPERR_INVALID_FUNCTABLE_ERROR        (NPERR_BASE + 3)
695 #define NPERR_MODULE_LOAD_FAILED_ERROR        (NPERR_BASE + 4)
696 #define NPERR_OUT_OF_MEMORY_ERROR            (NPERR_BASE + 5)
697 #define NPERR_INVALID_PLUGIN_ERROR            (NPERR_BASE + 6)
698 #define NPERR_INVALID_PLUGIN_DIR_ERROR        (NPERR_BASE + 7)
699 #define NPERR_INCOMPATIBLE_VERSION_ERROR    (NPERR_BASE + 8)
700 #define NPERR_INVALID_PARAM                (NPERR_BASE + 9)
701 #define NPERR_INVALID_URL                    (NPERR_BASE + 10)
702 #define NPERR_FILE_NOT_FOUND                (NPERR_BASE + 11)
703 #define NPERR_NO_DATA                        (NPERR_BASE + 12)
704 #define NPERR_STREAM_NOT_SEEKABLE            (NPERR_BASE + 13)
705 
706 /*
707  *    Values of type NPReason:
708  */
709 #define NPRES_BASE                0
710 #define NPRES_DONE                    (NPRES_BASE + 0)
711 #define NPRES_NETWORK_ERR            (NPRES_BASE + 1)
712 #define NPRES_USER_BREAK            (NPRES_BASE + 2)
713 
714 /*
715  *      Don't use these obsolete error codes any more.
716  */
717 #define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
718 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
719 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
720 
721 /*
722  * Version feature information
723  */
724 #define NPVERS_HAS_STREAMOUTPUT     8
725 #define NPVERS_HAS_NOTIFICATION     9
726 #define NPVERS_HAS_LIVECONNECT        9
727 #define NPVERS_WIN16_HAS_LIVECONNECT    9
728 #define NPVERS_68K_HAS_LIVECONNECT    11
729 #define NPVERS_HAS_WINDOWLESS       11
730 #define NPVERS_HAS_XPCONNECT_SCRIPTING    13  /* Not implemented in WebKit */
731 #define NPVERS_HAS_NPRUNTIME_SCRIPTING    14
732 #define NPVERS_HAS_FORM_VALUES            15  /* Not implemented in WebKit; see bug 13061 */
733 #define NPVERS_HAS_POPUPS_ENABLED_STATE   16  /* Not implemented in WebKit */
734 #define NPVERS_HAS_RESPONSE_HEADERS       17
735 #define NPVERS_HAS_NPOBJECT_ENUM          18
736 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
737 #define NPVERS_MACOSX_HAS_EVENT_MODELS    20
738 
739 /*----------------------------------------------------------------------*/
740 /*             Function Prototypes                */
741 /*----------------------------------------------------------------------*/
742 
743 #if defined(_WINDOWS) && !defined(WIN32)
744 #define NP_LOADDS  _loadds
745 #else
746 #define NP_LOADDS
747 #endif
748 
749 #ifdef __cplusplus
750 extern "C" {
751 #endif
752 
753 /*
754  * NPP_* functions are provided by the plugin and called by the navigator.
755  */
756 
757 #ifdef XP_UNIX
758 char*                    NPP_GetMIMEDescription(void);
759 #endif /* XP_UNIX */
760 
761 NPError     NPP_Initialize(void);
762 void        NPP_Shutdown(void);
763 NPError     NP_LOADDS    NPP_New(NPMIMEType pluginType, NPP instance,
764                                 uint16 mode, int16 argc, char* argn[],
765                                 char* argv[], NPSavedData* saved);
766 NPError     NP_LOADDS    NPP_Destroy(NPP instance, NPSavedData** save);
767 NPError     NP_LOADDS    NPP_SetWindow(NPP instance, NPWindow* window);
768 NPError     NP_LOADDS    NPP_NewStream(NPP instance, NPMIMEType type,
769                                       NPStream* stream, NPBool seekable,
770                                       uint16* stype);
771 NPError     NP_LOADDS    NPP_DestroyStream(NPP instance, NPStream* stream,
772                                           NPReason reason);
773 int32        NP_LOADDS    NPP_WriteReady(NPP instance, NPStream* stream);
774 int32        NP_LOADDS    NPP_Write(NPP instance, NPStream* stream, int32 offset,
775                                   int32 len, void* buffer);
776 void        NP_LOADDS    NPP_StreamAsFile(NPP instance, NPStream* stream,
777                                          const char* fname);
778 void        NP_LOADDS    NPP_Print(NPP instance, NPPrint* platformPrint);
779 int16            NPP_HandleEvent(NPP instance, void* event);
780 void        NP_LOADDS    NPP_URLNotify(NPP instance, const char* url,
781                                       NPReason reason, void* notifyData);
782 jref        NP_LOADDS            NPP_GetJavaClass(void);
783 NPError     NPP_GetValue(NPP instance, NPPVariable variable,
784                                      void *value);
785 NPError     NPP_SetValue(NPP instance, NPNVariable variable,
786                                      void *value);
787 
788 /*
789  * NPN_* functions are provided by the navigator and called by the plugin.
790  */
791 
792 void        NPN_Version(int* plugin_major, int* plugin_minor,
793                             int* netscape_major, int* netscape_minor);
794 NPError     NPN_GetURLNotify(NPP instance, const char* url,
795                                  const char* target, void* notifyData);
796 NPError     NPN_GetURL(NPP instance, const char* url,
797                            const char* target);
798 NPError     NPN_PostURLNotify(NPP instance, const char* url,
799                                   const char* target, uint32 len,
800                                   const char* buf, NPBool file,
801                                   void* notifyData);
802 NPError     NPN_PostURL(NPP instance, const char* url,
803                             const char* target, uint32 len,
804                             const char* buf, NPBool file);
805 NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
806 NPError     NPN_NewStream(NPP instance, NPMIMEType type,
807                               const char* target, NPStream** stream);
808 int32        NPN_Write(NPP instance, NPStream* stream, int32 len,
809                           void* buffer);
810 NPError     NPN_DestroyStream(NPP instance, NPStream* stream,
811                                   NPReason reason);
812 void        NPN_Status(NPP instance, const char* message);
813 const char*    NPN_UserAgent(NPP instance);
814 void*        NPN_MemAlloc(uint32 size);
815 void        NPN_MemFree(void* ptr);
816 uint32        NPN_MemFlush(uint32 size);
817 void        NPN_ReloadPlugins(NPBool reloadPages);
818 JRIEnv*     NPN_GetJavaEnv(void);
819 jref        NPN_GetJavaPeer(NPP instance);
820 NPError     NPN_GetValue(NPP instance, NPNVariable variable,
821                              void *value);
822 NPError     NPN_SetValue(NPP instance, NPPVariable variable,
823                              void *value);
824 void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
825 void        NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
826 void        NPN_ForceRedraw(NPP instance);
827 void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
828 void        NPN_PopPopupsEnabledState(NPP instance);
829 void        NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData);
830 uint32      NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID));
831 void        NPN_UnscheduleTimer(NPP instance, uint32 timerID);
832 NPError     NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
833 
834 #ifdef __cplusplus
835 }  /* end extern "C" */
836 #endif
837 
838 #endif /* _NPAPI_H_ */
839