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
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
48 #include "jri.h" /* Java Runtime Interface */
51 #if defined (__OS2__) || defined (OS2)
65 # define _declspec __declspec
71 # endif /* __INTEL__ */
72 #endif /* __MWERKS__ */
75 #include <Carbon/Carbon.h>
77 #define NP_NO_QUICKDRAW
84 # include <X11/Xlib.h>
85 # include <X11/Xutil.h>
89 /*----------------------------------------------------------------------*/
90 /* Plugin Version Constants */
91 /*----------------------------------------------------------------------*/
93 #define NP_VERSION_MAJOR 0
94 #define NP_VERSION_MINOR 21
97 /* The OS/2 version of Netscape uses RC_DATA to define the
98 mime types, file extensions, etc that are required.
99 Use a vertical bar to separate types, end types with \0.
100 FileVersion and ProductVersion are 32bit ints, all other
101 entries are strings the MUST be terminated wwith a \0.
105 RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
107 RCDATA NP_INFO_MIMEType { "video/x-video|",
109 RCDATA NP_INFO_FileExtents { "avi|",
111 RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
112 "MMOS2 Flc/Fli player(*.flc)\0" }
114 RCDATA NP_INFO_FileVersion { 1,0,0,1 }
115 RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
116 RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
117 RCDATA NP_INFO_InternalName { "NPAVI32\0" )
118 RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
119 RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
120 RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
122 /* RC_DATA types for version info - required */
123 #define NP_INFO_ProductVersion 1
124 #define NP_INFO_MIMEType 2
125 #define NP_INFO_FileOpenName 3
126 #define NP_INFO_FileExtents 4
127 /* RC_DATA types for version info - used if found */
128 #define NP_INFO_FileDescription 5
129 #define NP_INFO_ProductName 6
130 /* RC_DATA types for version info - optional */
131 #define NP_INFO_CompanyName 7
132 #define NP_INFO_FileVersion 8
133 #define NP_INFO_InternalName 9
134 #define NP_INFO_LegalCopyright 10
135 #define NP_INFO_OriginalFilename 11
139 /*----------------------------------------------------------------------*/
140 /* Definition of Basic Types */
141 /*----------------------------------------------------------------------*/
143 typedef unsigned char NPBool
;
144 typedef int16_t NPError
;
145 typedef int16_t NPReason
;
146 typedef char* NPMIMEType
;
148 /*----------------------------------------------------------------------*/
149 /* Structures and definitions */
150 /*----------------------------------------------------------------------*/
153 * NPP is a plug-in's opaque instance handle
157 void* pdata
; /* plug-in private data */
158 void* ndata
; /* netscape private data */
163 typedef struct _NPStream
165 void* pdata
; /* plug-in private data */
166 void* ndata
; /* netscape private data */
169 uint32_t lastmodified
;
171 const char* headers
; /* Response headers from host.
172 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
173 * Used for HTTP only; NULL for non-HTTP.
174 * Available from NPP_NewStream onwards.
175 * Plugin should copy this data before storing it.
176 * Includes HTTP status line and all headers,
177 * preferably verbatim as received from server,
178 * headers formatted as in HTTP ("Header: Value"),
179 * and newlines (\n, NOT \r\n) separating lines.
180 * Terminated by \n\0 (NOT \n\n\0). */
183 typedef struct _NPByteRange
185 int32_t offset
; /* negative offset means from the end */
187 struct _NPByteRange
* next
;
190 typedef struct _NPSavedData
196 typedef struct _NPRect
204 typedef struct _NPSize
212 * Unix specific structures and definitions
216 * Callback Structures.
218 * These are used to pass additional platform specific information.
228 } NPAnyCallbackStruct
;
239 } NPSetWindowCallbackStruct
;
245 } NPPrintCallbackStruct
;
251 #ifndef NP_NO_QUICKDRAW
252 NPDrawingModelQuickDraw
= 0,
254 NPDrawingModelCoreGraphics
= 1
259 * The following masks are applied on certain platforms to NPNV and
260 * NPPV selectors that pass around pointers to COM interfaces. Newer
261 * compilers on some platforms may generate vtables that are not
262 * compatible with older compilers. To prevent older plugins from
263 * not understanding a new browser's ABI, these masks change the
264 * values of those selectors on those platforms. To remain backwards
265 * compatible with differenet versions of the browser, plugins can
266 * use these masks to dynamically determine and use the correct C++
267 * ABI that the browser is expecting. This does not apply to Windows
268 * as Microsoft's COM ABI will likely not change.
271 #define NP_ABI_GCC3_MASK 0x10000000
273 * gcc 3.x generated vtables on UNIX and OSX are incompatible with
274 * previous compilers.
276 #if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
277 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
279 #define _NP_ABI_MIXIN_FOR_GCC3 0
282 #define NP_ABI_MACHO_MASK 0x01000000
284 * On OSX, the Mach-O executable format is significantly
285 * different than CFM. In addition to having a different
286 * C++ ABI, it also has has different C calling convention.
287 * You must use glue code when calling between CFM and
288 * Mach-O C functions.
290 #if (defined(TARGET_RT_MAC_MACHO))
291 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
293 #define _NP_ABI_MIXIN_FOR_MACHO 0
296 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
299 * List of variable names for which NPP_GetValue shall be implemented
302 NPPVpluginNameString
= 1,
303 NPPVpluginDescriptionString
,
304 NPPVpluginWindowBool
,
305 NPPVpluginTransparentBool
,
306 NPPVjavaClass
, /* Not implemented in Mozilla 1.0 */
307 NPPVpluginWindowSize
,
308 NPPVpluginTimerInterval
,
310 NPPVpluginScriptableInstance
= (10 | NP_ABI_MASK
),
311 NPPVpluginScriptableIID
= 11,
313 /* Introduced in Mozilla 0.9.9 */
314 NPPVjavascriptPushCallerBool
= 12,
316 /* Introduced in Mozilla 1.0 */
317 NPPVpluginKeepLibraryInMemory
= 13,
318 NPPVpluginNeedsXEmbed
= 14,
320 /* Get the NPObject for scripting the plugin. Introduced in Firefox
321 * 1.0 (NPAPI minor version 14).
323 NPPVpluginScriptableNPObject
= 15,
325 /* Get the plugin value (as \0-terminated UTF-8 string data) for
326 * form submission if the plugin is part of a form. Use
327 * NPN_MemAlloc() to allocate memory for the string data. Introduced
328 * in Mozilla 1.8b2 (NPAPI minor version 15).
332 NPPVpluginUrlRequestsDisplayedBool
= 17,
334 /* Checks if the plugin is interested in receiving the http body of
335 * all http requests (including failed ones, http status != 200).
337 NPPVpluginWantsAllNetworkStreams
= 18,
342 /* Used for negotiating drawing models */
343 , NPPVpluginDrawingModel
= 1000
348 * List of variable names for which NPN_GetValue is implemented by Mozilla
354 NPNVjavascriptEnabledBool
,
358 /* 10 and over are available on Mozilla builds starting with 0.9.4 */
359 NPNVserviceManager
= (10 | NP_ABI_MASK
),
360 NPNVDOMElement
= (11 | NP_ABI_MASK
), /* available in Mozilla 1.2 */
361 NPNVDOMWindow
= (12 | NP_ABI_MASK
),
362 NPNVToolkit
= (13 | NP_ABI_MASK
),
363 NPNVSupportsXEmbedBool
= 14,
365 /* Get the NPObject wrapper for the browser window. */
366 NPNVWindowNPObject
= 15,
368 /* Get the NPObject wrapper for the plugins DOM element. */
369 NPNVPluginElementNPObject
= 16,
371 NPNVSupportsWindowless
= 17,
373 NPNVSupportsWindowlessCursors
= 18
376 /* Used for negotiating drawing models */
377 , NPNVpluginDrawingModel
= 1000
378 #ifndef NP_NO_QUICKDRAW
379 , NPNVsupportsQuickDrawBool
= 2000
381 , NPNVsupportsCoreGraphicsBool
= 2001
386 // CSS standard cursors
388 NPCursorAllScroll
= 2,
391 NPCursorContextMenu
= 5,
393 NPCursorCrosshair
= 7,
399 NPCursorNotAllowed
= 13,
400 NPCursorPointer
= 14,
401 NPCursorProgress
= 15,
403 NPCursorVerticalText
= 17,
406 // CSS standard resize cursors
407 NPCursorColResize
= 19,
408 NPCursorEResize
= 20,
409 NPCursorEWResize
= 21,
410 NPCursorNEResize
= 22,
411 NPCursorNESWResize
= 23,
412 NPCursorNResize
= 24,
413 NPCursorNSResize
= 25,
414 NPCursorNWResize
= 26,
415 NPCursorNWSEResize
= 27,
416 NPCursorRowResize
= 28,
417 NPCursorSEResize
= 29,
418 NPCursorSResize
= 30,
419 NPCursorSWResize
= 31,
424 * The type of Tookkit the widgets use
432 * The type of a NPWindow - it specifies the type of the data structure
433 * returned in the window field.
436 NPWindowTypeWindow
= 1,
440 typedef struct _NPWindow
442 void* window
; /* Platform specific window handle */
443 /* OS/2: x - Position of bottom left corner */
444 /* OS/2: y - relative to visible netscape window */
445 int32_t x
; /* Position of top left corner relative */
446 int32_t y
; /* to a netscape page. */
447 uint32_t width
; /* Maximum window size */
449 NPRect clipRect
; /* Clipping rectangle in port coordinates */
450 /* Used by MAC only. */
451 #if defined(XP_UNIX) && !defined(XP_MACOSX)
452 void * ws_info
; /* Platform-dependent additonal data */
454 NPWindowType type
; /* Is this a window or a drawable? */
458 typedef struct _NPFullPrint
460 NPBool pluginPrinted
;/* Set TRUE if plugin handled fullscreen printing */
461 NPBool printOne
; /* TRUE if plugin should print one copy to default
463 void* platformPrint
; /* Platform-specific printing info */
466 typedef struct _NPEmbedPrint
469 void* platformPrint
; /* Platform-specific printing info */
472 typedef struct _NPPrint
474 uint16_t mode
; /* NP_FULL or NP_EMBED */
477 NPFullPrint fullPrint
; /* if mode is NP_FULL */
478 NPEmbedPrint embedPrint
; /* if mode is NP_EMBED */
483 typedef EventRecord NPEvent
;
484 #elif defined(XP_WIN)
485 typedef struct _NPEvent
491 #elif defined(XP_OS2)
492 typedef struct _NPEvent
498 #elif defined (XP_UNIX) && defined(MOZ_X11)
499 typedef XEvent NPEvent
;
501 typedef void* NPEvent
;
502 #endif /* XP_MACOSX */
506 typedef void* NPRegion
;
507 #ifndef NP_NO_QUICKDRAW
508 typedef RgnHandle NPQDRegion
;
510 typedef CGPathRef NPCGRegion
;
511 #elif defined(XP_WIN)
512 typedef HRGN NPRegion
;
513 #elif defined(XP_UNIX) && defined(MOZ_X11)
514 typedef Region NPRegion
;
516 typedef void *NPRegion
;
520 typedef struct NP_Port
523 int32_t portx
; /* position inside the topmost window */
527 typedef struct NP_CGContext
529 CGContextRef context
;
533 /* Non-standard event types that can be passed to HandleEvent */
535 NPEventType_GetFocusEvent
= (osEvt
+ 16),
536 NPEventType_LoseFocusEvent
,
537 NPEventType_AdjustCursorEvent
,
538 NPEventType_MenuCommandEvent
,
539 NPEventType_ClippingChangedEvent
,
540 NPEventType_ScrollingBeginsEvent
= 1000,
541 NPEventType_ScrollingEndsEvent
545 #define getFocusEvent (osEvt + 16)
546 #define loseFocusEvent (osEvt + 17)
547 #define adjustCursorEvent (osEvt + 18)
550 #endif /* XP_MACOSX */
553 * Values for mode passed to NPP_New:
559 * Values for stream type passed to NPP_NewStream:
564 #define NP_ASFILEONLY 4
566 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
569 /*----------------------------------------------------------------------*/
570 /* Error and Reason Code definitions */
571 /*----------------------------------------------------------------------*/
574 * Values of type NPError:
577 #define NPERR_NO_ERROR (NPERR_BASE + 0)
578 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
579 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
580 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
581 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
582 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
583 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
584 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
585 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
586 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
587 #define NPERR_INVALID_URL (NPERR_BASE + 10)
588 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
589 #define NPERR_NO_DATA (NPERR_BASE + 12)
590 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
593 * Values of type NPReason:
596 #define NPRES_DONE (NPRES_BASE + 0)
597 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
598 #define NPRES_USER_BREAK (NPRES_BASE + 2)
601 * Don't use these obsolete error codes any more.
603 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
604 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
605 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
608 * Version feature information
610 #define NPVERS_HAS_STREAMOUTPUT 8
611 #define NPVERS_HAS_NOTIFICATION 9
612 #define NPVERS_HAS_LIVECONNECT 9
613 #define NPVERS_WIN16_HAS_LIVECONNECT 9
614 #define NPVERS_68K_HAS_LIVECONNECT 11
615 #define NPVERS_HAS_WINDOWLESS 11
616 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
617 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
618 #define NPVERS_HAS_FORM_VALUES 15
619 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16
620 #define NPVERS_HAS_RESPONSE_HEADERS 17
621 #define NPVERS_HAS_NPOBJECT_ENUM 18
622 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
623 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20
624 #define NPVERS_HAS_WINDOWLESS_CURSORS 21
626 /*----------------------------------------------------------------------*/
627 /* Function Prototypes */
628 /*----------------------------------------------------------------------*/
631 #define NP_LOADDS _System
640 /* NPP_* functions are provided by the plugin and called by the navigator. */
643 char* NPP_GetMIMEDescription(void);
646 NPError NP_LOADDS
NPP_Initialize(void);
647 void NP_LOADDS
NPP_Shutdown(void);
648 NPError NP_LOADDS
NPP_New(NPMIMEType pluginType
, NPP instance
,
649 uint16_t mode
, int16_t argc
, char* argn
[],
650 char* argv
[], NPSavedData
* saved
);
651 NPError NP_LOADDS
NPP_Destroy(NPP instance
, NPSavedData
** save
);
652 NPError NP_LOADDS
NPP_SetWindow(NPP instance
, NPWindow
* window
);
653 NPError NP_LOADDS
NPP_NewStream(NPP instance
, NPMIMEType type
,
654 NPStream
* stream
, NPBool seekable
,
656 NPError NP_LOADDS
NPP_DestroyStream(NPP instance
, NPStream
* stream
,
658 int32_t NP_LOADDS
NPP_WriteReady(NPP instance
, NPStream
* stream
);
659 int32_t NP_LOADDS
NPP_Write(NPP instance
, NPStream
* stream
, int32_t offset
,
660 int32_t len
, void* buffer
);
661 void NP_LOADDS
NPP_StreamAsFile(NPP instance
, NPStream
* stream
,
663 void NP_LOADDS
NPP_Print(NPP instance
, NPPrint
* platformPrint
);
664 int16_t NP_LOADDS
NPP_HandleEvent(NPP instance
, void* event
);
665 void NP_LOADDS
NPP_URLNotify(NPP instance
, const char* url
,
666 NPReason reason
, void* notifyData
);
668 jref NP_LOADDS
NPP_GetJavaClass(void);
670 NPError NP_LOADDS
NPP_GetValue(NPP instance
, NPPVariable variable
, void *value
);
671 NPError NP_LOADDS
NPP_SetValue(NPP instance
, NPNVariable variable
, void *value
);
673 /* NPN_* functions are provided by the navigator and called by the plugin. */
674 void NP_LOADDS
NPN_Version(int* plugin_major
, int* plugin_minor
,
675 int* netscape_major
, int* netscape_minor
);
676 NPError NP_LOADDS
NPN_GetURLNotify(NPP instance
, const char* url
,
677 const char* target
, void* notifyData
);
678 NPError NP_LOADDS
NPN_GetURL(NPP instance
, const char* url
,
680 NPError NP_LOADDS
NPN_PostURLNotify(NPP instance
, const char* url
,
681 const char* target
, uint32_t len
,
682 const char* buf
, NPBool file
,
684 NPError NP_LOADDS
NPN_PostURL(NPP instance
, const char* url
,
685 const char* target
, uint32_t len
,
686 const char* buf
, NPBool file
);
687 NPError NP_LOADDS
NPN_RequestRead(NPStream
* stream
, NPByteRange
* rangeList
);
688 NPError NP_LOADDS
NPN_NewStream(NPP instance
, NPMIMEType type
,
689 const char* target
, NPStream
** stream
);
690 int32_t NP_LOADDS
NPN_Write(NPP instance
, NPStream
* stream
, int32_t len
,
692 NPError NP_LOADDS
NPN_DestroyStream(NPP instance
, NPStream
* stream
,
694 void NP_LOADDS
NPN_Status(NPP instance
, const char* message
);
695 const char* NP_LOADDS
NPN_UserAgent(NPP instance
);
696 void* NP_LOADDS
NPN_MemAlloc(uint32_t size
);
697 void NP_LOADDS
NPN_MemFree(void* ptr
);
698 uint32_t NP_LOADDS
NPN_MemFlush(uint32_t size
);
699 void NP_LOADDS
NPN_ReloadPlugins(NPBool reloadPages
);
701 JRIEnv
* NP_LOADDS
NPN_GetJavaEnv(void);
702 jref NP_LOADDS
NPN_GetJavaPeer(NPP instance
);
704 NPError NP_LOADDS
NPN_GetValue(NPP instance
, NPNVariable variable
,
706 NPError NP_LOADDS
NPN_SetValue(NPP instance
, NPPVariable variable
,
708 void NP_LOADDS
NPN_InvalidateRect(NPP instance
, NPRect
*invalidRect
);
709 void NP_LOADDS
NPN_InvalidateRegion(NPP instance
,
710 NPRegion invalidRegion
);
711 void NP_LOADDS
NPN_ForceRedraw(NPP instance
);
712 void NP_LOADDS
NPN_PushPopupsEnabledState(NPP instance
, NPBool enabled
);
713 void NP_LOADDS
NPN_PopPopupsEnabledState(NPP instance
);
714 void NP_LOADDS
NPN_PluginThreadAsyncCall(NPP instance
,
715 void (*func
) (void *), void *userData
);
718 } /* end extern "C" */
721 #endif /* RC_INVOKED */
726 #endif /* npapi_h_ */