1
/* $Xorg: npapi.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */
2
/* -*- Mode: C; tab-width: 4; -*- */
4
* npapi.h Revision: 1.76
5
* Netscape client plug-in API spec
7
/* $XFree86: xc/programs/xrx/plugin/include/npapi.h,v 1.5 2001/07/25 15:05:28 dawes Exp $ */
12
#include "jri.h" /* Java Runtime Interface */
15
/* XXX this needs to get out of here */
16
#if defined(__MWERKS__)
24
/*----------------------------------------------------------------------*/
25
/* Plugin Version Constants */
26
/*----------------------------------------------------------------------*/
28
#define NP_VERSION_MAJOR 0
29
#define NP_VERSION_MINOR 9
33
/*----------------------------------------------------------------------*/
34
/* Definition of Basic Types */
35
/*----------------------------------------------------------------------*/
38
typedef unsigned short uint16;
41
typedef unsigned int uint32;
58
typedef unsigned char NPBool;
59
typedef void* NPEvent;
60
typedef int16 NPError;
61
typedef int16 NPReason;
62
typedef char* NPMIMEType;
66
/*----------------------------------------------------------------------*/
67
/* Structures and definitions */
68
/*----------------------------------------------------------------------*/
71
* NPP is a plug-in's opaque instance handle
75
void* pdata; /* plug-in private data */
76
void* ndata; /* netscape private data */
82
typedef struct _NPStream
84
void* pdata; /* plug-in private data */
85
void* ndata; /* netscape private data */
93
typedef struct _NPByteRange
95
int32 offset; /* negative offset means from the end */
97
struct _NPByteRange* next;
101
typedef struct _NPSavedData
108
typedef struct _NPRect
119
* Unix specific structures and definitions
121
#include <X11/Xlib.h>
124
* Callback Structures.
126
* These are used to pass additional platform specific information.
135
} NPAnyCallbackStruct;
144
} NPSetWindowCallbackStruct;
147
* List of variable names for which NPP_GetValue shall be implemented
150
NPPVpluginNameString = 1,
151
NPPVpluginDescriptionString
155
* List of variable names for which NPN_GetValue is implemented by Mozilla
165
typedef struct _NPWindow
167
void* window; /* Platform specific window handle */
168
uint32 x; /* Position of top left corner relative */
169
uint32 y; /* to a netscape page. */
170
uint32 width; /* Maximum window size */
172
NPRect clipRect; /* Clipping rectangle in port coordinates */
173
/* Used by MAC only. */
175
void * ws_info; /* Platform-dependent additonal data */
180
typedef struct _NPFullPrint
182
NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */
184
NPBool printOne; /* TRUE if plugin should print one copy */
185
/* to default printer */
186
void* platformPrint; /* Platform-specific printing info */
189
typedef struct _NPEmbedPrint
192
void* platformPrint; /* Platform-specific printing info */
195
typedef struct _NPPrint
197
uint16 mode; /* NP_FULL or NP_EMBED */
200
NPFullPrint fullPrint; /* if mode is NP_FULL */
201
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
208
* Mac-specific structures and definitions.
211
#include <Quickdraw.h>
214
typedef struct NP_Port
216
CGrafPtr port; /* Grafport */
217
int32 portx; /* position inside the topmost window */
222
* Non-standard event types that can be passed to HandleEvent
224
#define getFocusEvent (osEvt + 16)
225
#define loseFocusEvent (osEvt + 17)
226
#define adjustCursorEvent (osEvt + 18)
232
* Values for mode passed to NPP_New:
238
* Values for stream type passed to NPP_NewStream:
243
#define NP_ASFILEONLY 4
245
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
249
/*----------------------------------------------------------------------*/
250
/* Error and Reason Code definitions */
251
/*----------------------------------------------------------------------*/
254
* Values of type NPError:
257
#define NPERR_NO_ERROR (NPERR_BASE + 0)
258
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
259
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
260
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
261
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
262
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
263
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
264
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
265
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
266
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
267
#define NPERR_INVALID_URL (NPERR_BASE + 10)
268
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
269
#define NPERR_NO_DATA (NPERR_BASE + 12)
270
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
273
* Values of type NPReason:
276
#define NPRES_DONE (NPRES_BASE + 0)
277
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
278
#define NPRES_USER_BREAK (NPRES_BASE + 2)
281
* Don't use these obsolete error codes any more.
283
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
284
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
285
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
288
* Version feature information
290
#define NPVERS_HAS_STREAMOUTPUT 8
291
#define NPVERS_HAS_NOTIFICATION 9
292
#define NPVERS_HAS_LIVECONNECT 9
295
/*----------------------------------------------------------------------*/
296
/* Function Prototypes */
297
/*----------------------------------------------------------------------*/
299
#if defined(_WINDOWS) && !defined(WIN32)
300
#define NP_LOADDS _loadds
310
* NPP_* functions are provided by the plugin and called by the navigator.
314
char* NPP_GetMIMEDescription(void);
315
NPError NPP_GetValue(void *instance, NPPVariable variable,
318
NPError NPP_Initialize(void);
319
void NPP_Shutdown(void);
320
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
321
uint16 mode, int16 argc, char* argn[],
322
char* argv[], NPSavedData* saved);
323
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
324
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
325
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
326
NPStream* stream, NPBool seekable,
328
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
330
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
331
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
332
int32 len, void* buffer);
333
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
335
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
336
int16 NPP_HandleEvent(NPP instance, void* event);
337
void NPP_URLNotify(NPP instance, const char* url,
338
NPReason reason, void* notifyData);
339
jref NPP_GetJavaClass(void);
343
* NPN_* functions are provided by the navigator and called by the plugin.
347
NPError NPN_GetValue(NPP instance, NPNVariable variable,
350
void NPN_Version(int* plugin_major, int* plugin_minor,
351
int* netscape_major, int* netscape_minor);
352
NPError NPN_GetURLNotify(NPP instance, const char* url,
353
const char* target, void* notifyData);
354
NPError NPN_GetURL(NPP instance, const char* url,
356
NPError NPN_PostURLNotify(NPP instance, const char* url,
357
const char* target, uint32 len,
358
const char* buf, NPBool file,
360
NPError NPN_PostURL(NPP instance, const char* url,
361
const char* target, uint32 len,
362
const char* buf, NPBool file);
363
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
364
NPError NPN_NewStream(NPP instance, NPMIMEType type,
365
const char* target, NPStream** stream);
366
int32 NPN_Write(NPP instance, NPStream* stream, int32 len,
368
NPError NPN_DestroyStream(NPP instance, NPStream* stream,
370
void NPN_Status(NPP instance, const char* message);
371
const char* NPN_UserAgent(NPP instance);
372
void* NPN_MemAlloc(uint32 size);
373
void NPN_MemFree(void* ptr);
374
uint32 NPN_MemFlush(uint32 size);
375
void NPN_ReloadPlugins(NPBool reloadPages);
376
JRIEnv* NPN_GetJavaEnv(void);
377
jref NPN_GetJavaPeer(NPP instance);
381
} /* end extern "C" */
384
#endif /* _NPAPI_H_ */