PageRenderTime 36ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/npapi/npfunctions.h

http://firefox-mac-pdf.googlecode.com/
C Header | 320 lines | 256 code | 14 blank | 50 comment | 6 complexity | 796ca91dde39af7bb64ff09fb5fb04ee MD5 | raw file
  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. #ifndef npfunctions_h_
  38. #define npfunctions_h_
  39. #ifdef __OS2__
  40. #pragma pack(1)
  41. #define NP_LOADDS _System
  42. #else
  43. #define NP_LOADDS
  44. #endif
  45. #include "npapi.h"
  46. #include "npruntime.h"
  47. typedef void (* NP_LOADDS NPP_InitializeProcPtr)(void);
  48. typedef void (* NP_LOADDS NPP_ShutdownProcPtr)(void);
  49. typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
  50. typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
  51. typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
  52. typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
  53. typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
  54. typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
  55. typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
  56. typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
  57. typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
  58. typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
  59. typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
  60. /* Any NPObjects returned to the browser via NPP_GetValue should be retained
  61. by the plugin on the way out. The browser is responsible for releasing. */
  62. typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
  63. typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
  64. typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
  65. typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
  66. typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
  67. typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
  68. typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
  69. typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
  70. typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
  71. typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
  72. typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
  73. typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
  74. typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
  75. typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
  76. typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
  77. typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
  78. /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
  79. depend on it sticking around and don't free it. */
  80. typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
  81. typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
  82. typedef void (*NPN_MemFreeProcPtr)(void* ptr);
  83. typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
  84. typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
  85. typedef void* (*NPN_GetJavaEnvProcPtr)(void);
  86. typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
  87. typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
  88. typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
  89. typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
  90. typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
  91. typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
  92. typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
  93. typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
  94. typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
  95. typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
  96. typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
  97. typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
  98. typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
  99. typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
  100. typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
  101. typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
  102. typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
  103. typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
  104. typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  105. typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  106. typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  107. typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
  108. typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
  109. typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
  110. typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
  111. typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
  112. typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
  113. typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
  114. typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
  115. typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
  116. typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen);
  117. typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
  118. typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
  119. typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
  120. typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
  121. typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
  122. typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
  123. typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
  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. NPP_GotFocusPtr gotfocus;
  142. NPP_LostFocusPtr lostfocus;
  143. NPP_URLRedirectNotifyPtr urlredirectnotify;
  144. } NPPluginFuncs;
  145. typedef struct _NPNetscapeFuncs {
  146. uint16_t size;
  147. uint16_t version;
  148. NPN_GetURLProcPtr geturl;
  149. NPN_PostURLProcPtr posturl;
  150. NPN_RequestReadProcPtr requestread;
  151. NPN_NewStreamProcPtr newstream;
  152. NPN_WriteProcPtr write;
  153. NPN_DestroyStreamProcPtr destroystream;
  154. NPN_StatusProcPtr status;
  155. NPN_UserAgentProcPtr uagent;
  156. NPN_MemAllocProcPtr memalloc;
  157. NPN_MemFreeProcPtr memfree;
  158. NPN_MemFlushProcPtr memflush;
  159. NPN_ReloadPluginsProcPtr reloadplugins;
  160. NPN_GetJavaEnvProcPtr getJavaEnv;
  161. NPN_GetJavaPeerProcPtr getJavaPeer;
  162. NPN_GetURLNotifyProcPtr geturlnotify;
  163. NPN_PostURLNotifyProcPtr posturlnotify;
  164. NPN_GetValueProcPtr getvalue;
  165. NPN_SetValueProcPtr setvalue;
  166. NPN_InvalidateRectProcPtr invalidaterect;
  167. NPN_InvalidateRegionProcPtr invalidateregion;
  168. NPN_ForceRedrawProcPtr forceredraw;
  169. NPN_GetStringIdentifierProcPtr getstringidentifier;
  170. NPN_GetStringIdentifiersProcPtr getstringidentifiers;
  171. NPN_GetIntIdentifierProcPtr getintidentifier;
  172. NPN_IdentifierIsStringProcPtr identifierisstring;
  173. NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
  174. NPN_IntFromIdentifierProcPtr intfromidentifier;
  175. NPN_CreateObjectProcPtr createobject;
  176. NPN_RetainObjectProcPtr retainobject;
  177. NPN_ReleaseObjectProcPtr releaseobject;
  178. NPN_InvokeProcPtr invoke;
  179. NPN_InvokeDefaultProcPtr invokeDefault;
  180. NPN_EvaluateProcPtr evaluate;
  181. NPN_GetPropertyProcPtr getproperty;
  182. NPN_SetPropertyProcPtr setproperty;
  183. NPN_RemovePropertyProcPtr removeproperty;
  184. NPN_HasPropertyProcPtr hasproperty;
  185. NPN_HasMethodProcPtr hasmethod;
  186. NPN_ReleaseVariantValueProcPtr releasevariantvalue;
  187. NPN_SetExceptionProcPtr setexception;
  188. NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
  189. NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
  190. NPN_EnumerateProcPtr enumerate;
  191. NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
  192. NPN_ConstructProcPtr construct;
  193. NPN_GetValueForURLPtr getvalueforurl;
  194. NPN_SetValueForURLPtr setvalueforurl;
  195. NPN_GetAuthenticationInfoPtr getauthenticationinfo;
  196. NPN_ScheduleTimerPtr scheduletimer;
  197. NPN_UnscheduleTimerPtr unscheduletimer;
  198. NPN_PopUpContextMenuPtr popupcontextmenu;
  199. NPN_ConvertPointPtr convertpoint;
  200. NPN_HandleEventPtr handleevent;
  201. NPN_UnfocusInstancePtr unfocusinstance;
  202. NPN_URLRedirectResponsePtr urlredirectresponse;
  203. } NPNetscapeFuncs;
  204. #ifdef XP_MACOSX
  205. /*
  206. * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
  207. * These can be called to retreive MIME information from the plugin dynamically
  208. *
  209. * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
  210. * to get mime info from the plugin only on OSX and may not be supported
  211. * in furture version -- use NP_GetMIMEDescription instead
  212. */
  213. enum
  214. {
  215. kBPSupportedMIMETypesStructVers_1 = 1
  216. };
  217. typedef struct _BPSupportedMIMETypes
  218. {
  219. SInt32 structVersion; /* struct version */
  220. Handle typeStrings; /* STR# formated handle, allocated by plug-in */
  221. Handle infoStrings; /* STR# formated handle, allocated by plug-in */
  222. } BPSupportedMIMETypes;
  223. OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
  224. #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
  225. typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
  226. typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
  227. #endif
  228. #if defined(_WIN32)
  229. #define OSCALL WINAPI
  230. #else
  231. #if defined(__OS2__)
  232. #define OSCALL _System
  233. #else
  234. #define OSCALL
  235. #endif
  236. #endif
  237. #if defined(XP_UNIX)
  238. /* GCC 3.3 and later support the visibility attribute. */
  239. #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
  240. #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
  241. #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  242. #define NP_VISIBILITY_DEFAULT __global
  243. #else
  244. #define NP_VISIBILITY_DEFAULT
  245. #endif
  246. #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
  247. #endif
  248. #if defined(_WIN32) || defined (__OS2__)
  249. #ifdef __cplusplus
  250. extern "C" {
  251. #endif
  252. /* plugin meta member functions */
  253. #if defined(__OS2__)
  254. typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
  255. char *pMimeTypes;
  256. char *pFileExtents;
  257. char *pFileOpenTemplate;
  258. char *pProductName;
  259. char *pProductDescription;
  260. unsigned long dwProductVersionMS;
  261. unsigned long dwProductVersionLS;
  262. } NPPluginData;
  263. typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*);
  264. NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
  265. #endif
  266. typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
  267. NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
  268. typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
  269. NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
  270. typedef NPError (*NP_ShutdownFunc)(void);
  271. NPError OSCALL NP_Shutdown(void);
  272. typedef char* (*NP_GetMIMEDescriptionFunc)(void);
  273. char* NP_GetMIMEDescription(void);
  274. #ifdef __cplusplus
  275. }
  276. #endif
  277. #endif
  278. #if defined(__OS2__)
  279. #pragma pack()
  280. #endif
  281. #ifdef XP_UNIX
  282. #ifdef __cplusplus
  283. extern "C" {
  284. #endif
  285. typedef char* (*NP_GetPluginVersionFunc)(void);
  286. NP_EXPORT(char*) NP_GetPluginVersion(void);
  287. typedef char* (*NP_GetMIMEDescriptionFunc)(void);
  288. NP_EXPORT(char*) NP_GetMIMEDescription(void);
  289. #ifdef XP_MACOSX
  290. typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
  291. NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
  292. typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
  293. NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
  294. #else
  295. typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
  296. NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
  297. #endif
  298. typedef NPError (*NP_ShutdownFunc)(void);
  299. NP_EXPORT(NPError) NP_Shutdown(void);
  300. typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
  301. NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305. #endif
  306. #endif /* npfunctions_h_ */