00001
00002
00003
00004
00005 #ifndef _NPAPI_H_
00006 #define _NPAPI_H_
00007
00008 #ifdef _WINDOWS
00009 # ifndef XP_PC
00010 # define XP_PC 1
00011 # endif
00012 #endif
00013
00014 #ifdef __MWERKS__
00015 # define _declspec __declspec
00016 # ifdef macintosh
00017 # ifndef XP_MAC
00018 # define XP_MAC 1
00019 # endif
00020 # endif
00021 # ifdef __INTEL__
00022 # undef NULL
00023 # ifndef XP_PC
00024 # define XP_PC 1
00025 # endif
00026 # endif
00027 #endif
00028
00029 #include "jri.h"
00030
00031 #define NP_VERSION_MAJOR 0
00032 #define NP_VERSION_MINOR 9
00033
00034
00035 #ifndef _UINT16
00036 typedef unsigned short uint16;
00037 #endif
00038 #ifndef _UINT32
00039 #if defined(__alpha)
00040 typedef unsigned int uint32;
00041 #else
00042 typedef unsigned long uint32;
00043 #endif
00044 #endif
00045 #ifndef _INT16
00046 typedef short int16;
00047 #endif
00048 #ifndef _INT32
00049 #if defined(__alpha)
00050 typedef int int32;
00051 #else
00052 typedef long int32;
00053 #endif
00054 #endif
00055
00056 #ifndef FALSE
00057 #define FALSE (0)
00058 #endif
00059 #ifndef TRUE
00060 #define TRUE (1)
00061 #endif
00062 #ifndef NULL
00063 #define NULL (0L)
00064 #endif
00065
00066 typedef unsigned char NPBool;
00067 typedef void* NPEvent;
00068 typedef int16 NPError;
00069 typedef int16 NPReason;
00070 typedef char* NPMIMEType;
00071
00072 typedef struct _NPP
00073 {
00074 void* pdata;
00075 void* ndata;
00076 } NPP_t;
00077
00078 typedef NPP_t* NPP;
00079
00080 typedef struct _NPStream
00081 {
00082 void* pdata;
00083 void* ndata;
00084 const char* url;
00085 uint32 end;
00086 uint32 lastmodified;
00087 void* notifyData;
00088 } NPStream;
00089
00090 typedef struct _NPByteRange
00091 {
00092 int32 offset;
00093 uint32 length;
00094 struct _NPByteRange* next;
00095 } NPByteRange;
00096
00097 typedef struct _NPSavedData
00098 {
00099 int32 len;
00100 void* buf;
00101 } NPSavedData;
00102
00103 typedef struct _NPRect
00104 {
00105 uint16 top;
00106 uint16 left;
00107 uint16 bottom;
00108 uint16 right;
00109 } NPRect;
00110
00111 #ifdef XP_UNIX
00112
00113 #include <X11/Xlib.h>
00114
00115 enum {
00116 NP_SETWINDOW = 1,
00117 NP_PRINT
00118 };
00119
00120 typedef struct
00121 {
00122 int32 type;
00123 } NPAnyCallbackStruct;
00124
00125 typedef struct
00126 {
00127 int32 type;
00128 Display* display;
00129 Visual* visual;
00130 Colormap colormap;
00131 unsigned int depth;
00132 } NPSetWindowCallbackStruct;
00133
00134 typedef struct
00135 {
00136 int32 type;
00137 FILE* fp;
00138 } NPPrintCallbackStruct;
00139
00140 typedef enum {
00141 NPPVpluginNameString = 1,
00142 NPPVpluginDescriptionString
00143 } NPPVariable;
00144
00145 typedef enum {
00146 NPNVxDisplay = 1,
00147 NPNVxtAppContext
00148 } NPNVariable;
00149
00150 #endif
00151
00152 typedef struct _NPWindow
00153 {
00154 void* window;
00155 uint32 x;
00156 uint32 y;
00157 uint32 width;
00158 uint32 height;
00159 NPRect clipRect;
00160
00161 #ifdef XP_UNIX
00162 void * ws_info;
00163 #endif
00164 } NPWindow;
00165
00166 typedef struct _NPFullPrint
00167 {
00168 NPBool pluginPrinted;
00169
00170 NPBool printOne;
00171
00172 void* platformPrint;
00173 } NPFullPrint;
00174
00175 typedef struct _NPEmbedPrint
00176 {
00177 NPWindow window;
00178 void* platformPrint;
00179 } NPEmbedPrint;
00180
00181 typedef struct _NPPrint
00182 {
00183 uint16 mode;
00184 union
00185 {
00186 NPFullPrint fullPrint;
00187 NPEmbedPrint embedPrint;
00188 } print;
00189 } NPPrint;
00190
00191 #ifdef XP_MAC
00192
00193
00194 #include <Quickdraw.h>
00195 #include <Events.h>
00196
00197 typedef struct NP_Port
00198 {
00199 CGrafPtr port;
00200 int32 portx;
00201 int32 porty;
00202 } NP_Port;
00203
00204 #define getFocusEvent (osEvt + 16)
00205 #define loseFocusEvent (osEvt + 17)
00206 #define adjustCursorEvent (osEvt + 18)
00207
00208 #endif
00209
00210 #define NP_EMBED 1
00211 #define NP_FULL 2
00212
00213 #define NP_NORMAL 1
00214 #define NP_SEEK 2
00215 #define NP_ASFILE 3
00216 #define NP_ASFILEONLY 4
00217
00218 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
00219
00220 #define NPERR_BASE 0
00221 #define NPERR_NO_ERROR (NPERR_BASE + 0)
00222 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
00223 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
00224 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
00225 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
00226 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
00227 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
00228 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
00229 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
00230 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
00231 #define NPERR_INVALID_URL (NPERR_BASE + 10)
00232 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
00233 #define NPERR_NO_DATA (NPERR_BASE + 12)
00234 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
00235
00236 #define NPRES_BASE 0
00237 #define NPRES_DONE (NPRES_BASE + 0)
00238 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
00239 #define NPRES_USER_BREAK (NPRES_BASE + 2)
00240
00241 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
00242 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
00243 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
00244
00245 #define NPVERS_HAS_STREAMOUTPUT 8
00246 #define NPVERS_HAS_NOTIFICATION 9
00247 #define NPVERS_HAS_LIVECONNECT 9
00248 #define NPVERS_WIN16_HAS_LIVECONNECT 10
00249
00250 #if defined(_WINDOWS) && !defined(WIN32)
00251 #define NP_LOADDS _loadds
00252 #else
00253 #define NP_LOADDS
00254 #endif
00255
00256 #ifdef __cplusplus
00257 extern "C" {
00258 #endif
00259
00260 #ifdef XP_UNIX
00261 char* NPP_GetMIMEDescription(void);
00262 NPError NPP_GetValue(void *instance, NPPVariable variable,
00263 void *value);
00264 #endif
00265 NPError NPP_Initialize(void);
00266 void NPP_Shutdown(void);
00267 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
00268 uint16 mode, int16 argc, char* argn[],
00269 char* argv[], NPSavedData* saved);
00270 NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
00271 NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
00272 NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
00273 NPStream* stream, NPBool seekable,
00274 uint16* stype);
00275 NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
00276 NPReason reason);
00277 int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
00278 int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
00279 int32 len, void* buffer);
00280 void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
00281 const char* fname);
00282 void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
00283 int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
00284 void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
00285 NPReason reason, void* notifyData);
00286 jref NP_LOADDS NPP_GetJavaClass(void);
00287
00288
00289 #ifdef XP_UNIX
00290 NPError NPN_GetValue(NPP instance, NPNVariable variable,
00291 void *value);
00292 #endif
00293 void NPN_Version(int* plugin_major, int* plugin_minor,
00294 int* netscape_major, int* netscape_minor);
00295 NPError NPN_GetURLNotify(NPP instance, const char* url,
00296 const char* target, void* notifyData);
00297 NPError NPN_GetURL(NPP instance, const char* url,
00298 const char* target);
00299 NPError NPN_PostURLNotify(NPP instance, const char* url,
00300 const char* target, uint32 len,
00301 const char* buf, NPBool file,
00302 void* notifyData);
00303 NPError NPN_PostURL(NPP instance, const char* url,
00304 const char* target, uint32 len,
00305 const char* buf, NPBool file);
00306 NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
00307 NPError NPN_NewStream(NPP instance, NPMIMEType type,
00308 const char* target, NPStream** stream);
00309 int32 NPN_Write(NPP instance, NPStream* stream, int32 len,
00310 void* buffer);
00311 NPError NPN_DestroyStream(NPP instance, NPStream* stream,
00312 NPReason reason);
00313 void NPN_Status(NPP instance, const char* message);
00314 const char* NPN_UserAgent(NPP instance);
00315 void* NPN_MemAlloc(uint32 size);
00316 void NPN_MemFree(void* ptr);
00317 uint32 NPN_MemFlush(uint32 size);
00318 void NPN_ReloadPlugins(NPBool reloadPages);
00319 JRIEnv* NPN_GetJavaEnv(void);
00320 jref NPN_GetJavaPeer(NPP instance);
00321
00322 #ifdef __cplusplus
00323 }
00324 #endif
00325
00326 #endif