source: terepaima/signHash/include/npfunctions.h @ 0f7c727

Last change on this file since 0f7c727 was 0f7c727, checked in by Antonio Araujo <aaraujo@…>, 7 years ago

Agregado directorio signHash que corrresponde a prueba de concepto para firmar un hash con un dispositivo criptográfico en C++. El objetivo es que desde Terepaima se pueda firmar el hash que se recibe del servicio web Murachí.

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