1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Netscape Public License
6 * Version 1.1 (the "License"); you may not use this file except in
7 * compliance with the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/NPL/
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.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the NPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the NPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
41 * npapi.h $Revision: 1.2 $
42 * Netscape client plug-in API spec
52 #include "jri.h" /* Java Runtime Interface */
54 #if defined (__OS2__ ) || defined (OS2)
67 # define _declspec __declspec
72 # endif /* macintosh */
77 # endif /* __INTEL__ */
79 #endif /* __MWERKS__ */
82 #include <Quickdraw.h>
86 #if defined(XP_UNIX) && !defined(NO_X11)
88 #include <X11/Xutil.h>
91 /*----------------------------------------------------------------------*/
92 /* Plugin Version Constants */
93 /*----------------------------------------------------------------------*/
95 #define NP_VERSION_MAJOR 0
96 #define NP_VERSION_MINOR 13
99 /* The OS/2 version of Netscape uses RC_DATA to define the
100 mime types, file extentions, etc that are required.
101 Use a vertical bar to seperate types, end types with \0.
102 FileVersion and ProductVersion are 32bit ints, all other
103 entries are strings the MUST be terminated wwith a \0.
107 RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
109 RCDATA NP_INFO_MIMEType { "video/x-video|",
111 RCDATA NP_INFO_FileExtents { "avi|",
113 RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
114 "MMOS2 Flc/Fli player(*.flc)\0" }
116 RCDATA NP_INFO_FileVersion { 1,0,0,1 }
117 RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
118 RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
119 RCDATA NP_INFO_InternalName { "NPAVI32\0" )
120 RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
121 RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
122 RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
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
133 /* RC_DATA types for version info - used if found */
134 #define NP_INFO_FileDescription 5
135 #define NP_INFO_ProductName 6
137 /* RC_DATA types for version info - optional */
138 #define NP_INFO_CompanyName 7
139 #define NP_INFO_FileVersion 8
140 #define NP_INFO_InternalName 9
141 #define NP_INFO_LegalCopyright 10
142 #define NP_INFO_OriginalFilename 11
148 /*----------------------------------------------------------------------*/
149 /* Definition of Basic Types */
150 /*----------------------------------------------------------------------*/
153 typedef unsigned short uint16
;
157 # if defined(__alpha)
158 typedef unsigned int uint32
;
160 typedef unsigned long uint32
;
161 # endif /* __alpha */
165 * AIX defines these in sys/inttypes.h included from sys/types.h
173 # if defined(__alpha)
177 # endif /* __alpha */
191 typedef unsigned char NPBool
;
192 typedef int16 NPError
;
193 typedef int16 NPReason
;
194 typedef char* NPMIMEType
;
198 /*----------------------------------------------------------------------*/
199 /* Structures and definitions */
200 /*----------------------------------------------------------------------*/
203 #pragma options align=mac68k
207 * NPP is a plug-in's opaque instance handle
211 void* pdata
; /* plug-in private data */
212 void* ndata
; /* netscape private data */
218 typedef struct _NPStream
220 void* pdata
; /* plug-in private data */
221 void* ndata
; /* netscape private data */
229 typedef struct _NPByteRange
231 int32 offset
; /* negative offset means from the end */
233 struct _NPByteRange
* next
;
237 typedef struct _NPSavedData
244 typedef struct _NPRect
252 typedef struct _NPSize
260 * Unix specific structures and definitions
264 * Callback Structures.
266 * These are used to pass additional platform specific information.
276 } NPAnyCallbackStruct
;
287 } NPSetWindowCallbackStruct
;
293 } NPPrintCallbackStruct
;
298 * List of variable names for which NPP_GetValue shall be implemented
301 NPPVpluginNameString
= 1,
302 NPPVpluginDescriptionString
,
303 NPPVpluginWindowBool
,
304 NPPVpluginTransparentBool
,
305 NPPVjavaClass
, /* Not implemented in Mozilla 1.0 */
306 NPPVpluginWindowSize
,
307 NPPVpluginTimerInterval
,
309 NPPVpluginScriptableInstance
= 10,
310 NPPVpluginScriptableIID
= 11,
312 /* 12 and over are available on Mozilla builds starting with 0.9.9 */
313 NPPVjavascriptPushCallerBool
= 12,
314 NPPVpluginKeepLibraryInMemory
= 13 /* available in Mozilla 1.0 */
318 * List of variable names for which NPN_GetValue is implemented by Mozilla
324 NPNVjavascriptEnabledBool
,
328 /* 10 and over are available on Mozilla builds starting with 0.9.4 */
329 NPNVserviceManager
= 10
333 * The type of a NPWindow - it specifies the type of the data structure
334 * returned in the window field.
337 NPWindowTypeWindow
= 1,
341 typedef struct _NPWindow
343 void* window
; /* Platform specific window handle */
344 /* OS/2: x - Position of bottom left corner */
345 /* OS/2: y - relative to visible netscape window */
346 int32 x
; /* Position of top left corner relative */
347 int32 y
; /* to a netscape page. */
348 uint32 width
; /* Maximum window size */
350 NPRect clipRect
; /* Clipping rectangle in port coordinates */
351 /* Used by MAC only. */
353 void * ws_info
; /* Platform-dependent additonal data */
355 NPWindowType type
; /* Is this a window or a drawable? */
359 typedef struct _NPFullPrint
361 NPBool pluginPrinted
;/* Set TRUE if plugin handled fullscreen printing */
362 NPBool printOne
; /* TRUE if plugin should print one copy to default printer */
363 void* platformPrint
; /* Platform-specific printing info */
366 typedef struct _NPEmbedPrint
369 void* platformPrint
; /* Platform-specific printing info */
372 typedef struct _NPPrint
374 uint16 mode
; /* NP_FULL or NP_EMBED */
377 NPFullPrint fullPrint
; /* if mode is NP_FULL */
378 NPEmbedPrint embedPrint
; /* if mode is NP_EMBED */
383 typedef EventRecord NPEvent
;
384 #elif defined(XP_WIN)
385 typedef struct _NPEvent
391 #elif defined(XP_OS2)
392 typedef struct _NPEvent
398 #elif defined (XP_UNIX) && !defined(NO_X11)
399 typedef XEvent NPEvent
;
401 typedef void* NPEvent
;
405 typedef RgnHandle NPRegion
;
406 #elif defined(XP_WIN)
407 typedef HRGN NPRegion
;
408 #elif defined(XP_UNIX) && !defined(NO_X11)
409 typedef Region NPRegion
;
411 typedef void *NPRegion
;
416 * Mac-specific structures and definitions.
419 typedef struct NP_Port
421 CGrafPtr port
; /* Grafport */
422 int32 portx
; /* position inside the topmost window */
427 * Non-standard event types that can be passed to HandleEvent
431 NPEventType_GetFocusEvent
= (osEvt
+ 16),
432 NPEventType_LoseFocusEvent
,
433 NPEventType_AdjustCursorEvent
,
434 NPEventType_MenuCommandEvent
,
435 NPEventType_ClippingChangedEvent
,
436 NPEventType_ScrollingBeginsEvent
= 1000,
437 NPEventType_ScrollingEndsEvent
441 #define getFocusEvent (osEvt + 16)
442 #define loseFocusEvent (osEvt + 17)
443 #define adjustCursorEvent (osEvt + 18)
448 * Values for mode passed to NPP_New:
454 * Values for stream type passed to NPP_NewStream:
459 #define NP_ASFILEONLY 4
461 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
464 #pragma options align=reset
468 /*----------------------------------------------------------------------*/
469 /* Error and Reason Code definitions */
470 /*----------------------------------------------------------------------*/
473 * Values of type NPError:
476 #define NPERR_NO_ERROR (NPERR_BASE + 0)
477 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
478 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
479 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
480 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
481 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
482 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
483 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
484 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
485 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
486 #define NPERR_INVALID_URL (NPERR_BASE + 10)
487 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
488 #define NPERR_NO_DATA (NPERR_BASE + 12)
489 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
492 * Values of type NPReason:
495 #define NPRES_DONE (NPRES_BASE + 0)
496 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
497 #define NPRES_USER_BREAK (NPRES_BASE + 2)
500 * Don't use these obsolete error codes any more.
502 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
503 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
504 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
507 * Version feature information
509 #define NPVERS_HAS_STREAMOUTPUT 8
510 #define NPVERS_HAS_NOTIFICATION 9
511 #define NPVERS_HAS_LIVECONNECT 9
512 #define NPVERS_WIN16_HAS_LIVECONNECT 9
513 #define NPVERS_68K_HAS_LIVECONNECT 11
514 #define NPVERS_HAS_WINDOWLESS 11
515 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
517 /*----------------------------------------------------------------------*/
518 /* Function Prototypes */
519 /*----------------------------------------------------------------------*/
521 #if defined(_WINDOWS) && !defined(WIN32)
522 #define NP_LOADDS _loadds
525 #define NP_LOADDS _System
536 * NPP_* functions are provided by the plugin and called by the navigator.
539 char* NPP_GetMIMEDescription(void);
541 NPError NP_LOADDS
NPP_Initialize(void);
542 void NP_LOADDS
NPP_Shutdown(void);
543 NPError NP_LOADDS
NPP_New(NPMIMEType pluginType
, NPP instance
,
544 uint16 mode
, int16 argc
, char* argn
[],
545 char* argv
[], NPSavedData
* saved
);
546 NPError NP_LOADDS
NPP_Destroy(NPP instance
, NPSavedData
** save
);
547 NPError NP_LOADDS
NPP_SetWindow(NPP instance
, NPWindow
* window
);
548 NPError NP_LOADDS
NPP_NewStream(NPP instance
, NPMIMEType type
,
549 NPStream
* stream
, NPBool seekable
,
551 NPError NP_LOADDS
NPP_DestroyStream(NPP instance
, NPStream
* stream
,
553 int32 NP_LOADDS
NPP_WriteReady(NPP instance
, NPStream
* stream
);
554 int32 NP_LOADDS
NPP_Write(NPP instance
, NPStream
* stream
, int32 offset
,
555 int32 len
, void* buffer
);
556 void NP_LOADDS
NPP_StreamAsFile(NPP instance
, NPStream
* stream
,
558 void NP_LOADDS
NPP_Print(NPP instance
, NPPrint
* platformPrint
);
559 int16 NP_LOADDS
NPP_HandleEvent(NPP instance
, void* event
);
560 void NP_LOADDS
NPP_URLNotify(NPP instance
, const char* url
,
561 NPReason reason
, void* notifyData
);
562 jref NP_LOADDS
NPP_GetJavaClass(void);
563 NPError NP_LOADDS
NPP_GetValue(NPP instance
, NPPVariable variable
, void *value
);
564 NPError NP_LOADDS
NPP_SetValue(NPP instance
, NPNVariable variable
, void *value
);
567 * NPN_* functions are provided by the navigator and called by the plugin.
569 void NP_LOADDS
NPN_Version(int* plugin_major
, int* plugin_minor
,
570 int* netscape_major
, int* netscape_minor
);
571 NPError NP_LOADDS
NPN_GetURLNotify(NPP instance
, const char* url
,
572 const char* target
, void* notifyData
);
573 NPError NP_LOADDS
NPN_GetURL(NPP instance
, const char* url
,
575 NPError NP_LOADDS
NPN_PostURLNotify(NPP instance
, const char* url
,
576 const char* target
, uint32 len
,
577 const char* buf
, NPBool file
,
579 NPError NP_LOADDS
NPN_PostURL(NPP instance
, const char* url
,
580 const char* target
, uint32 len
,
581 const char* buf
, NPBool file
);
582 NPError NP_LOADDS
NPN_RequestRead(NPStream
* stream
, NPByteRange
* rangeList
);
583 NPError NP_LOADDS
NPN_NewStream(NPP instance
, NPMIMEType type
,
584 const char* target
, NPStream
** stream
);
585 int32 NP_LOADDS
NPN_Write(NPP instance
, NPStream
* stream
, int32 len
, void* buffer
);
586 NPError NP_LOADDS
NPN_DestroyStream(NPP instance
, NPStream
* stream
, NPReason reason
);
587 void NP_LOADDS
NPN_Status(NPP instance
, const char* message
);
588 const char* NP_LOADDS
NPN_UserAgent(NPP instance
);
589 void* NP_LOADDS
NPN_MemAlloc(uint32 size
);
590 void NP_LOADDS
NPN_MemFree(void* ptr
);
591 uint32 NP_LOADDS
NPN_MemFlush(uint32 size
);
592 void NP_LOADDS
NPN_ReloadPlugins(NPBool reloadPages
);
593 JRIEnv
* NP_LOADDS
NPN_GetJavaEnv(void);
594 jref NP_LOADDS
NPN_GetJavaPeer(NPP instance
);
595 NPError NP_LOADDS
NPN_GetValue(NPP instance
, NPNVariable variable
, void *value
);
596 NPError NP_LOADDS
NPN_SetValue(NPP instance
, NPPVariable variable
, void *value
);
597 void NP_LOADDS
NPN_InvalidateRect(NPP instance
, NPRect
*invalidRect
);
598 void NP_LOADDS
NPN_InvalidateRegion(NPP instance
, NPRegion invalidRegion
);
599 void NP_LOADDS
NPN_ForceRedraw(NPP instance
);
602 } /* end extern "C" */
605 #endif /* RC_INVOKED */
610 #endif /* _NPAPI_H_ */