# Opera Plug-in API on Symbian Platform for Rubik

Authors:
  Hanne E. Larsen <hela@opera.com>
Date:
  2003-11-25
Status:
  Initial version
Abstract:
  This document summarizes the differences between the Netscape Plug-in API and the plug-in API on the Symbian platform for Rubik

## 1 Introduction

The purpose of this document is to provide plug-in authors the information they need to write plug-ins that works with the Opera web browser on Symbian Platform for Rubik. The information in this document is based upon three documents:

- The Plug-in Guide as described in Plug-in Guide January 1998
- Software Architecture, version 0.83, dated 17 November 2003, chapter 4.7.5 Netscape Plug-in API
- The plug-in API on Symbian platform for Rubik as described in the header file npupp.h revision 2.5.22.2

## 2 The Plug-in API Methods

Table 2.1 - Initialization and Destruction Methods
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPP_Initialize | void NPP_Initialize(void); | Opera return value not NPError
NPP_Destroy | NPError NPP_Destroy(NPP instance,NPSavedData** save); |
NPP_New | NPError NPP_New(NPMIMEType pluginType,NPP instance,uint16 mode,CDesCArray* argn,CDesCArray* argv,NPSavedData* saved); | Parameter mode: NP_EMBED=1 NP_FULL=2 Parameter argc missing Parameter saved always null
(destroyed upon plug-in destruction)
NPP_Shutdown | void NPP_Shutdown(void); |

Table 2.2 - Drawing Methods
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPP_GetValue | NPError NPP_GetValue(NPP instance, NPPVariable variable,void *ret_value); | Parameter variable includes NPPVpluginProgressBar Parameter ret_value returns: NPPVpluginProgressBar - TRUE or FALSE
NPP_HandleEvent | int16 NPP_HandleEventUPP(NPP instance, void* event); | Not in use
NPP_Print | void NPP_Print(NPP instance, NPPrint* platformPrint); | Not in use
NPP_SetValue | NPError NPP_SetValue(NPP instance, NPNVariable variable, void *ret_value); | Not in use
NPP_SetWindow | NPError NPP_SetWindow(NPP instance, NPWindow* window); |
NPN_ForceRedraw | void NPN_ForceRedraw(NPP instance); | No action
NPN_InvalidateRect | void NPN_InvalidateRect(NPP instance, NPRect *rect); | No action
NPN_InvalidateRegion | void NPN_InvalidateRegion(NPP instance, NPRegion region); | No action
NPN_GetValue | NPError NPN_GetValue(NPP instance,NPNVariable variable,void *ret_value); | Parameter ret_value returns: NPNVnetscapeWindow - window handle NPNVjavascriptEnabledBool - TRUE or FALSE NPNVasdEnabledBool - always FALSE NPNVisOfflineBool - always FALSE
NPN_SetValue | NPError NPN_SetValueUPP(NPP instance,NPPVariable variable,void *ret_value); | No action

Table 2.3 - Stream Methods
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPP_DestroyStream | NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); |
NPP_NewStream | NPError NPP_NewStream(NPP instance,NPMIMEType type,NPStream* stream,NPBool seekable,uint16* stype); | Parameter stype: NP_NORMAL=1 NP_SEEK=2 NP_ASFILE=3 NP_ASFILEONLY=4
NPP_StreamAsFile | void NPP_StreamAsFile(NPP instance, NPStream* stream, const TDesC& fname); | Parameter fname not char*
NPP_Write | int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); |
NPP_WriteReady | int32 NPP_WriteReady(NPP instance, NPStream* stream); |
NPN_DestroyStream | NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); | No action
NPN_NewStream | NPError NPN_NewStream(NPP instance, NPMIMEType type, const TDesC* window, NPStream** stream); | No action
NPN_RequestRead | NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); | No action
NPN_Write | int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer); | No action

Table 2.4 - URL Methods
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPP_URLNotify | void NPP_URLNotify(NPP instance, const TDesC& url, NPReason reason, void* notifyData); | Parameter url not char*
NPN_GetURL | NPError NPN_GetURL(NPP instance, const TDesC& url, const TDesC* target); | Parameters url and target not char*
NPN_GetURLNotify | NPError NPN_GetURLNotify(NPP instance, const TDesC& url, const TDesC* target, void* notifyData); | Parameters url and target not char*
NPN_PostURL | NPError NPN_PostURL(NPP instance, const TDesC& url, const TDesC* target, const TDesC& buf, NPBool file); | Parameters url, target and buf not char* Parameter len missing
NPN_PostURLNotify | NPError NPN_PostURLNotify(NPP instance,const TDesC& url,const TDesC* target,const TDesC& buf,NPBool file,void* notifyData); | Parameters url, target and buf not char* Parameter len missing

Table 2.5 - Memory Methods
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPN_MemAlloc | void* NPN_MemAlloc(uint32 size); |
NPN_MemFlush | uint32 NPN_MemFlush(uint32 size); | No action
NPN_MemFree | void NPN_MemFree(void* ptr); |

Table 2.6 - Utility Methods
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPN_ReloadPlugins | void NPN_ReloadPlugins(NPBool reloadPages); |
NPN_Status | void NPN_Status(NPP instance, const TDesC& message); | Parameter message not char*
NPN_UserAgent | const TDesC* NPN_UserAgent(NPP instance); | Opera return value not char*
NPN_Version | void NPN_Version(int* plugin_major,int* plugin_minor,int* netscape_major,int* netscape_minor); | Generated by plugin SDK

Table 2.7 - Methods for communicating with Java
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPP_GetJavaClass |  | not implemented
NPN_GetJavaEnv | void* NPN_GetJavaEnv(void); | deprecated, remains here and in upstream NPAPI SDK headers as a stub for compatibility reasons only.
NPN_GetJavaPeer | void* NPN_GetJavaPeer(NPP instance); | deprecated, remains here and in upstream NPAPI SDK headers as a stub for compatibility reasons only.

## 3. Types

Table 3.1 - Structures
NS4 Plug-in API | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPByteRange | typedef struct _NPByteRange { int32 offset; uint32 length; struct _NPByteRange* next;
} NPByteRange;
NPEmbedPrint | typedef struct _NPEmbedPrint { NPWindow window; void* platformPrint; } NPEmbedPrint; |
NPFullPrint | typedef struct _NPFullPrint { NPBool pluginPrinted; NPBool printOne; void* platformPrint;
} NPFullPrint;
NPP | typedef struct _NPP { void* pdata; void* ndata; } NPP_t;
typedef NPP_t* NPP;
NPPrint | typedef struct _NPPrint { uint16 mode; union {
NPFullPrint fullPrint;
NPEmbedPrint embedPrint;
} print;
} NPPrint;
NPRect | typedef struct _NPRect { uint16 top; uint16 left; uint16 bottom;
uint16 right;
} NPRect;
NPSavedData | typedef struct _NPSavedData { int32 len; void* buf; } NPSavedData; |
NPStream | typedef struct _NPStream { void* pdata; void* ndata; HBufC* url;
uint32 end;
uint32 lastmodified;
void* notifyData;
} NPStream;
Parameter url not char*
NPWindow | typedef struct _NPWindow { void* window; int32 x; int32 y;
uint32 width;
uint32 height;
NPRect clipRect;
NPWindowType type;
} NPWindow;

Table 3.2 - Enum Types
Type | Opera Plug-in API on Symbian platform for Rubik | Remarks
--- | --- | ---
NPWindowType | void* NPWindowTypeWindow = 1, NPWindowTypeDrawable |
NPPVariable | NPPVpluginNameString = 1, NPPVpluginDescriptionString, NPPVpluginWindowBool, NPPVpluginTransparentBool, NPPVpluginProgressBar | Parameter NPPVpluginProgressBar added
NPNVariable | NPNVxDisplay = 1, NPNVxtAppContext, NPNVnetscapeWindow, NPNVjavascriptEnabledBool, NPNVasdEnabledBool,
NPNVisOfflineBool