npapi_8h-source.html

npapi.h

00001 /* -*- Mode: C; tab-width: 4; -*- */
00002 /*
00003  *  npapi.h $Revision: 1.1 $
00004  *  Netscape client plug-in API spec
00005  */
00006 
00007 #ifndef _NPAPI_H_
00008 #define _NPAPI_H_
00009 
00010 #include "jri.h"                /* Java Runtime Interface */
00011 
00012 
00013 /* XXX this needs to get out of here */
00014 #if defined(__MWERKS__)
00015 #ifndef XP_MAC
00016 #define XP_MAC
00017 #endif
00018 #endif
00019 
00020 
00021 
00022 /*----------------------------------------------------------------------*/
00023 /*                   Plugin Version Constants                           */
00024 /*----------------------------------------------------------------------*/
00025 
00026 #define NP_VERSION_MAJOR 0
00027 #define NP_VERSION_MINOR 9
00028 
00029 
00030 
00031 /*----------------------------------------------------------------------*/
00032 /*                   Definition of Basic Types                          */
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 /* __alpha */
00042 typedef unsigned long uint32;
00043 #endif /* __alpha */
00044 #endif
00045 #ifndef _INT16
00046 typedef short int16;
00047 #endif
00048 #ifndef _INT32
00049 #if defined(__alpha)
00050 typedef int int32;
00051 #else /* __alpha */
00052 typedef long int32;
00053 #endif /* __alpha */
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 
00073 
00074 /*----------------------------------------------------------------------*/
00075 /*                   Structures and definitions                         */
00076 /*----------------------------------------------------------------------*/
00077 
00078 /*
00079  *  NPP is a plug-in's opaque instance handle
00080  */
00081 typedef struct _NPP
00082 {
00083     void*       pdata;                  /* plug-in private data */
00084     void*       ndata;                  /* netscape private data */
00085 } NPP_t;
00086 
00087 typedef NPP_t*  NPP;
00088 
00089 
00090 typedef struct _NPStream
00091 {
00092     void*               pdata;          /* plug-in private data */
00093     void*               ndata;          /* netscape private data */
00094     const char*         url;
00095     uint32              end;
00096     uint32              lastmodified;
00097     void*               notifyData;
00098 } NPStream;
00099 
00100 
00101 typedef struct _NPByteRange
00102 {
00103     int32       offset;                 /* negative offset means from the end */
00104     uint32      length;
00105     struct _NPByteRange* next;
00106 } NPByteRange;
00107 
00108 
00109 typedef struct _NPSavedData
00110 {
00111     int32       len;
00112     void*       buf;
00113 } NPSavedData;
00114 
00115 
00116 typedef struct _NPRect
00117 {
00118     uint16      top;
00119     uint16      left;
00120     uint16      bottom;
00121     uint16      right;
00122 } NPRect;
00123 
00124 
00125 #ifdef XP_UNIX
00126 /*
00127  * Unix specific structures and definitions
00128  */
00129 #include <X11/Xlib.h>
00130 
00131 /*
00132  * Callback Structures.
00133  *
00134  * These are used to pass additional platform specific information.
00135  */
00136 enum {
00137         NP_SETWINDOW = 1
00138 };
00139 
00140 typedef struct
00141 {
00142     int32               type;
00143 } NPAnyCallbackStruct;
00144 
00145 typedef struct
00146 {
00147     int32                       type;
00148     Display*            display;
00149     Visual*                     visual;
00150     Colormap            colormap;
00151     unsigned int        depth;
00152 } NPSetWindowCallbackStruct;
00153 
00154 /*
00155  * List of variable names for which NPP_GetValue shall be implemented
00156  */
00157 typedef enum {
00158         NPPVpluginNameString = 1,
00159         NPPVpluginDescriptionString
00160 } NPPVariable;
00161 
00162 /*
00163  * List of variable names for which NPN_GetValue is implemented by Mozilla
00164  */
00165 typedef enum {
00166         NPNVxDisplay = 1,
00167         NPNVxtAppContext
00168 } NPNVariable;
00169 
00170 #endif /* XP_UNIX */
00171 
00172 
00173 typedef struct _NPWindow 
00174 {
00175     void*       window;         /* Platform specific window handle */
00176     uint32      x;                      /* Position of top left corner relative */
00177     uint32      y;                      /*      to a netscape page.                                     */
00178     uint32      width;          /* Maximum window size */
00179     uint32      height;
00180     NPRect      clipRect;       /* Clipping rectangle in port coordinates */
00181                                                 /* Used by MAC only.                      */
00182 #ifdef XP_UNIX
00183     void *      ws_info;        /* Platform-dependent additonal data */
00184 #endif /* XP_UNIX */
00185 } NPWindow;
00186 
00187 
00188 typedef struct _NPFullPrint
00189 {
00190     NPBool      pluginPrinted;  /* Set TRUE if plugin handled fullscreen */
00191                                                         /*      printing                                                         */
00192     NPBool      printOne;               /* TRUE if plugin should print one copy  */
00193                                                         /*      to default printer                                       */
00194     void*       platformPrint;  /* Platform-specific printing info */
00195 } NPFullPrint;
00196 
00197 typedef struct _NPEmbedPrint
00198 {
00199     NPWindow    window;
00200     void*       platformPrint;  /* Platform-specific printing info */
00201 } NPEmbedPrint;
00202 
00203 typedef struct _NPPrint
00204 {
00205     uint16      mode;                                           /* NP_FULL or NP_EMBED */
00206     union
00207     {
00208                 NPFullPrint             fullPrint;              /* if mode is NP_FULL */
00209                 NPEmbedPrint    embedPrint;             /* if mode is NP_EMBED */
00210     } print;
00211 } NPPrint;
00212 
00213 
00214 #ifdef XP_MAC
00215 /*
00216  *  Mac-specific structures and definitions.
00217  */
00218  
00219 #include <Quickdraw.h>
00220 #include <Events.h>
00221 
00222 typedef struct NP_Port
00223 {
00224     CGrafPtr    port;           /* Grafport */
00225     int32               portx;          /* position inside the topmost window */
00226     int32               porty;
00227 } NP_Port;
00228 
00229 /*
00230  *  Non-standard event types that can be passed to HandleEvent
00231  */
00232 #define getFocusEvent       (osEvt + 16)
00233 #define loseFocusEvent      (osEvt + 17)
00234 #define adjustCursorEvent   (osEvt + 18)
00235 
00236 #endif /* XP_MAC */
00237 
00238 
00239 /*
00240  * Values for mode passed to NPP_New:
00241  */
00242 #define NP_EMBED                1
00243 #define NP_FULL                 2
00244 
00245 /*
00246  * Values for stream type passed to NPP_NewStream:
00247  */
00248 #define NP_NORMAL               1
00249 #define NP_SEEK                 2
00250 #define NP_ASFILE               3
00251 #define NP_ASFILEONLY           4
00252 
00253 #define NP_MAXREADY     (((unsigned)(~0)<<1)>>1)
00254 
00255 
00256 
00257 /*----------------------------------------------------------------------*/
00258 /*                   Error and Reason Code definitions                  */
00259 /*----------------------------------------------------------------------*/
00260 
00261 /*
00262  *      Values of type NPError:
00263  */
00264 #define NPERR_BASE                                                      0
00265 #define NPERR_NO_ERROR                                          (NPERR_BASE + 0)
00266 #define NPERR_GENERIC_ERROR                                     (NPERR_BASE + 1)
00267 #define NPERR_INVALID_INSTANCE_ERROR            (NPERR_BASE + 2)
00268 #define NPERR_INVALID_FUNCTABLE_ERROR           (NPERR_BASE + 3)
00269 #define NPERR_MODULE_LOAD_FAILED_ERROR          (NPERR_BASE + 4)
00270 #define NPERR_OUT_OF_MEMORY_ERROR                       (NPERR_BASE + 5)
00271 #define NPERR_INVALID_PLUGIN_ERROR                      (NPERR_BASE + 6)
00272 #define NPERR_INVALID_PLUGIN_DIR_ERROR          (NPERR_BASE + 7)
00273 #define NPERR_INCOMPATIBLE_VERSION_ERROR        (NPERR_BASE + 8)
00274 #define NPERR_INVALID_PARAM                             (NPERR_BASE + 9)
00275 #define NPERR_INVALID_URL                                       (NPERR_BASE + 10)
00276 #define NPERR_FILE_NOT_FOUND                            (NPERR_BASE + 11)
00277 #define NPERR_NO_DATA                                           (NPERR_BASE + 12)
00278 #define NPERR_STREAM_NOT_SEEKABLE                       (NPERR_BASE + 13)
00279 
00280 /*
00281  *      Values of type NPReason:
00282  */
00283 #define NPRES_BASE                              0
00284 #define NPRES_DONE                                      (NPRES_BASE + 0)
00285 #define NPRES_NETWORK_ERR                       (NPRES_BASE + 1)
00286 #define NPRES_USER_BREAK                        (NPRES_BASE + 2)
00287 
00288 /*
00289  *      Don't use these obsolete error codes any more.
00290  */
00291 #define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
00292 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
00293 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
00294 
00295 /*
00296  * Version feature information
00297  */
00298 #define NPVERS_HAS_STREAMOUTPUT         8
00299 #define NPVERS_HAS_NOTIFICATION         9
00300 #define NPVERS_HAS_LIVECONNECT          9
00301 
00302 
00303 /*----------------------------------------------------------------------*/
00304 /*                   Function Prototypes                                */
00305 /*----------------------------------------------------------------------*/
00306 
00307 #if defined(_WINDOWS) && !defined(WIN32)
00308 #define NP_LOADDS  _loadds
00309 #else
00310 #define NP_LOADDS
00311 #endif
00312 
00313 #ifdef __cplusplus
00314 extern "C" {
00315 #endif
00316 
00317 /*
00318  * NPP_* functions are provided by the plugin and called by the navigator.
00319  */
00320 
00321 #ifdef XP_UNIX
00322 char*                                   NPP_GetMIMEDescription(void);
00323 NPError                                 NPP_GetValue(void *instance, NPPVariable variable,
00324                                                                          void *value);
00325 #endif /* XP_UNIX */
00326 NPError                 NPP_Initialize(void);
00327 void                    NPP_Shutdown(void);
00328 NPError     NP_LOADDS   NPP_New(NPMIMEType pluginType, NPP instance,
00329                                                                 uint16 mode, int16 argc, char* argn[],
00330                                                                 char* argv[], NPSavedData* saved);
00331 NPError     NP_LOADDS   NPP_Destroy(NPP instance, NPSavedData** save);
00332 NPError     NP_LOADDS   NPP_SetWindow(NPP instance, NPWindow* window);
00333 NPError     NP_LOADDS   NPP_NewStream(NPP instance, NPMIMEType type,
00334                                                                           NPStream* stream, NPBool seekable,
00335                                                                           uint16* stype);
00336 NPError     NP_LOADDS   NPP_DestroyStream(NPP instance, NPStream* stream,
00337                                                                                   NPReason reason);
00338 int32       NP_LOADDS   NPP_WriteReady(NPP instance, NPStream* stream);
00339 int32       NP_LOADDS   NPP_Write(NPP instance, NPStream* stream, int32 offset,
00340                                                                   int32 len, void* buffer);
00341 void        NP_LOADDS   NPP_StreamAsFile(NPP instance, NPStream* stream,
00342                                                                                  const char* fname);
00343 void        NP_LOADDS   NPP_Print(NPP instance, NPPrint* platformPrint);
00344 int16                   NPP_HandleEvent(NPP instance, void* event);
00345 void                    NPP_URLNotify(NPP instance, const char* url,
00346                                                                           NPReason reason, void* notifyData);
00347 jref                                    NPP_GetJavaClass(void);
00348 
00349 
00350 /*
00351  * NPN_* functions are provided by the navigator and called by the plugin.
00352  */
00353  
00354 #ifdef XP_UNIX
00355 NPError                 NPN_GetValue(NPP instance, NPNVariable variable,
00356                                                          void *value);
00357 #endif /* XP_UNIX */
00358 void            NPN_Version(int* plugin_major, int* plugin_minor,
00359                                                         int* netscape_major, int* netscape_minor);
00360 NPError         NPN_GetURLNotify(NPP instance, const char* url,
00361                                                                  const char* target, void* notifyData);
00362 NPError         NPN_GetURL(NPP instance, const char* url,
00363                                                    const char* target);
00364 NPError         NPN_PostURLNotify(NPP instance, const char* url,
00365                                                                   const char* target, uint32 len,
00366                                                                   const char* buf, NPBool file,
00367                                                                   void* notifyData);
00368 NPError         NPN_PostURL(NPP instance, const char* url,
00369                                                         const char* target, uint32 len,
00370                                                         const char* buf, NPBool file);
00371 NPError         NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
00372 NPError         NPN_NewStream(NPP instance, NPMIMEType type,
00373                                                           const char* target, NPStream** stream);
00374 int32           NPN_Write(NPP instance, NPStream* stream, int32 len,
00375                                                   void* buffer);
00376 NPError                 NPN_DestroyStream(NPP instance, NPStream* stream,
00377                                                                   NPReason reason);
00378 void            NPN_Status(NPP instance, const char* message);
00379 const char*     NPN_UserAgent(NPP instance);
00380 void*           NPN_MemAlloc(uint32 size);
00381 void            NPN_MemFree(void* ptr);
00382 uint32          NPN_MemFlush(uint32 size);
00383 void                    NPN_ReloadPlugins(NPBool reloadPages);
00384 JRIEnv*                 NPN_GetJavaEnv(void);
00385 jref                    NPN_GetJavaPeer(NPP instance);
00386 
00387 
00388 #ifdef __cplusplus
00389 }  /* end extern "C" */
00390 #endif
00391 
00392 #endif /* _NPAPI_H_ */

Generated on Thu Nov 25 15:42:53 2004 for iARS(internetAudioRenderingSystem) by  doxygen 1.3.9.1