OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 /* ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ |
| 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 12 * for the specific language governing rights and limitations under the |
| 13 * License. |
| 14 * |
| 15 * The Original Code is mozilla.org code. |
| 16 * |
| 17 * The Initial Developer of the Original Code is |
| 18 * Netscape Communications Corporation. |
| 19 * Portions created by the Initial Developer are Copyright (C) 1998 |
| 20 * the Initial Developer. All Rights Reserved. |
| 21 * |
| 22 * Contributor(s): |
| 23 * |
| 24 * Alternatively, the contents of this file may be used under the terms of |
| 25 * either the GNU General Public License Version 2 or later (the "GPL"), or |
| 26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
| 27 * in which case the provisions of the GPL or the LGPL are applicable instead |
| 28 * of those above. If you wish to allow use of your version of this file only |
| 29 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 30 * use your version of this file under the terms of the MPL, indicate your |
| 31 * decision by deleting the provisions above and replace them with the notice |
| 32 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 33 * the provisions above, a recipient may use your version of this file under |
| 34 * the terms of any one of the MPL, the GPL or the LGPL. |
| 35 * |
| 36 * ***** END LICENSE BLOCK ***** */ |
| 37 |
| 38 #ifndef npfunctions_h_ |
| 39 #define npfunctions_h_ |
| 40 |
| 41 #ifdef __OS2__ |
| 42 #pragma pack(1) |
| 43 #define NP_LOADDS _System |
| 44 #else |
| 45 #define NP_LOADDS |
| 46 #endif |
| 47 |
| 48 #include "npapi.h" |
| 49 #include "npruntime.h" |
| 50 |
| 51 typedef void (* NP_LOADDS NPP_InitializeProcPtr)(); |
| 52 typedef void (* NP_LOADDS NPP_ShutdownProcPtr)(); |
| 53 typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP ins
tance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* sav
ed); |
| 54 typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData*
* save); |
| 55 typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow*
window); |
| 56 typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType
type, NPStream* stream, NPBool seekable, uint16_t* stype); |
| 57 typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStre
am* stream, NPReason reason); |
| 58 typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream*
stream); |
| 59 typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stre
am, int32_t offset, int32_t len, void* buffer); |
| 60 typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStrea
m* stream, const char* fname); |
| 61 typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platf
ormPrint); |
| 62 typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* ev
ent); |
| 63 typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char
* url, NPReason reason, void* notifyData); |
| 64 /* Any NPObjects returned to the browser via NPP_GetValue should be retained |
| 65 by the plugin on the way out. The browser is responsible for releasing. */ |
| 66 typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable
variable, void *ret_value); |
| 67 typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable
variable, void *value); |
| 68 |
| 69 typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable,
void *ret_value); |
| 70 typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable,
void *value); |
| 71 typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, c
onst char* window, void* notifyData); |
| 72 typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url,
const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData
); |
| 73 typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const c
har* window); |
| 74 typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const
char* window, uint32_t len, const char* buf, NPBool file); |
| 75 typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* ra
ngeList); |
| 76 typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, cons
t char* window, NPStream** stream); |
| 77 typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t
len, void* buffer); |
| 78 typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream,
NPReason reason); |
| 79 typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message); |
| 80 /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't |
| 81 depend on it sticking around and don't free it. */ |
| 82 typedef const char* (*NPN_UserAgentProcPtr)(NPP instance); |
| 83 typedef void* (*NPN_MemAllocProcPtr)(uint32_t size); |
| 84 typedef void (*NPN_MemFreeProcPtr)(void* ptr); |
| 85 typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size); |
| 86 typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages); |
| 87 typedef void* (*NPN_GetJavaEnvProcPtr)(); |
| 88 typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); |
| 89 typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect); |
| 90 typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion regio
n); |
| 91 typedef void (*NPN_ForceRedrawProcPtr)(NPP instance); |
| 92 typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name); |
| 93 typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, in
t32_t nameCount, NPIdentifier* identifiers); |
| 94 typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid); |
| 95 typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier); |
| 96 typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier); |
| 97 typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier); |
| 98 typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass); |
| 99 typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj); |
| 100 typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj); |
| 101 typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier m
ethodName, const NPVariant *args, uint32_t argCount, NPVariant *result); |
| 102 typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const N
PVariant *args, uint32_t argCount, NPVariant *result); |
| 103 typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *sc
ript, NPVariant *result); |
| 104 typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentif
ier propertyName, NPVariant *result); |
| 105 typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentif
ier propertyName, const NPVariant *value); |
| 106 typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIden
tifier propertyName); |
| 107 typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentif
ier propertyName); |
| 108 typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifie
r propertyName); |
| 109 typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant); |
| 110 typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *mes
sage); |
| 111 typedef bool (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enable
d); |
| 112 typedef bool (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); |
| 113 typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifie
r **identifier, uint32_t *count); |
| 114 typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*fu
nc)(void *), void *userData); |
| 115 typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVar
iant *args, uint32_t argCount, NPVariant *result); |
| 116 typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable,
const char *url, char **value, uint32_t *len); |
| 117 typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable,
const char *url, const char *value, uint32_t len); |
| 118 typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protoc
ol, const char *host, int32_t port, const char *scheme, const char *realm, char
**username, uint32_t *ulen, char **password, uint32_t *plen); |
| 119 typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NP
Bool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); |
| 120 typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID); |
| 121 typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu); |
| 122 typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double
sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordin
ateSpace destSpace); |
| 123 |
| 124 typedef struct _NPPluginFuncs { |
| 125 uint16_t size; |
| 126 uint16_t version; |
| 127 NPP_NewProcPtr newp; |
| 128 NPP_DestroyProcPtr destroy; |
| 129 NPP_SetWindowProcPtr setwindow; |
| 130 NPP_NewStreamProcPtr newstream; |
| 131 NPP_DestroyStreamProcPtr destroystream; |
| 132 NPP_StreamAsFileProcPtr asfile; |
| 133 NPP_WriteReadyProcPtr writeready; |
| 134 NPP_WriteProcPtr write; |
| 135 NPP_PrintProcPtr print; |
| 136 NPP_HandleEventProcPtr event; |
| 137 NPP_URLNotifyProcPtr urlnotify; |
| 138 void* javaClass; |
| 139 NPP_GetValueProcPtr getvalue; |
| 140 NPP_SetValueProcPtr setvalue; |
| 141 } NPPluginFuncs; |
| 142 |
| 143 typedef struct _NPNetscapeFuncs { |
| 144 uint16_t size; |
| 145 uint16_t version; |
| 146 NPN_GetURLProcPtr geturl; |
| 147 NPN_PostURLProcPtr posturl; |
| 148 NPN_RequestReadProcPtr requestread; |
| 149 NPN_NewStreamProcPtr newstream; |
| 150 NPN_WriteProcPtr write; |
| 151 NPN_DestroyStreamProcPtr destroystream; |
| 152 NPN_StatusProcPtr status; |
| 153 NPN_UserAgentProcPtr uagent; |
| 154 NPN_MemAllocProcPtr memalloc; |
| 155 NPN_MemFreeProcPtr memfree; |
| 156 NPN_MemFlushProcPtr memflush; |
| 157 NPN_ReloadPluginsProcPtr reloadplugins; |
| 158 NPN_GetJavaEnvProcPtr getJavaEnv; |
| 159 NPN_GetJavaPeerProcPtr getJavaPeer; |
| 160 NPN_GetURLNotifyProcPtr geturlnotify; |
| 161 NPN_PostURLNotifyProcPtr posturlnotify; |
| 162 NPN_GetValueProcPtr getvalue; |
| 163 NPN_SetValueProcPtr setvalue; |
| 164 NPN_InvalidateRectProcPtr invalidaterect; |
| 165 NPN_InvalidateRegionProcPtr invalidateregion; |
| 166 NPN_ForceRedrawProcPtr forceredraw; |
| 167 NPN_GetStringIdentifierProcPtr getstringidentifier; |
| 168 NPN_GetStringIdentifiersProcPtr getstringidentifiers; |
| 169 NPN_GetIntIdentifierProcPtr getintidentifier; |
| 170 NPN_IdentifierIsStringProcPtr identifierisstring; |
| 171 NPN_UTF8FromIdentifierProcPtr utf8fromidentifier; |
| 172 NPN_IntFromIdentifierProcPtr intfromidentifier; |
| 173 NPN_CreateObjectProcPtr createobject; |
| 174 NPN_RetainObjectProcPtr retainobject; |
| 175 NPN_ReleaseObjectProcPtr releaseobject; |
| 176 NPN_InvokeProcPtr invoke; |
| 177 NPN_InvokeDefaultProcPtr invokeDefault; |
| 178 NPN_EvaluateProcPtr evaluate; |
| 179 NPN_GetPropertyProcPtr getproperty; |
| 180 NPN_SetPropertyProcPtr setproperty; |
| 181 NPN_RemovePropertyProcPtr removeproperty; |
| 182 NPN_HasPropertyProcPtr hasproperty; |
| 183 NPN_HasMethodProcPtr hasmethod; |
| 184 NPN_ReleaseVariantValueProcPtr releasevariantvalue; |
| 185 NPN_SetExceptionProcPtr setexception; |
| 186 NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate; |
| 187 NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate; |
| 188 NPN_EnumerateProcPtr enumerate; |
| 189 NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; |
| 190 NPN_ConstructProcPtr construct; |
| 191 NPN_GetValueForURLPtr getvalueforurl; |
| 192 NPN_SetValueForURLPtr setvalueforurl; |
| 193 NPN_GetAuthenticationInfoPtr getauthenticationinfo; |
| 194 NPN_ScheduleTimerPtr scheduletimer; |
| 195 NPN_UnscheduleTimerPtr unscheduletimer; |
| 196 NPN_PopUpContextMenuPtr popupcontextmenu; |
| 197 NPN_ConvertPointPtr convertpoint; |
| 198 } NPNetscapeFuncs; |
| 199 |
| 200 #ifdef XP_MACOSX |
| 201 /* |
| 202 * Mac OS X version(s) of NP_GetMIMEDescription(const char *) |
| 203 * These can be called to retreive MIME information from the plugin dynamically |
| 204 * |
| 205 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way |
| 206 * to get mime info from the plugin only on OSX and may not be supported |
| 207 * in furture version -- use NP_GetMIMEDescription instead |
| 208 */ |
| 209 enum |
| 210 { |
| 211 kBPSupportedMIMETypesStructVers_1 = 1 |
| 212 }; |
| 213 typedef struct _BPSupportedMIMETypes |
| 214 { |
| 215 SInt32 structVersion; /* struct version */ |
| 216 Handle typeStrings; /* STR# formated handle, allocated by plug-in */ |
| 217 Handle infoStrings; /* STR# formated handle, allocated by plug-in */ |
| 218 } BPSupportedMIMETypes; |
| 219 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags); |
| 220 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription" |
| 221 typedef const char* (*NP_GetMIMEDescriptionProcPtr)(); |
| 222 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); |
| 223 #endif |
| 224 |
| 225 #if defined(_WINDOWS) |
| 226 #define OSCALL WINAPI |
| 227 #else |
| 228 #if defined(__OS2__) |
| 229 #define OSCALL _System |
| 230 #else |
| 231 #define OSCALL |
| 232 #endif |
| 233 #endif |
| 234 |
| 235 #if defined(XP_UNIX) |
| 236 /* GCC 3.3 and later support the visibility attribute. */ |
| 237 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >=
3)) |
| 238 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default"))) |
| 239 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
| 240 #define NP_VISIBILITY_DEFAULT __global |
| 241 #else |
| 242 #define NP_VISIBILITY_DEFAULT |
| 243 #endif |
| 244 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type |
| 245 #endif |
| 246 |
| 247 #if defined(_WINDOWS) || defined (__OS2__) |
| 248 #ifdef __cplusplus |
| 249 extern "C" { |
| 250 #endif |
| 251 /* plugin meta member functions */ |
| 252 #if defined(__OS2__) |
| 253 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */ |
| 254 char *pMimeTypes; |
| 255 char *pFileExtents; |
| 256 char *pFileOpenTemplate; |
| 257 char *pProductName; |
| 258 char *pProductDescription; |
| 259 unsigned long dwProductVersionMS; |
| 260 unsigned long dwProductVersionLS; |
| 261 } NPPluginData; |
| 262 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData); |
| 263 #endif |
| 264 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs); |
| 265 NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs); |
| 266 NPError OSCALL NP_Shutdown(); |
| 267 char* NP_GetMIMEDescription(); |
| 268 #ifdef __cplusplus |
| 269 } |
| 270 #endif |
| 271 #endif |
| 272 |
| 273 #if defined(__OS2__) |
| 274 #pragma pack() |
| 275 #endif |
| 276 |
| 277 #ifdef XP_UNIX |
| 278 #ifdef __cplusplus |
| 279 extern "C" { |
| 280 #endif |
| 281 NP_EXPORT(char*) NP_GetPluginVersion(); |
| 282 NP_EXPORT(char*) NP_GetMIMEDescription(); |
| 283 #ifdef XP_MACOSX |
| 284 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs); |
| 285 NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs); |
| 286 #else |
| 287 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
; |
| 288 #endif |
| 289 NP_EXPORT(NPError) NP_Shutdown(); |
| 290 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue
); |
| 291 #ifdef __cplusplus |
| 292 } |
| 293 #endif |
| 294 #endif |
| 295 |
| 296 #endif /* npfunctions_h_ */ |
OLD | NEW |