1 //krazy:excludeall=license,captruefalse,copyright
2 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* ***** BEGIN LICENSE BLOCK *****
4 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Netscape Public License
7 * Version 1.1 (the "License"); you may not use this file except in
8 * compliance with the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/NPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the NPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the NPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
42 * Netscape client plug-in API spec
53 /* Copied from xp_core.h */
54 /* removed #ifdef for hpux defined in /usr/include/model.h */
71 * NO_NSPR_10_SUPPORT disables the inclusion
72 * of obsolete/protypes.h, whose int16, uint16,
73 * int32, and uint32 typedefs conflict with those
76 #ifndef NO_NSPR_10_SUPPORT
77 #define NO_NSPR_10_SUPPORT
80 #include "jri.h" /* Java Runtime Interface */
83 #if defined (__OS2__ ) || defined (OS2)
97 # define _declspec __declspec
102 # endif /* macintosh */
108 # endif /* __INTEL__ */
109 #endif /* __MWERKS__ */
111 #if defined(XP_MAC) || defined(XP_MACOSX)
112 #include <Quickdraw.h>
118 # if defined(MOZ_X11)
119 # include <X11/Xlib.h>
120 # include <X11/Xutil.h>
124 /*----------------------------------------------------------------------*/
125 /* Plugin Version Constants */
126 /*----------------------------------------------------------------------*/
128 #define NP_VERSION_MAJOR 0
129 #define NP_VERSION_MINOR 13
132 /* The OS/2 version of Netscape uses RC_DATA to define the
133 mime types, file extensions, etc that are required.
134 Use a vertical bar to separate types, end types with \0.
135 FileVersion and ProductVersion are 32bit ints, all other
136 entries are strings the MUST be terminated wwith a \0.
140 RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
142 RCDATA NP_INFO_MIMEType { "video/x-video|",
144 RCDATA NP_INFO_FileExtents { "avi|",
146 RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
147 "MMOS2 Flc/Fli player(*.flc)\0" }
149 RCDATA NP_INFO_FileVersion { 1,0,0,1 }
150 RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
151 RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
152 RCDATA NP_INFO_InternalName { "NPAVI32\0" )
153 RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
154 RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
155 RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
160 /* RC_DATA types for version info - required */
161 #define NP_INFO_ProductVersion 1
162 #define NP_INFO_MIMEType 2
163 #define NP_INFO_FileOpenName 3
164 #define NP_INFO_FileExtents 4
166 /* RC_DATA types for version info - used if found */
167 #define NP_INFO_FileDescription 5
168 #define NP_INFO_ProductName 6
170 /* RC_DATA types for version info - optional */
171 #define NP_INFO_CompanyName 7
172 #define NP_INFO_FileVersion 8
173 #define NP_INFO_InternalName 9
174 #define NP_INFO_LegalCopyright 10
175 #define NP_INFO_OriginalFilename 11
181 /*----------------------------------------------------------------------*/
182 /* Definition of Basic Types */
183 /*----------------------------------------------------------------------*/
186 typedef unsigned short uint16
;
190 # if defined(__alpha) || defined(_AIX) || defined(__x86_64__) || defined(__LP64__) || defined(__amd64__)
191 typedef unsigned int uint32
;
193 typedef unsigned long uint32
;
198 * AIX defines these in sys/inttypes.h included from sys/types.h
206 # if defined(__alpha) || defined(_AIX) || defined(__x86_64__) || defined(__LP64__) || defined(__amd64__)
224 typedef unsigned char NPBool
;
225 typedef int16 NPError
;
226 typedef int16 NPReason
;
227 typedef char* NPMIMEType
;
231 /*----------------------------------------------------------------------*/
232 /* Structures and definitions */
233 /*----------------------------------------------------------------------*/
236 #pragma options align=mac68k
240 * NPP is a plug-in's opaque instance handle
244 void* pdata
; /* plug-in private data */
245 void* ndata
; /* netscape private data */
251 typedef struct _NPStream
253 void* pdata
; /* plug-in private data */
254 void* ndata
; /* netscape private data */
262 typedef struct _NPByteRange
264 int32 offset
; /* negative offset means from the end */
266 struct _NPByteRange
* next
;
270 typedef struct _NPSavedData
277 typedef struct _NPRect
285 typedef struct _NPSize
293 * Unix specific structures and definitions
297 * Callback Structures.
299 * These are used to pass additional platform specific information.
309 } NPAnyCallbackStruct
;
320 } NPSetWindowCallbackStruct
;
326 } NPPrintCallbackStruct
;
332 * The following masks are applied on certain platforms to NPNV and
333 * NPPV selectors that pass around pointers to COM interfaces. Newer
334 * compilers on some platforms may generate vtables that are not
335 * compatible with older compilers. To prevent older plugins from
336 * not understanding a new browser's ABI, these masks change the
337 * values of those selectors on those platforms. To remain backwards
338 * compatible with differenet versions of the browser, plugins can
339 * use these masks to dynamically determine and use the correct C++
340 * ABI that the browser is expecting. This does not apply to Windows
341 * as Microsoft's COM ABI will likely not change.
344 #define NP_ABI_GCC3_MASK 0x10000000
346 * gcc 3.x generated vtables on UNIX and OSX are incompatible with
347 * previous compilers.
349 #if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
350 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
352 #define _NP_ABI_MIXIN_FOR_GCC3 0
355 #define NP_ABI_SS12_MASK 0x20000000
357 * Sun Studio 12 has its own set of ABI problems.
359 #if (defined(__SUNPRO_CC))
360 #define _NP_ABI_MIXIN_FOR_SS12 NP_ABI_SS12_MASK
362 #define _NP_ABI_MIXIN_FOR_SS12 0
366 #define NP_ABI_MACHO_MASK 0x01000000
368 * On OSX, the Mach-O executable format is significantly
369 * different than CFM. In addition to having a different
370 * C++ ABI, it also has has different C calling convention.
371 * You must use glue code when calling between CFM and
372 * Mach-O C functions.
374 #if (defined(TARGET_RT_MAC_MACHO))
375 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
377 #define _NP_ABI_MIXIN_FOR_MACHO 0
380 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_SS12 | _NP_ABI_MIXIN_FOR_MACHO)
383 * List of variable names for which NPP_GetValue shall be implemented
386 NPPVpluginNameString
= 1,
387 NPPVpluginDescriptionString
,
388 NPPVpluginWindowBool
,
389 NPPVpluginTransparentBool
,
390 NPPVjavaClass
, /* Not implemented in Mozilla 1.0 */
391 NPPVpluginWindowSize
,
392 NPPVpluginTimerInterval
,
394 NPPVpluginScriptableInstance
= (10 | NP_ABI_MASK
),
395 NPPVpluginScriptableIID
= 11,
397 /* 12 and over are available on Mozilla builds starting with 0.9.9 */
398 NPPVjavascriptPushCallerBool
= 12,
399 NPPVpluginKeepLibraryInMemory
= 13, /* available in Mozilla 1.0 */
400 NPPVpluginNeedsXEmbed
= 14
404 * List of variable names for which NPN_GetValue is implemented by Mozilla
410 NPNVjavascriptEnabledBool
,
414 /* 10 and over are available on Mozilla builds starting with 0.9.4 */
415 NPNVserviceManager
= (10 | NP_ABI_MASK
),
416 NPNVDOMElement
= (11 | NP_ABI_MASK
), /* available in Mozilla 1.2 */
417 NPNVDOMWindow
= (12 | NP_ABI_MASK
),
418 NPNVToolkit
= (13 | NP_ABI_MASK
),
419 NPNVSupportsXEmbedBool
= 14
423 * The type of Tookkit the widgets use
431 * The type of a NPWindow - it specifies the type of the data structure
432 * returned in the window field.
435 NPWindowTypeWindow
= 1,
439 typedef struct _NPWindow
441 void* window
; /* Platform specific window handle */
442 /* OS/2: x - Position of bottom left corner */
443 /* OS/2: y - relative to visible netscape window */
444 int32 x
; /* Position of top left corner relative */
445 int32 y
; /* to a netscape page. */
446 uint32 width
; /* Maximum window size */
448 NPRect clipRect
; /* Clipping rectangle in port coordinates */
449 /* Used by MAC only. */
450 #if defined(XP_UNIX) && !defined(XP_MACOSX)
451 void * ws_info
; /* Platform-dependent additional data */
453 NPWindowType type
; /* Is this a window or a drawable? */
457 typedef struct _NPFullPrint
459 NPBool pluginPrinted
;/* Set TRUE if plugin handled fullscreen printing */
460 NPBool printOne
; /* TRUE if plugin should print one copy to default printer */
461 void* platformPrint
; /* Platform-specific printing info */
464 typedef struct _NPEmbedPrint
467 void* platformPrint
; /* Platform-specific printing info */
470 typedef struct _NPPrint
472 uint16 mode
; /* NP_FULL or NP_EMBED */
475 NPFullPrint fullPrint
; /* if mode is NP_FULL */
476 NPEmbedPrint embedPrint
; /* if mode is NP_EMBED */
480 #if defined(XP_MAC) || defined(XP_MACOSX)
481 typedef EventRecord NPEvent
;
482 #elif defined(XP_WIN)
483 typedef struct _NPEvent
489 #elif defined(XP_OS2)
490 typedef struct _NPEvent
496 #elif defined (XP_UNIX) && defined(MOZ_X11)
497 typedef XEvent NPEvent
;
499 typedef void* NPEvent
;
502 #if defined(XP_MAC) || defined(XP_MACOSX)
503 typedef RgnHandle NPRegion
;
504 #elif defined(XP_WIN)
505 typedef HRGN NPRegion
;
506 #elif defined(XP_UNIX) && defined(MOZ_X11)
507 typedef Region NPRegion
;
509 typedef void *NPRegion
;
512 #if defined(XP_MAC) || defined(XP_MACOSX)
514 * Mac-specific structures and definitions.
517 typedef struct NP_Port
519 CGrafPtr port
; /* Grafport */
520 int32 portx
; /* position inside the topmost window */
525 * Non-standard event types that can be passed to HandleEvent
529 NPEventType_GetFocusEvent
= (osEvt
+ 16),
530 NPEventType_LoseFocusEvent
,
531 NPEventType_AdjustCursorEvent
,
532 NPEventType_MenuCommandEvent
,
533 NPEventType_ClippingChangedEvent
,
534 NPEventType_ScrollingBeginsEvent
= 1000,
535 NPEventType_ScrollingEndsEvent
539 #define getFocusEvent (osEvt + 16)
540 #define loseFocusEvent (osEvt + 17)
541 #define adjustCursorEvent (osEvt + 18)
546 * Values for mode passed to NPP_New:
552 * Values for stream type passed to NPP_NewStream:
557 #define NP_ASFILEONLY 4
559 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
562 #pragma options align=reset
566 /*----------------------------------------------------------------------*/
567 /* Error and Reason Code definitions */
568 /*----------------------------------------------------------------------*/
571 * Values of type NPError:
574 #define NPERR_NO_ERROR (NPERR_BASE + 0)
575 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
576 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
577 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
578 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
579 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
580 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
581 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
582 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
583 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
584 #define NPERR_INVALID_URL (NPERR_BASE + 10)
585 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
586 #define NPERR_NO_DATA (NPERR_BASE + 12)
587 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
590 * Values of type NPReason:
593 #define NPRES_DONE (NPRES_BASE + 0)
594 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
595 #define NPRES_USER_BREAK (NPRES_BASE + 2)
598 * Don't use these obsolete error codes any more.
600 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
601 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
602 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
605 * Version feature information
607 #define NPVERS_HAS_STREAMOUTPUT 8
608 #define NPVERS_HAS_NOTIFICATION 9
609 #define NPVERS_HAS_LIVECONNECT 9
610 #define NPVERS_WIN16_HAS_LIVECONNECT 9
611 #define NPVERS_68K_HAS_LIVECONNECT 11
612 #define NPVERS_HAS_WINDOWLESS 11
613 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
615 /*----------------------------------------------------------------------*/
616 /* Function Prototypes */
617 /*----------------------------------------------------------------------*/
619 #if defined(_WINDOWS) && !defined(WIN32)
620 #define NP_LOADDS _loadds
623 #define NP_LOADDS _System
634 * NPP_* functions are provided by the plugin and called by the navigator.
638 char* NPP_GetMIMEDescription(void);
641 NPError NP_LOADDS
NPP_Initialize(void);
642 void NP_LOADDS
NPP_Shutdown(void);
643 NPError NP_LOADDS
NPP_New(NPMIMEType pluginType
, NPP instance
,
644 uint16 mode
, int16 argc
, char* argn
[],
645 char* argv
[], NPSavedData
* saved
);
646 NPError NP_LOADDS
NPP_Destroy(NPP instance
, NPSavedData
** save
);
647 NPError NP_LOADDS
NPP_SetWindow(NPP instance
, NPWindow
* window
);
648 NPError NP_LOADDS
NPP_NewStream(NPP instance
, NPMIMEType type
,
649 NPStream
* stream
, NPBool seekable
,
651 NPError NP_LOADDS
NPP_DestroyStream(NPP instance
, NPStream
* stream
,
653 int32 NP_LOADDS
NPP_WriteReady(NPP instance
, NPStream
* stream
);
654 int32 NP_LOADDS
NPP_Write(NPP instance
, NPStream
* stream
, int32 offset
,
655 int32 len
, void* buffer
);
656 void NP_LOADDS
NPP_StreamAsFile(NPP instance
, NPStream
* stream
,
658 void NP_LOADDS
NPP_Print(NPP instance
, NPPrint
* platformPrint
);
659 int16 NP_LOADDS
NPP_HandleEvent(NPP instance
, void* event
);
660 void NP_LOADDS
NPP_URLNotify(NPP instance
, const char* url
,
661 NPReason reason
, void* notifyData
);
663 jref NP_LOADDS
NPP_GetJavaClass(void);
665 NPError NP_LOADDS
NPP_GetValue(NPP instance
, NPPVariable variable
, void *value
);
666 NPError NP_LOADDS
NPP_SetValue(NPP instance
, NPNVariable variable
, void *value
);
669 * NPN_* functions are provided by the navigator and called by the plugin.
671 void NP_LOADDS
NPN_Version(int* plugin_major
, int* plugin_minor
,
672 int* netscape_major
, int* netscape_minor
);
673 NPError NP_LOADDS
NPN_GetURLNotify(NPP instance
, const char* url
,
674 const char* target
, void* notifyData
);
675 NPError NP_LOADDS
NPN_GetURL(NPP instance
, const char* url
,
677 NPError NP_LOADDS
NPN_PostURLNotify(NPP instance
, const char* url
,
678 const char* target
, uint32 len
,
679 const char* buf
, NPBool file
,
681 NPError NP_LOADDS
NPN_PostURL(NPP instance
, const char* url
,
682 const char* target
, uint32 len
,
683 const char* buf
, NPBool file
);
684 NPError NP_LOADDS
NPN_RequestRead(NPStream
* stream
, NPByteRange
* rangeList
);
685 NPError NP_LOADDS
NPN_NewStream(NPP instance
, NPMIMEType type
,
686 const char* target
, NPStream
** stream
);
687 int32 NP_LOADDS
NPN_Write(NPP instance
, NPStream
* stream
, int32 len
, void* buffer
);
688 NPError NP_LOADDS
NPN_DestroyStream(NPP instance
, NPStream
* stream
, NPReason reason
);
689 void NP_LOADDS
NPN_Status(NPP instance
, const char* message
);
690 const char* NP_LOADDS
NPN_UserAgent(NPP instance
);
691 void* NP_LOADDS
NPN_MemAlloc(uint32 size
);
692 void NP_LOADDS
NPN_MemFree(void* ptr
);
693 uint32 NP_LOADDS
NPN_MemFlush(uint32 size
);
694 void NP_LOADDS
NPN_ReloadPlugins(NPBool reloadPages
);
696 JRIEnv
* NP_LOADDS
NPN_GetJavaEnv(void);
697 jref NP_LOADDS
NPN_GetJavaPeer(NPP instance
);
699 NPError NP_LOADDS
NPN_GetValue(NPP instance
, NPNVariable variable
, void *value
);
700 NPError NP_LOADDS
NPN_SetValue(NPP instance
, NPPVariable variable
, void *value
);
701 void NP_LOADDS
NPN_InvalidateRect(NPP instance
, NPRect
*invalidRect
);
702 void NP_LOADDS
NPN_InvalidateRegion(NPP instance
, NPRegion invalidRegion
);
703 void NP_LOADDS
NPN_ForceRedraw(NPP instance
);
706 } /* end extern "C" */
709 #endif /* RC_INVOKED */
714 #endif /* _NPAPI_H_ */