Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
npunix.c File Reference
#include <stdio.h>
#include "npapi.h"
#include "npupp.h"

Go to the source code of this file.

Defines

#define XP_UNIX   1
#define PLUGINDEBUGSTR(msg)

Functions

void NPN_Version (int *plugin_major, int *plugin_minor, int *netscape_major, int *netscape_minor)
NPError NPN_GetValue (NPP instance, NPNVariable variable, void *r_value)
NPError NPN_SetValue (NPP instance, NPPVariable variable, void *value)
NPError NPN_GetURL (NPP instance, const char *url, const char *window)
NPError NPN_GetURLNotify (NPP instance, const char *url, const char *window, void *notifyData)
NPError NPN_PostURL (NPP instance, const char *url, const char *window, uint32 len, const char *buf, NPBool file)
NPError NPN_PostURLNotify (NPP instance, const char *url, const char *window, uint32 len, const char *buf, NPBool file, void *notifyData)
NPError NPN_RequestRead (NPStream *stream, NPByteRange *rangeList)
NPError NPN_NewStream (NPP instance, NPMIMEType type, const char *window, NPStream **stream_ptr)
int32 NPN_Write (NPP instance, NPStream *stream, int32 len, void *buffer)
NPError NPN_DestroyStream (NPP instance, NPStream *stream, NPError reason)
void NPN_Status (NPP instance, const char *message)
const char * NPN_UserAgent (NPP instance)
voidNPN_MemAlloc (uint32 size)
void NPN_MemFree (void *ptr)
uint32 NPN_MemFlush (uint32 size)
void NPN_ReloadPlugins (NPBool reloadPages)
void NPN_InvalidateRect (NPP instance, NPRect *invalidRect)
void NPN_InvalidateRegion (NPP instance, NPRegion invalidRegion)
void NPN_ForceRedraw (NPP instance)
void NPN_PushPopupsEnabledState (NPP instance, NPBool enabled)
void NPN_PopPopupsEnabledState (NPP instance)
NPError Private_New (NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
NPError Private_Destroy (NPP instance, NPSavedData **save)
NPError Private_SetWindow (NPP instance, NPWindow *window)
NPError Private_NewStream (NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
int32 Private_WriteReady (NPP instance, NPStream *stream)
int32 Private_Write (NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
void Private_StreamAsFile (NPP instance, NPStream *stream, const char *fname)
NPError Private_DestroyStream (NPP instance, NPStream *stream, NPError reason)
void Private_URLNotify (NPP instance, const char *url, NPReason reason, void *notifyData)
void Private_Print (NPP instance, NPPrint *platformPrint)
char * NP_GetMIMEDescription (void)
NPError NP_GetValue (void *future, NPPVariable variable, void *value)
NPError NP_Initialize (NPNetscapeFuncs *nsTable, NPPluginFuncs *pluginFuncs)
NPError NP_Shutdown (void)

Variables

static NPNetscapeFuncs gNetscapeFuncs

Define Documentation

Definition at line 69 of file npunix.c.

#define XP_UNIX   1

Definition at line 54 of file npunix.c.


Function Documentation

Definition at line 383 of file npunix.c.

{
    return NPP_GetMIMEDescription();
}

Here is the call graph for this function:

NPError NP_GetValue ( void future,
NPPVariable  variable,
void value 
)

Definition at line 395 of file npunix.c.

{
    return NPP_GetValue(future, variable, value);
}

Here is the call graph for this function:

NPError NP_Initialize ( NPNetscapeFuncs nsTable,
NPPluginFuncs pluginFuncs 
)

Definition at line 418 of file npunix.c.

{
    NPError err = NPERR_NO_ERROR;

    PLUGINDEBUGSTR("NP_Initialize");
    
    /* validate input parameters */

    if ((nsTable == NULL) || (pluginFuncs == NULL))
        err = NPERR_INVALID_FUNCTABLE_ERROR;
    
    /*
     * Check the major version passed in Netscape's function table.
     * We won't load if the major version is newer than what we expect.
     * Also check that the function tables passed in are big enough for
     * all the functions we need (they could be bigger, if Netscape added
     * new APIs, but that's OK with us -- we'll just ignore them).
     *
     */

    if (err == NPERR_NO_ERROR) {
        if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
            err = NPERR_INCOMPATIBLE_VERSION_ERROR;
        if (nsTable->size < sizeof(NPNetscapeFuncs))
            err = NPERR_INVALID_FUNCTABLE_ERROR;
        if (pluginFuncs->size < sizeof(NPPluginFuncs))      
            err = NPERR_INVALID_FUNCTABLE_ERROR;
    }
        
    
    if (err == NPERR_NO_ERROR) {
        /*
         * Copy all the fields of Netscape function table into our
         * copy so we can call back into Netscape later.  Note that
         * we need to copy the fields one by one, rather than assigning
         * the whole structure, because the Netscape function table
         * could actually be bigger than what we expect.
         */
        gNetscapeFuncs.version       = nsTable->version;
        gNetscapeFuncs.size          = nsTable->size;
        gNetscapeFuncs.posturl       = nsTable->posturl;
        gNetscapeFuncs.geturl        = nsTable->geturl;
        gNetscapeFuncs.geturlnotify  = nsTable->geturlnotify;
        gNetscapeFuncs.requestread   = nsTable->requestread;
        gNetscapeFuncs.newstream     = nsTable->newstream;
        gNetscapeFuncs.write         = nsTable->write;
        gNetscapeFuncs.destroystream = nsTable->destroystream;
        gNetscapeFuncs.status        = nsTable->status;
        gNetscapeFuncs.uagent        = nsTable->uagent;
        gNetscapeFuncs.memalloc      = nsTable->memalloc;
        gNetscapeFuncs.memfree       = nsTable->memfree;
        gNetscapeFuncs.memflush      = nsTable->memflush;
        gNetscapeFuncs.reloadplugins = nsTable->reloadplugins;
#ifdef OJI
        gNetscapeFuncs.getJavaEnv    = nsTable->getJavaEnv;
        gNetscapeFuncs.getJavaPeer   = nsTable->getJavaPeer;
#endif
        gNetscapeFuncs.getvalue      = nsTable->getvalue;
        gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate;
        gNetscapeFuncs.poppopupsenabledstate  = nsTable->poppopupsenabledstate;

        /*
         * Set up the plugin function table that Netscape will use to
         * call us.  Netscape needs to know about our version and size
         * and have a UniversalProcPointer for every function we
         * implement.
         */
        pluginFuncs->version    = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
        pluginFuncs->size       = sizeof(NPPluginFuncs);
        pluginFuncs->newp       = NewNPP_NewProc(Private_New);
        pluginFuncs->destroy    = NewNPP_DestroyProc(Private_Destroy);
        pluginFuncs->setwindow  = NewNPP_SetWindowProc(Private_SetWindow);
        pluginFuncs->newstream  = NewNPP_NewStreamProc(Private_NewStream);
        pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
        pluginFuncs->asfile     = NewNPP_StreamAsFileProc(Private_StreamAsFile);
        pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
        pluginFuncs->write      = NewNPP_WriteProc(Private_Write);
        pluginFuncs->print      = NewNPP_PrintProc(Private_Print);
        pluginFuncs->urlnotify  = NewNPP_URLNotifyProc(Private_URLNotify);
        pluginFuncs->event      = NULL;
#ifdef OJI
        pluginFuncs->javaClass  = Private_GetJavaClass();
#endif

        err = NPP_Initialize();
    }
    
    return err;
}

Here is the call graph for this function:

Definition at line 516 of file npunix.c.

{
    PLUGINDEBUGSTR("NP_Shutdown");
    NPP_Shutdown();
    return NPERR_NO_ERROR;
}

Here is the call graph for this function:

NPError NPN_DestroyStream ( NPP  instance,
NPStream stream,
NPError  reason 
)

Definition at line 170 of file npunix.c.

void NPN_ForceRedraw ( NPP  instance)

Definition at line 237 of file npunix.c.

NPError NPN_GetURL ( NPP  instance,
const char *  url,
const char *  window 
)

Definition at line 120 of file npunix.c.

{
    return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
}
NPError NPN_GetURLNotify ( NPP  instance,
const char *  url,
const char *  window,
void notifyData 
)

Definition at line 126 of file npunix.c.

NPError NPN_GetValue ( NPP  instance,
NPNVariable  variable,
void r_value 
)

Definition at line 106 of file npunix.c.

{
    return CallNPN_GetValueProc(gNetscapeFuncs.getvalue,
                    instance, variable, r_value);
}
void NPN_InvalidateRect ( NPP  instance,
NPRect invalidRect 
)

Definition at line 223 of file npunix.c.

void NPN_InvalidateRegion ( NPP  instance,
NPRegion  invalidRegion 
)

Definition at line 230 of file npunix.c.

void* NPN_MemAlloc ( uint32  size)

Definition at line 189 of file npunix.c.

Definition at line 199 of file npunix.c.

void NPN_MemFree ( void ptr)

Definition at line 194 of file npunix.c.

NPError NPN_NewStream ( NPP  instance,
NPMIMEType  type,
const char *  window,
NPStream **  stream_ptr 
)

Definition at line 155 of file npunix.c.

{
    return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance,
                    type, window, stream_ptr);
}
NPError NPN_PostURL ( NPP  instance,
const char *  url,
const char *  window,
uint32  len,
const char *  buf,
NPBool  file 
)

Definition at line 132 of file npunix.c.

{
    return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
                    url, window, len, buf, file);
}
NPError NPN_PostURLNotify ( NPP  instance,
const char *  url,
const char *  window,
uint32  len,
const char *  buf,
NPBool  file,
void notifyData 
)

Definition at line 140 of file npunix.c.

void NPN_PushPopupsEnabledState ( NPP  instance,
NPBool  enabled 
)

Definition at line 242 of file npunix.c.

void NPN_ReloadPlugins ( NPBool  reloadPages)

Definition at line 204 of file npunix.c.

NPError NPN_RequestRead ( NPStream stream,
NPByteRange rangeList 
)

Definition at line 148 of file npunix.c.

{
    return CallNPN_RequestReadProc(gNetscapeFuncs.requestread,
                    stream, rangeList);
}
NPError NPN_SetValue ( NPP  instance,
NPPVariable  variable,
void value 
)

Definition at line 113 of file npunix.c.

{
    return CallNPN_SetValueProc(gNetscapeFuncs.setvalue,
                    instance, variable, value);
}
void NPN_Status ( NPP  instance,
const char *  message 
)

Definition at line 177 of file npunix.c.

const char* NPN_UserAgent ( NPP  instance)

Definition at line 183 of file npunix.c.

void NPN_Version ( int plugin_major,
int plugin_minor,
int netscape_major,
int netscape_minor 
)

Definition at line 93 of file npunix.c.

{
    *plugin_major = NP_VERSION_MAJOR;
    *plugin_minor = NP_VERSION_MINOR;

    /* Major version is in high byte */
    *netscape_major = gNetscapeFuncs.version >> 8;
    /* Minor version is in low byte */
    *netscape_minor = gNetscapeFuncs.version & 0xFF;
}
int32 NPN_Write ( NPP  instance,
NPStream stream,
int32  len,
void buffer 
)

Definition at line 163 of file npunix.c.

{
    return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
                    stream, len, buffer);
}
NPError Private_Destroy ( NPP  instance,
NPSavedData **  save 
)

Definition at line 278 of file npunix.c.

{
    PLUGINDEBUGSTR("Destroy");
    return NPP_Destroy(instance, save);
}

Here is the call graph for this function:

NPError Private_DestroyStream ( NPP  instance,
NPStream stream,
NPError  reason 
)

Definition at line 331 of file npunix.c.

{
    NPError err;
    PLUGINDEBUGSTR("DestroyStream");
    err = NPP_DestroyStream(instance, stream, reason);
    return err;
}

Here is the call graph for this function:

NPError Private_New ( NPMIMEType  pluginType,
NPP  instance,
uint16  mode,
int16  argc,
char *  argn[],
char *  argv[],
NPSavedData saved 
)

Definition at line 268 of file npunix.c.

{
    NPError ret;
    PLUGINDEBUGSTR("New");
    ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
    return ret; 
}

Here is the call graph for this function:

NPError Private_NewStream ( NPP  instance,
NPMIMEType  type,
NPStream stream,
NPBool  seekable,
uint16 stype 
)

Definition at line 294 of file npunix.c.

{
    NPError err;
    PLUGINDEBUGSTR("NewStream");
    err = NPP_NewStream(instance, type, stream, seekable, stype);
    return err;
}

Here is the call graph for this function:

void Private_Print ( NPP  instance,
NPPrint platformPrint 
)

Definition at line 351 of file npunix.c.

{
    PLUGINDEBUGSTR("Print");
    NPP_Print(instance, platformPrint);
}

Here is the call graph for this function:

NPError Private_SetWindow ( NPP  instance,
NPWindow window 
)

Definition at line 285 of file npunix.c.

{
    NPError err;
    PLUGINDEBUGSTR("SetWindow");
    err = NPP_SetWindow(instance, window);
    return err;
}

Here is the call graph for this function:

void Private_StreamAsFile ( NPP  instance,
NPStream stream,
const char *  fname 
)

Definition at line 323 of file npunix.c.

{
    PLUGINDEBUGSTR("StreamAsFile");
    NPP_StreamAsFile(instance, stream, fname);
}

Here is the call graph for this function:

void Private_URLNotify ( NPP  instance,
const char *  url,
NPReason  reason,
void notifyData 
)

Definition at line 340 of file npunix.c.

{
    PLUGINDEBUGSTR("URLNotify");
    NPP_URLNotify(instance, url, reason, notifyData);
}

Here is the call graph for this function:

int32 Private_Write ( NPP  instance,
NPStream stream,
int32  offset,
int32  len,
void buffer 
)

Definition at line 313 of file npunix.c.

{
    unsigned int result;
    PLUGINDEBUGSTR("Write");
    result = NPP_Write(instance, stream, offset, len, buffer);
    return result;
}

Here is the call graph for this function:

int32 Private_WriteReady ( NPP  instance,
NPStream stream 
)

Definition at line 304 of file npunix.c.

{
    unsigned int result;
    PLUGINDEBUGSTR("WriteReady");
    result = NPP_WriteReady(instance, stream);
    return result;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 79 of file npunix.c.