1/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 npapi_h_
39#define npapi_h_
40
41#if defined(__OS2__)
42#pragma pack(1)
43#endif
44
45#include "nptypes.h"
46
47#if defined(__OS2__) || defined(OS2)
48#ifndef XP_OS2
49#define XP_OS2 1
50#endif
51#endif
52
53#ifdef INCLUDE_JAVA
54#include "jri.h"                /* Java Runtime Interface */
55#else
56#define jref    void *
57#define JRIEnv  void
58#endif
59
60#ifdef _WIN32
61#include <windows.h>
62#ifndef XP_WIN
63#define XP_WIN 1
64#endif
65#endif
66
67#if defined(__APPLE_CC__) && !defined(XP_UNIX)
68#ifndef XP_MACOSX
69#define XP_MACOSX 1
70#endif
71#endif
72
73#if defined(XP_MACOSX) && defined(__LP64__)
74#define NP_NO_QUICKDRAW
75#define NP_NO_CARBON
76#endif
77
78#if defined(XP_MACOSX)
79#include <ApplicationServices/ApplicationServices.h>
80#include <OpenGL/OpenGL.h>
81#ifndef NP_NO_CARBON
82#include <Carbon/Carbon.h>
83#endif
84#endif
85
86#if defined(XP_UNIX)
87#include <stdio.h>
88#if defined(MOZ_X11)
89#include <X11/Xlib.h>
90#include <X11/Xutil.h>
91#endif
92#endif
93
94/*----------------------------------------------------------------------*/
95/*                        Plugin Version Constants                      */
96/*----------------------------------------------------------------------*/
97
98#define NP_VERSION_MAJOR 0
99#define NP_VERSION_MINOR 24
100
101
102/* The OS/2 version of Netscape uses RC_DATA to define the
103   mime types, file extensions, etc that are required.
104   Use a vertical bar to separate types, end types with \0.
105   FileVersion and ProductVersion are 32bit ints, all other
106   entries are strings that MUST be terminated with a \0.
107
108AN EXAMPLE:
109
110RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
111
112RCDATA NP_INFO_MIMEType    { "video/x-video|",
113                             "video/x-flick\0" }
114RCDATA NP_INFO_FileExtents { "avi|",
115                             "flc\0" }
116RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
117                             "MMOS2 Flc/Fli player(*.flc)\0" }
118
119RCDATA NP_INFO_FileVersion       { 1,0,0,1 }
120RCDATA NP_INFO_CompanyName       { "Netscape Communications\0" }
121RCDATA NP_INFO_FileDescription   { "NPAVI32 Extension DLL\0"
122RCDATA NP_INFO_InternalName      { "NPAVI32\0" )
123RCDATA NP_INFO_LegalCopyright    { "Copyright Netscape Communications \251 1996\0"
124RCDATA NP_INFO_OriginalFilename  { "NVAPI32.DLL" }
125RCDATA NP_INFO_ProductName       { "NPAVI32 Dynamic Link Library\0" }
126*/
127/* RC_DATA types for version info - required */
128#define NP_INFO_ProductVersion      1
129#define NP_INFO_MIMEType            2
130#define NP_INFO_FileOpenName        3
131#define NP_INFO_FileExtents         4
132/* RC_DATA types for version info - used if found */
133#define NP_INFO_FileDescription     5
134#define NP_INFO_ProductName         6
135/* RC_DATA types for version info - optional */
136#define NP_INFO_CompanyName         7
137#define NP_INFO_FileVersion         8
138#define NP_INFO_InternalName        9
139#define NP_INFO_LegalCopyright      10
140#define NP_INFO_OriginalFilename    11
141
142#ifndef RC_INVOKED
143
144/*----------------------------------------------------------------------*/
145/*                       Definition of Basic Types                      */
146/*----------------------------------------------------------------------*/
147
148#ifndef FALSE
149#define FALSE (0)
150#endif
151#ifndef TRUE
152#define TRUE (1)
153#endif
154#ifndef NULL
155#define NULL (0L)
156#endif
157
158typedef unsigned char NPBool;
159typedef int16_t       NPError;
160typedef int16_t       NPReason;
161typedef char*         NPMIMEType;
162
163/*----------------------------------------------------------------------*/
164/*                       Structures and definitions                     */
165/*----------------------------------------------------------------------*/
166
167#if !defined(__LP64__)
168#if defined(XP_MACOSX)
169#pragma options align=mac68k
170#endif
171#endif /* __LP64__ */
172
173/*
174 *  NPP is a plug-in's opaque instance handle
175 */
176typedef struct _NPP
177{
178  void* pdata;      /* plug-in private data */
179  void* ndata;      /* netscape private data */
180} NPP_t;
181
182typedef NPP_t*  NPP;
183
184typedef struct _NPStream
185{
186  void*    pdata; /* plug-in private data */
187  void*    ndata; /* netscape private data */
188  const    char* url;
189  uint32_t end;
190  uint32_t lastmodified;
191  void*    notifyData;
192  const    char* headers; /* Response headers from host.
193                           * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
194                           * Used for HTTP only; NULL for non-HTTP.
195                           * Available from NPP_NewStream onwards.
196                           * Plugin should copy this data before storing it.
197                           * Includes HTTP status line and all headers,
198                           * preferably verbatim as received from server,
199                           * headers formatted as in HTTP ("Header: Value"),
200                           * and newlines (\n, NOT \r\n) separating lines.
201                           * Terminated by \n\0 (NOT \n\n\0). */
202} NPStream;
203
204typedef struct _NPByteRange
205{
206  int32_t  offset; /* negative offset means from the end */
207  uint32_t length;
208  struct _NPByteRange* next;
209} NPByteRange;
210
211typedef struct _NPSavedData
212{
213  int32_t len;
214  void*   buf;
215} NPSavedData;
216
217typedef struct _NPRect
218{
219  uint16_t top;
220  uint16_t left;
221  uint16_t bottom;
222  uint16_t right;
223} NPRect;
224
225typedef struct _NPSize
226{
227  int32_t width;
228  int32_t height;
229} NPSize;
230
231typedef enum {
232  NPFocusNext = 0,
233  NPFocusPrevious = 1
234} NPFocusDirection;
235
236/* Return values for NPP_HandleEvent */
237#define kNPEventNotHandled 0
238#define kNPEventHandled 1
239/* Exact meaning must be spec'd in event model. */
240#define kNPEventStartIME 2
241
242#if defined(XP_UNIX)
243/*
244 * Unix specific structures and definitions
245 */
246
247/*
248 * Callback Structures.
249 *
250 * These are used to pass additional platform specific information.
251 */
252enum {
253  NP_SETWINDOW = 1,
254  NP_PRINT
255};
256
257typedef struct
258{
259  int32_t type;
260} NPAnyCallbackStruct;
261
262typedef struct
263{
264  int32_t      type;
265#if defined(MOZ_X11)
266  Display*     display;
267  Visual*      visual;
268  Colormap     colormap;
269  unsigned int depth;
270#endif
271} NPSetWindowCallbackStruct;
272
273typedef struct
274{
275  int32_t type;
276  FILE* fp;
277} NPPrintCallbackStruct;
278
279#endif /* XP_UNIX */
280
281#if defined(XP_MACOSX)
282typedef enum {
283#ifndef NP_NO_QUICKDRAW
284  NPDrawingModelQuickDraw = 0,
285#endif
286  NPDrawingModelCoreGraphics = 1,
287  NPDrawingModelOpenGL = 2,
288  NPDrawingModelCoreAnimation = 3
289} NPDrawingModel;
290
291typedef enum {
292#ifndef NP_NO_CARBON
293  NPEventModelCarbon = 0,
294#endif
295  NPEventModelCocoa = 1
296} NPEventModel;
297#endif
298
299/*
300 *   The following masks are applied on certain platforms to NPNV and
301 *   NPPV selectors that pass around pointers to COM interfaces. Newer
302 *   compilers on some platforms may generate vtables that are not
303 *   compatible with older compilers. To prevent older plugins from
304 *   not understanding a new browser's ABI, these masks change the
305 *   values of those selectors on those platforms. To remain backwards
306 *   compatible with different versions of the browser, plugins can
307 *   use these masks to dynamically determine and use the correct C++
308 *   ABI that the browser is expecting. This does not apply to Windows
309 *   as Microsoft's COM ABI will likely not change.
310 */
311
312#define NP_ABI_GCC3_MASK  0x10000000
313/*
314 *   gcc 3.x generated vtables on UNIX and OSX are incompatible with
315 *   previous compilers.
316 */
317#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
318#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
319#else
320#define _NP_ABI_MIXIN_FOR_GCC3 0
321#endif
322
323#if defined(XP_MACOSX)
324#define NP_ABI_MACHO_MASK 0x01000000
325#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
326#else
327#define _NP_ABI_MIXIN_FOR_MACHO 0
328#endif
329
330#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
331
332/*
333 * List of variable names for which NPP_GetValue shall be implemented
334 */
335typedef enum {
336  NPPVpluginNameString = 1,
337  NPPVpluginDescriptionString,
338  NPPVpluginWindowBool,
339  NPPVpluginTransparentBool,
340  NPPVjavaClass,                /* Not implemented in WebKit */
341  NPPVpluginWindowSize,         /* Not implemented in WebKit */
342  NPPVpluginTimerInterval,      /* Not implemented in WebKit */
343  NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */
344  NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */
345  NPPVjavascriptPushCallerBool = 12,  /* Not implemented in WebKit */
346  NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */
347  NPPVpluginNeedsXEmbed         = 14, /* Not implemented in WebKit */
348
349  /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
350   */
351  NPPVpluginScriptableNPObject  = 15,
352
353  /* Get the plugin value (as \0-terminated UTF-8 string data) for
354   * form submission if the plugin is part of a form. Use
355   * NPN_MemAlloc() to allocate memory for the string data. Introduced
356   * in NPAPI minor version 15.
357   */
358  NPPVformValue = 16,    /* Not implemented in WebKit */
359
360  NPPVpluginUrlRequestsDisplayedBool = 17, /* Not implemented in WebKit */
361
362  /* Checks if the plugin is interested in receiving the http body of
363   * all http requests (including failed ones, http status != 200).
364   */
365  NPPVpluginWantsAllNetworkStreams = 18,
366
367  /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
368  NPPVpluginNativeAccessibleAtkPlugId = 19,
369
370  /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
371  NPPVpluginCancelSrcStream = 20
372
373#if defined(XP_MACOSX)
374  /* Used for negotiating drawing models */
375  , NPPVpluginDrawingModel = 1000
376  /* Used for negotiating event models */
377  , NPPVpluginEventModel = 1001
378  /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
379  , NPPVpluginCoreAnimationLayer = 1003
380#endif
381
382} NPPVariable;
383
384/*
385 * List of variable names for which NPN_GetValue should be implemented.
386 */
387typedef enum {
388  NPNVxDisplay = 1,
389  NPNVxtAppContext,
390  NPNVnetscapeWindow,
391  NPNVjavascriptEnabledBool,
392  NPNVasdEnabledBool,
393  NPNVisOfflineBool,
394
395  NPNVserviceManager = (10 | NP_ABI_MASK),  /* Not implemented in WebKit */
396  NPNVDOMElement     = (11 | NP_ABI_MASK),  /* Not implemented in WebKit */
397  NPNVDOMWindow      = (12 | NP_ABI_MASK),  /* Not implemented in WebKit */
398  NPNVToolkit        = (13 | NP_ABI_MASK),  /* Not implemented in WebKit */
399  NPNVSupportsXEmbedBool = 14,              /* Not implemented in WebKit */
400
401  /* Get the NPObject wrapper for the browser window. */
402  NPNVWindowNPObject = 15,
403
404  /* Get the NPObject wrapper for the plugins DOM element. */
405  NPNVPluginElementNPObject = 16,
406
407  NPNVSupportsWindowless = 17,
408
409  NPNVprivateModeBool = 18,
410
411  NPNVsupportsAdvancedKeyHandling = 21
412
413#if defined(XP_MACOSX)
414  /* Used for negotiating drawing models */
415  , NPNVpluginDrawingModel = 1000
416  , NPNVcontentsScaleFactor = 1001
417#ifndef NP_NO_QUICKDRAW
418  , NPNVsupportsQuickDrawBool = 2000
419#endif
420  , NPNVsupportsCoreGraphicsBool = 2001
421  , NPNVsupportsOpenGLBool = 2002
422  , NPNVsupportsCoreAnimationBool = 2003
423#ifndef NP_NO_CARBON
424  , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
425#endif
426  , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
427  , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
428                                                    Cocoa text input specification. */
429  , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
430                                                               CA model compositing */
431#endif /* XP_MACOSX */
432} NPNVariable;
433
434typedef enum {
435  NPNURLVCookie = 501,
436  NPNURLVProxy
437} NPNURLVariable;
438
439/*
440 * The type of Toolkit the widgets use
441 */
442typedef enum {
443  NPNVGtk12 = 1,
444  NPNVGtk2
445} NPNToolkitType;
446
447/*
448 * The type of a NPWindow - it specifies the type of the data structure
449 * returned in the window field.
450 */
451typedef enum {
452  NPWindowTypeWindow = 1,
453  NPWindowTypeDrawable
454} NPWindowType;
455
456typedef struct _NPWindow
457{
458  void* window;  /* Platform specific window handle */
459                 /* OS/2: x - Position of bottom left corner */
460                 /* OS/2: y - relative to visible netscape window */
461  int32_t  x;      /* Position of top left corner relative */
462  int32_t  y;      /* to a netscape page. */
463  uint32_t width;  /* Maximum window size */
464  uint32_t height;
465  NPRect   clipRect; /* Clipping rectangle in port coordinates */
466#if defined(XP_UNIX)
467  void * ws_info; /* Platform-dependent additonal data */
468#endif /* XP_UNIX */
469  NPWindowType type; /* Is this a window or a drawable? */
470} NPWindow;
471
472typedef struct _NPFullPrint
473{
474  NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
475  NPBool printOne;     /* TRUE if plugin should print one copy to default
476                          printer */
477  void* platformPrint; /* Platform-specific printing info */
478} NPFullPrint;
479
480typedef struct _NPEmbedPrint
481{
482  NPWindow window;
483  void* platformPrint; /* Platform-specific printing info */
484} NPEmbedPrint;
485
486typedef struct _NPPrint
487{
488  uint16_t mode;               /* NP_FULL or NP_EMBED */
489  union
490  {
491    NPFullPrint fullPrint;   /* if mode is NP_FULL */
492    NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
493  } print;
494} NPPrint;
495
496#if defined(XP_MACOSX)
497#ifndef NP_NO_CARBON
498typedef EventRecord NPEvent;
499#else
500typedef void*  NPEvent;
501#endif
502#elif defined(XP_WIN)
503typedef struct _NPEvent
504{
505  uint16_t event;
506  uintptr_t wParam;
507  uintptr_t lParam;
508} NPEvent;
509#elif defined(XP_OS2)
510typedef struct _NPEvent
511{
512  uint32_t event;
513  uint32_t wParam;
514  uint32_t lParam;
515} NPEvent;
516#elif defined(XP_UNIX) && defined(MOZ_X11)
517typedef XEvent NPEvent;
518#else
519typedef void*  NPEvent;
520#endif
521
522#if defined(XP_MACOSX)
523typedef void* NPRegion;
524#ifndef NP_NO_QUICKDRAW
525typedef RgnHandle NPQDRegion;
526#endif
527typedef CGPathRef NPCGRegion;
528#elif defined(XP_WIN)
529typedef HRGN NPRegion;
530#elif defined(XP_UNIX) && defined(MOZ_X11)
531typedef Region NPRegion;
532#else
533typedef void *NPRegion;
534#endif
535
536typedef struct _NPNSString NPNSString;
537typedef struct _NPNSWindow NPNSWindow;
538typedef struct _NPNSMenu   NPNSMenu;
539
540#if defined(XP_MACOSX)
541typedef NPNSMenu NPMenu;
542#else
543typedef void *NPMenu;
544#endif
545
546typedef enum {
547  NPCoordinateSpacePlugin = 1,
548  NPCoordinateSpaceWindow,
549  NPCoordinateSpaceFlippedWindow,
550  NPCoordinateSpaceScreen,
551  NPCoordinateSpaceFlippedScreen
552} NPCoordinateSpace;
553
554#if defined(XP_MACOSX)
555
556#ifndef NP_NO_QUICKDRAW
557typedef struct NP_Port
558{
559  CGrafPtr port;
560  int32_t portx; /* position inside the topmost window */
561  int32_t porty;
562} NP_Port;
563#endif /* NP_NO_QUICKDRAW */
564
565/*
566 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
567 * as its drawing model.
568 */
569
570typedef struct NP_CGContext
571{
572  CGContextRef context;
573#ifdef NP_NO_CARBON
574  NPNSWindow *window;
575#else
576  void *window; /* A WindowRef or NULL for the Cocoa event model. */
577#endif
578} NP_CGContext;
579
580/*
581 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
582 * drawing model.
583 */
584
585typedef struct NP_GLContext
586{
587  CGLContextObj context;
588#ifdef NP_NO_CARBON
589  NPNSWindow *window;
590#else
591  void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
592#endif
593} NP_GLContext;
594
595typedef enum {
596  NPCocoaEventDrawRect = 1,
597  NPCocoaEventMouseDown,
598  NPCocoaEventMouseUp,
599  NPCocoaEventMouseMoved,
600  NPCocoaEventMouseEntered,
601  NPCocoaEventMouseExited,
602  NPCocoaEventMouseDragged,
603  NPCocoaEventKeyDown,
604  NPCocoaEventKeyUp,
605  NPCocoaEventFlagsChanged,
606  NPCocoaEventFocusChanged,
607  NPCocoaEventWindowFocusChanged,
608  NPCocoaEventScrollWheel,
609  NPCocoaEventTextInput
610} NPCocoaEventType;
611
612typedef struct _NPCocoaEvent {
613  NPCocoaEventType type;
614  uint32_t version;
615  union {
616    struct {
617      uint32_t modifierFlags;
618      double   pluginX;
619      double   pluginY;
620      int32_t  buttonNumber;
621      int32_t  clickCount;
622      double   deltaX;
623      double   deltaY;
624      double   deltaZ;
625    } mouse;
626    struct {
627      uint32_t    modifierFlags;
628      NPNSString *characters;
629      NPNSString *charactersIgnoringModifiers;
630      NPBool      isARepeat;
631      uint16_t    keyCode;
632    } key;
633    struct {
634      CGContextRef context;
635      double x;
636      double y;
637      double width;
638      double height;
639    } draw;
640    struct {
641      NPBool hasFocus;
642    } focus;
643    struct {
644      NPNSString *text;
645    } text;
646  } data;
647} NPCocoaEvent;
648
649#ifndef NP_NO_CARBON
650/* Non-standard event types that can be passed to HandleEvent */
651enum NPEventType {
652  NPEventType_GetFocusEvent = (osEvt + 16),
653  NPEventType_LoseFocusEvent,
654  NPEventType_AdjustCursorEvent,
655  NPEventType_MenuCommandEvent,
656  NPEventType_ClippingChangedEvent,
657  NPEventType_ScrollingBeginsEvent = 1000,
658  NPEventType_ScrollingEndsEvent
659};
660#endif /* NP_NO_CARBON */
661
662#endif /* XP_MACOSX */
663
664/*
665 * Values for mode passed to NPP_New:
666 */
667#define NP_EMBED 1
668#define NP_FULL  2
669
670/*
671 * Values for stream type passed to NPP_NewStream:
672 */
673#define NP_NORMAL     1
674#define NP_SEEK       2
675#define NP_ASFILE     3
676#define NP_ASFILEONLY 4
677
678#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
679
680/*
681 * Flags for NPP_ClearSiteData.
682 */
683#define NP_CLEAR_ALL   0
684#define NP_CLEAR_CACHE (1 << 0)
685
686#if !defined(__LP64__)
687#if defined(XP_MACOSX)
688#pragma options align=reset
689#endif
690#endif /* __LP64__ */
691
692/*----------------------------------------------------------------------*/
693/*       Error and Reason Code definitions                              */
694/*----------------------------------------------------------------------*/
695
696/*
697 * Values of type NPError:
698 */
699#define NPERR_BASE                         0
700#define NPERR_NO_ERROR                    (NPERR_BASE + 0)
701#define NPERR_GENERIC_ERROR               (NPERR_BASE + 1)
702#define NPERR_INVALID_INSTANCE_ERROR      (NPERR_BASE + 2)
703#define NPERR_INVALID_FUNCTABLE_ERROR     (NPERR_BASE + 3)
704#define NPERR_MODULE_LOAD_FAILED_ERROR    (NPERR_BASE + 4)
705#define NPERR_OUT_OF_MEMORY_ERROR         (NPERR_BASE + 5)
706#define NPERR_INVALID_PLUGIN_ERROR        (NPERR_BASE + 6)
707#define NPERR_INVALID_PLUGIN_DIR_ERROR    (NPERR_BASE + 7)
708#define NPERR_INCOMPATIBLE_VERSION_ERROR  (NPERR_BASE + 8)
709#define NPERR_INVALID_PARAM               (NPERR_BASE + 9)
710#define NPERR_INVALID_URL                 (NPERR_BASE + 10)
711#define NPERR_FILE_NOT_FOUND              (NPERR_BASE + 11)
712#define NPERR_NO_DATA                     (NPERR_BASE + 12)
713#define NPERR_STREAM_NOT_SEEKABLE         (NPERR_BASE + 13)
714
715/*
716 * Values of type NPReason:
717 */
718#define NPRES_BASE          0
719#define NPRES_DONE         (NPRES_BASE + 0)
720#define NPRES_NETWORK_ERR  (NPRES_BASE + 1)
721#define NPRES_USER_BREAK   (NPRES_BASE + 2)
722
723/*
724 * Don't use these obsolete error codes any more.
725 */
726#define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
727#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
728#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
729
730/*
731 * Version feature information
732 */
733#define NPVERS_HAS_STREAMOUTPUT             8
734#define NPVERS_HAS_NOTIFICATION             9
735#define NPVERS_HAS_LIVECONNECT              9
736#define NPVERS_WIN16_HAS_LIVECONNECT        9
737#define NPVERS_68K_HAS_LIVECONNECT          11
738#define NPVERS_HAS_WINDOWLESS               11
739#define NPVERS_HAS_XPCONNECT_SCRIPTING      13  /* Not implemented in WebKit */
740#define NPVERS_HAS_NPRUNTIME_SCRIPTING      14
741#define NPVERS_HAS_FORM_VALUES              15  /* Not implemented in WebKit; see bug 13061 */
742#define NPVERS_HAS_POPUPS_ENABLED_STATE     16  /* Not implemented in WebKit */
743#define NPVERS_HAS_RESPONSE_HEADERS         17
744#define NPVERS_HAS_NPOBJECT_ENUM            18
745#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
746#define NPVERS_HAS_ALL_NETWORK_STREAMS      20
747#define NPVERS_HAS_URL_AND_AUTH_INFO        21
748#define NPVERS_HAS_PRIVATE_MODE             22
749#define NPVERS_MACOSX_HAS_EVENT_MODELS      23
750#define NPVERS_HAS_CANCEL_SRC_STREAM        24
751#define NPVERS_HAS_ADVANCED_KEY_HANDLING    25
752#define NPVERS_HAS_URL_REDIRECT_HANDLING    26
753#define NPVERS_HAS_CLEAR_SITE_DATA          27
754
755/*----------------------------------------------------------------------*/
756/*                        Function Prototypes                           */
757/*----------------------------------------------------------------------*/
758
759#if defined(__OS2__)
760#define NP_LOADDS _System
761#else
762#define NP_LOADDS
763#endif
764
765#ifdef __cplusplus
766extern "C" {
767#endif
768
769/* NPP_* functions are provided by the plugin and called by the navigator. */
770
771#if defined(XP_UNIX)
772const char* NPP_GetMIMEDescription(void);
773#endif
774
775NPError NP_LOADDS NPP_Initialize(void);
776void    NP_LOADDS NPP_Shutdown(void);
777NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
778                          uint16_t mode, int16_t argc, char* argn[],
779                          char* argv[], NPSavedData* saved);
780NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
781NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
782NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
783                                NPStream* stream, NPBool seekable,
784                                uint16_t* stype);
785NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
786                                    NPReason reason);
787int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
788int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
789                            int32_t len, void* buffer);
790void    NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
791                                   const char* fname);
792void    NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
793int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
794void    NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
795                                NPReason reason, void* notifyData);
796jref    NP_LOADDS NPP_GetJavaClass(void);
797NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
798NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
799NPBool  NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
800void    NP_LOADDS NPP_LostFocus(NPP instance);
801void    NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
802NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
803char**  NP_LOADDS NPP_GetSitesWithData(void);
804
805/* NPN_* functions are provided by the navigator and called by the plugin. */
806void        NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
807                                  int* netscape_major, int* netscape_minor);
808NPError     NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
809                                       const char* target, void* notifyData);
810NPError     NP_LOADDS NPN_GetURL(NPP instance, const char* url,
811                                 const char* target);
812NPError     NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
813                                        const char* target, uint32_t len,
814                                        const char* buf, NPBool file,
815                                        void* notifyData);
816NPError     NP_LOADDS NPN_PostURL(NPP instance, const char* url,
817                                  const char* target, uint32_t len,
818                                  const char* buf, NPBool file);
819NPError     NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
820NPError     NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
821                                    const char* target, NPStream** stream);
822int32_t     NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
823                                void* buffer);
824NPError     NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
825                                        NPReason reason);
826void        NP_LOADDS NPN_Status(NPP instance, const char* message);
827const char* NP_LOADDS NPN_UserAgent(NPP instance);
828void*       NP_LOADDS NPN_MemAlloc(uint32_t size);
829void        NP_LOADDS NPN_MemFree(void* ptr);
830uint32_t    NP_LOADDS NPN_MemFlush(uint32_t size);
831void        NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
832JRIEnv*     NP_LOADDS NPN_GetJavaEnv(void);
833jref        NP_LOADDS NPN_GetJavaPeer(NPP instance);
834NPError     NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
835                                   void *value);
836NPError     NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
837                                   void *value);
838void        NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
839void        NP_LOADDS NPN_InvalidateRegion(NPP instance,
840                                           NPRegion invalidRegion);
841void        NP_LOADDS NPN_ForceRedraw(NPP instance);
842void        NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
843void        NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
844void        NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
845                                                void (*func) (void *),
846                                                void *userData);
847NPError     NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
848                                         const char *url, char **value,
849                                         uint32_t *len);
850NPError     NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
851                                         const char *url, const char *value,
852                                         uint32_t len);
853NPError     NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
854                                                const char *protocol,
855                                                const char *host, int32_t port,
856                                                const char *scheme,
857                                                const char *realm,
858                                                char **username, uint32_t *ulen,
859                                                char **password,
860                                                uint32_t *plen);
861uint32_t    NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
862void        NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
863NPError     NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
864NPBool      NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
865
866#ifdef __cplusplus
867}  /* end extern "C" */
868#endif
869
870#endif /* RC_INVOKED */
871#if defined(__OS2__)
872#pragma pack()
873#endif
874
875#endif /* npapi_h_ */
876