source: terepaima/signHash/include/npapi.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: 29.8 KB
Line 
1/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 npapi_h_
39#define npapi_h_
40
41#if defined(__OS2__)
42#pragma pack(1)
43#endif
44
45#include "nptypes.h"
46
47#if defined(__OS2__) || defined(OS2)
48#ifndef XP_OS2
49#define XP_OS2 1
50#endif
51#endif
52
53#if defined(_WIN32) && !defined(__SYMBIAN32__)
54#include <windef.h>
55#ifndef XP_WIN
56#define XP_WIN 1
57#endif
58#endif
59
60#if defined(__SYMBIAN32__)
61#ifndef XP_SYMBIAN
62#define XP_SYMBIAN 1
63#undef XP_WIN
64#endif
65#endif
66
67#if defined(__APPLE_CC__) && !defined(XP_UNIX)
68#ifndef XP_MACOSX
69#define XP_MACOSX 1
70#endif
71#endif
72
73#if defined(XP_MACOSX)
74#if !defined(NP_NO_OPENGL)
75#define NP_NO_OPENGL 1
76#endif /* !defined(NP_NO_OPENGL) */
77#if defined(__LP64__)
78#define NP_NO_QUICKDRAW
79#define NP_NO_CARBON
80#endif /* defined(__LP64__) */
81#endif
82
83#if defined(XP_MACOSX)
84#include <ApplicationServices/ApplicationServices.h>
85#if !NP_NO_OPENGL
86#include <OpenGL/OpenGL.h>
87#endif /* !NP_NO_OPENGL */
88#ifndef NP_NO_CARBON
89#include <Carbon/Carbon.h>
90#endif
91#endif
92
93#if defined(XP_UNIX)
94#include <stdio.h>
95#if defined(MOZ_X11)
96#include <X11/Xlib.h>
97#include <X11/Xutil.h>
98#endif
99#endif
100
101#if defined(XP_SYMBIAN)
102#include <QEvent>
103#include <QRegion>
104#endif
105
106/*----------------------------------------------------------------------*/
107/*                        Plugin Version Constants                      */
108/*----------------------------------------------------------------------*/
109
110#define NP_VERSION_MAJOR 0
111#define NP_VERSION_MINOR 27
112
113
114/* The OS/2 version of Netscape uses RC_DATA to define the
115   mime types, file extensions, etc that are required.
116   Use a vertical bar to separate types, end types with \0.
117   FileVersion and ProductVersion are 32bit ints, all other
118   entries are strings that MUST be terminated with a \0.
119
120AN EXAMPLE:
121
122RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
123
124RCDATA NP_INFO_MIMEType    { "video/x-video|",
125                             "video/x-flick\0" }
126RCDATA NP_INFO_FileExtents { "avi|",
127                             "flc\0" }
128RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
129                             "MMOS2 Flc/Fli player(*.flc)\0" }
130
131RCDATA NP_INFO_FileVersion       { 1,0,0,1 }
132RCDATA NP_INFO_CompanyName       { "Netscape Communications\0" }
133RCDATA NP_INFO_FileDescription   { "NPAVI32 Extension DLL\0"
134RCDATA NP_INFO_InternalName      { "NPAVI32\0" )
135RCDATA NP_INFO_LegalCopyright    { "Copyright Netscape Communications \251 1996\0"
136RCDATA NP_INFO_OriginalFilename  { "NVAPI32.DLL" }
137RCDATA NP_INFO_ProductName       { "NPAVI32 Dynamic Link Library\0" }
138*/
139/* RC_DATA types for version info - required */
140#define NP_INFO_ProductVersion      1
141#define NP_INFO_MIMEType            2
142#define NP_INFO_FileOpenName        3
143#define NP_INFO_FileExtents         4
144/* RC_DATA types for version info - used if found */
145#define NP_INFO_FileDescription     5
146#define NP_INFO_ProductName         6
147/* RC_DATA types for version info - optional */
148#define NP_INFO_CompanyName         7
149#define NP_INFO_FileVersion         8
150#define NP_INFO_InternalName        9
151#define NP_INFO_LegalCopyright      10
152#define NP_INFO_OriginalFilename    11
153
154#ifndef RC_INVOKED
155
156/*----------------------------------------------------------------------*/
157/*                       Definition of Basic Types                      */
158/*----------------------------------------------------------------------*/
159
160typedef unsigned char NPBool;
161typedef int16_t       NPError;
162typedef int16_t       NPReason;
163typedef char*         NPMIMEType;
164
165/*----------------------------------------------------------------------*/
166/*                       Structures and definitions                     */
167/*----------------------------------------------------------------------*/
168
169#if !defined(__LP64__)
170#if defined(XP_MACOSX)
171#pragma options align=mac68k
172#endif
173#endif /* __LP64__ */
174
175/*
176 *  NPP is a plug-in's opaque instance handle
177 */
178typedef struct _NPP
179{
180  void* pdata;      /* plug-in private data */
181  void* ndata;      /* netscape private data */
182} NPP_t;
183
184typedef NPP_t*  NPP;
185
186typedef struct _NPStream
187{
188  void*    pdata; /* plug-in private data */
189  void*    ndata; /* netscape private data */
190  const    char* url;
191  uint32_t end;
192  uint32_t lastmodified;
193  void*    notifyData;
194  const    char* headers; /* Response headers from host.
195                           * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
196                           * Used for HTTP only; NULL for non-HTTP.
197                           * Available from NPP_NewStream onwards.
198                           * Plugin should copy this data before storing it.
199                           * Includes HTTP status line and all headers,
200                           * preferably verbatim as received from server,
201                           * headers formatted as in HTTP ("Header: Value"),
202                           * and newlines (\n, NOT \r\n) separating lines.
203                           * Terminated by \n\0 (NOT \n\n\0). */
204} NPStream;
205
206typedef struct _NPByteRange
207{
208  int32_t  offset; /* negative offset means from the end */
209  uint32_t length;
210  struct _NPByteRange* next;
211} NPByteRange;
212
213typedef struct _NPSavedData
214{
215  int32_t len;
216  void*   buf;
217} NPSavedData;
218
219typedef struct _NPRect
220{
221  uint16_t top;
222  uint16_t left;
223  uint16_t bottom;
224  uint16_t right;
225} NPRect;
226
227typedef struct _NPSize
228{
229  int32_t width;
230  int32_t height;
231} NPSize;
232
233typedef enum {
234  NPFocusNext = 0,
235  NPFocusPrevious = 1
236} NPFocusDirection;
237
238/* These formats describe the format in the memory byte-order. This means if
239 * a 32-bit value of a pixel is viewed on a little-endian system the layout will
240 * be 0xAARRGGBB. The Alpha channel will be stored in the most significant
241 * bits. */
242typedef enum {
243  /* 32-bit per pixel 8-bit per channel - premultiplied alpha */
244  NPImageFormatBGRA32     = 0x1,
245  /* 32-bit per pixel 8-bit per channel - 1 unused channel */
246  NPImageFormatBGRX32     = 0x2 
247} NPImageFormat;
248
249typedef struct _NPAsyncSurface
250{
251  uint32_t version;
252  NPSize size;
253  NPImageFormat format;
254  union {
255    struct {
256      uint32_t stride;
257      void *data;
258    } bitmap;
259#if defined(XP_WIN)
260    HANDLE sharedHandle;
261#endif
262  };
263} NPAsyncSurface;
264
265/* Return values for NPP_HandleEvent */
266#define kNPEventNotHandled 0
267#define kNPEventHandled 1
268/* Exact meaning must be spec'd in event model. */
269#define kNPEventStartIME 2
270
271#if defined(XP_UNIX)
272/*
273 * Unix specific structures and definitions
274 */
275
276/*
277 * Callback Structures.
278 *
279 * These are used to pass additional platform specific information.
280 */
281enum {
282  NP_SETWINDOW = 1,
283  NP_PRINT
284};
285
286typedef struct
287{
288  int32_t type;
289} NPAnyCallbackStruct;
290
291typedef struct
292{
293  int32_t      type;
294#if defined(MOZ_X11)
295  Display*     display;
296  Visual*      visual;
297  Colormap     colormap;
298  unsigned int depth;
299#endif
300} NPSetWindowCallbackStruct;
301
302typedef struct
303{
304  int32_t type;
305  FILE* fp;
306} NPPrintCallbackStruct;
307
308#endif /* XP_UNIX */
309
310typedef enum {
311#if defined(XP_MACOSX)
312#ifndef NP_NO_QUICKDRAW
313  NPDrawingModelQuickDraw = 0,
314#endif
315  NPDrawingModelCoreGraphics = 1,
316  NPDrawingModelOpenGL = 2,
317  NPDrawingModelCoreAnimation = 3,
318  NPDrawingModelInvalidatingCoreAnimation = 4,
319#endif
320#if defined(XP_WIN)
321  NPDrawingModelSyncWin = 5,
322#endif
323#if defined(MOZ_X11)
324  NPDrawingModelSyncX = 6,
325#endif
326  NPDrawingModelAsyncBitmapSurface = 7
327#if defined(XP_WIN)
328  , NPDrawingModelAsyncWindowsDXGISurface = 8
329#endif
330} NPDrawingModel;
331
332#ifdef XP_MACOSX
333typedef enum {
334#ifndef NP_NO_CARBON
335  NPEventModelCarbon = 0,
336#endif
337  NPEventModelCocoa = 1
338} NPEventModel;
339#endif
340
341/*
342 *   The following masks are applied on certain platforms to NPNV and
343 *   NPPV selectors that pass around pointers to COM interfaces. Newer
344 *   compilers on some platforms may generate vtables that are not
345 *   compatible with older compilers. To prevent older plugins from
346 *   not understanding a new browser's ABI, these masks change the
347 *   values of those selectors on those platforms. To remain backwards
348 *   compatible with different versions of the browser, plugins can
349 *   use these masks to dynamically determine and use the correct C++
350 *   ABI that the browser is expecting. This does not apply to Windows
351 *   as Microsoft's COM ABI will likely not change.
352 */
353
354#define NP_ABI_GCC3_MASK  0x10000000
355/*
356 *   gcc 3.x generated vtables on UNIX and OSX are incompatible with
357 *   previous compilers.
358 */
359#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
360#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
361#else
362#define _NP_ABI_MIXIN_FOR_GCC3 0
363#endif
364
365#if defined(XP_MACOSX)
366#define NP_ABI_MACHO_MASK 0x01000000
367#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
368#else
369#define _NP_ABI_MIXIN_FOR_MACHO 0
370#endif
371
372#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
373
374/*
375 * List of variable names for which NPP_GetValue shall be implemented
376 */
377typedef enum {
378  NPPVpluginNameString = 1,
379  NPPVpluginDescriptionString,
380  NPPVpluginWindowBool,
381  NPPVpluginTransparentBool,
382  NPPVjavaClass,
383  NPPVpluginWindowSize,
384  NPPVpluginTimerInterval,
385  NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
386  NPPVpluginScriptableIID = 11,
387  NPPVjavascriptPushCallerBool = 12,
388  NPPVpluginKeepLibraryInMemory = 13,
389  NPPVpluginNeedsXEmbed         = 14,
390
391  /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
392   */
393  NPPVpluginScriptableNPObject  = 15,
394
395  /* Get the plugin value (as \0-terminated UTF-8 string data) for
396   * form submission if the plugin is part of a form. Use
397   * NPN_MemAlloc() to allocate memory for the string data. Introduced
398   * in NPAPI minor version 15.
399   */
400  NPPVformValue = 16,
401
402  NPPVpluginUrlRequestsDisplayedBool = 17,
403
404  /* Checks if the plugin is interested in receiving the http body of
405   * all http requests (including failed ones, http status != 200).
406   */
407  NPPVpluginWantsAllNetworkStreams = 18,
408
409  /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
410  NPPVpluginNativeAccessibleAtkPlugId = 19,
411
412  /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
413  NPPVpluginCancelSrcStream = 20,
414
415  NPPVsupportsAdvancedKeyHandling = 21,
416
417  NPPVpluginUsesDOMForCursorBool = 22,
418
419  /* Used for negotiating drawing models */
420  NPPVpluginDrawingModel = 1000
421#if defined(XP_MACOSX)
422  /* Used for negotiating event models */
423  , NPPVpluginEventModel = 1001
424  /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
425  , NPPVpluginCoreAnimationLayer = 1003
426#endif
427
428#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
429  , NPPVpluginWindowlessLocalBool = 2002
430#endif
431} NPPVariable;
432
433/*
434 * List of variable names for which NPN_GetValue should be implemented.
435 */
436typedef enum {
437  NPNVxDisplay = 1,
438  NPNVxtAppContext,
439  NPNVnetscapeWindow,
440  NPNVjavascriptEnabledBool,
441  NPNVasdEnabledBool,
442  NPNVisOfflineBool,
443
444  NPNVserviceManager = (10 | NP_ABI_MASK),
445  NPNVDOMElement     = (11 | NP_ABI_MASK),
446  NPNVDOMWindow      = (12 | NP_ABI_MASK),
447  NPNVToolkit        = (13 | NP_ABI_MASK),
448  NPNVSupportsXEmbedBool = 14,
449
450  /* Get the NPObject wrapper for the browser window. */
451  NPNVWindowNPObject = 15,
452
453  /* Get the NPObject wrapper for the plugins DOM element. */
454  NPNVPluginElementNPObject = 16,
455
456  NPNVSupportsWindowless = 17,
457
458  NPNVprivateModeBool = 18,
459
460  NPNVsupportsAdvancedKeyHandling = 21,
461
462  NPNVdocumentOrigin = 22,
463
464  NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */
465#if defined(XP_MACOSX)
466  , NPNVcontentsScaleFactor = 1001
467#ifndef NP_NO_QUICKDRAW
468  , NPNVsupportsQuickDrawBool = 2000
469#endif
470  , NPNVsupportsCoreGraphicsBool = 2001
471  , NPNVsupportsOpenGLBool = 2002
472  , NPNVsupportsCoreAnimationBool = 2003
473  , NPNVsupportsInvalidatingCoreAnimationBool = 2004
474#endif
475  , NPNVsupportsAsyncBitmapSurfaceBool = 2007
476#if defined(XP_WIN)
477  , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008
478#endif
479#if defined(XP_MACOSX)
480#ifndef NP_NO_CARBON
481  , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
482#endif
483  , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
484  , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
485                                                    Cocoa text input specification. */
486  , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
487                                                               CA model compositing */
488#endif
489#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
490  , NPNVSupportsWindowlessLocal = 2002
491#endif
492} NPNVariable;
493
494typedef enum {
495  NPNURLVCookie = 501,
496  NPNURLVProxy
497} NPNURLVariable;
498
499/*
500 * The type of Toolkit the widgets use
501 */
502typedef enum {
503  NPNVGtk12 = 1,
504  NPNVGtk2
505} NPNToolkitType;
506
507/*
508 * The type of a NPWindow - it specifies the type of the data structure
509 * returned in the window field.
510 */
511typedef enum {
512  NPWindowTypeWindow = 1,
513  NPWindowTypeDrawable
514} NPWindowType;
515
516typedef struct _NPWindow
517{
518  void* window;  /* Platform specific window handle */
519                 /* OS/2: x - Position of bottom left corner */
520                 /* OS/2: y - relative to visible netscape window */
521  int32_t  x;      /* Position of top left corner relative */
522  int32_t  y;      /* to a netscape page. */
523  uint32_t width;  /* Maximum window size */
524  uint32_t height;
525  NPRect   clipRect; /* Clipping rectangle in port coordinates */
526#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
527  void * ws_info; /* Platform-dependent additional data */
528#endif /* XP_UNIX */
529  NPWindowType type; /* Is this a window or a drawable? */
530} NPWindow;
531
532typedef struct _NPImageExpose
533{
534  char*    data;       /* image pointer */
535  int32_t  stride;     /* Stride of data image pointer */
536  int32_t  depth;      /* Depth of image pointer */
537  int32_t  x;          /* Expose x */
538  int32_t  y;          /* Expose y */
539  uint32_t width;      /* Expose width */
540  uint32_t height;     /* Expose height */
541  NPSize   dataSize;   /* Data buffer size */
542  float    translateX; /* translate X matrix value */
543  float    translateY; /* translate Y matrix value */
544  float    scaleX;     /* scale X matrix value */
545  float    scaleY;     /* scale Y matrix value */
546} NPImageExpose;
547
548typedef struct _NPFullPrint
549{
550  NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
551  NPBool printOne;     /* TRUE if plugin should print one copy to default
552                          printer */
553  void* platformPrint; /* Platform-specific printing info */
554} NPFullPrint;
555
556typedef struct _NPEmbedPrint
557{
558  NPWindow window;
559  void* platformPrint; /* Platform-specific printing info */
560} NPEmbedPrint;
561
562typedef struct _NPPrint
563{
564  uint16_t mode;               /* NP_FULL or NP_EMBED */
565  union
566  {
567    NPFullPrint fullPrint;   /* if mode is NP_FULL */
568    NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
569  } print;
570} NPPrint;
571
572#if defined(XP_MACOSX)
573#ifndef NP_NO_CARBON
574typedef EventRecord NPEvent;
575#endif
576#elif defined(XP_SYMBIAN)
577typedef QEvent NPEvent;
578#elif defined(XP_WIN)
579typedef struct _NPEvent
580{
581  uint16_t event;
582  uintptr_t wParam;
583  uintptr_t lParam;
584} NPEvent;
585#elif defined(XP_OS2)
586typedef struct _NPEvent
587{
588  uint32_t event;
589  uint32_t wParam;
590  uint32_t lParam;
591} NPEvent;
592#elif defined(XP_UNIX) && defined(MOZ_X11)
593typedef XEvent NPEvent;
594#else
595typedef void*  NPEvent;
596#endif
597
598#if defined(XP_MACOSX)
599typedef void* NPRegion;
600#ifndef NP_NO_QUICKDRAW
601typedef RgnHandle NPQDRegion;
602#endif
603typedef CGPathRef NPCGRegion;
604#elif defined(XP_WIN)
605typedef HRGN NPRegion;
606#elif defined(XP_UNIX) && defined(MOZ_X11)
607typedef Region NPRegion;
608#elif defined(XP_SYMBIAN)
609typedef QRegion* NPRegion;
610#else
611typedef void *NPRegion;
612#endif
613
614typedef struct _NPNSString NPNSString;
615typedef struct _NPNSWindow NPNSWindow;
616typedef struct _NPNSMenu   NPNSMenu;
617
618#if defined(XP_MACOSX)
619typedef NPNSMenu NPMenu;
620#else
621typedef void *NPMenu;
622#endif
623
624typedef enum {
625  NPCoordinateSpacePlugin = 1,
626  NPCoordinateSpaceWindow,
627  NPCoordinateSpaceFlippedWindow,
628  NPCoordinateSpaceScreen,
629  NPCoordinateSpaceFlippedScreen
630} NPCoordinateSpace;
631
632#if defined(XP_MACOSX)
633
634#ifndef NP_NO_QUICKDRAW
635typedef struct NP_Port
636{
637  CGrafPtr port;
638  int32_t portx; /* position inside the topmost window */
639  int32_t porty;
640} NP_Port;
641#endif /* NP_NO_QUICKDRAW */
642
643/*
644 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
645 * as its drawing model.
646 */
647
648typedef struct NP_CGContext
649{
650  CGContextRef context;
651  void *window; /* A WindowRef under the Carbon event model. */
652} NP_CGContext;
653
654/*
655 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
656 * drawing model.
657 */
658
659#if !NP_NO_OPENGL
660typedef struct NP_GLContext
661{
662  CGLContextObj context;
663#ifdef NP_NO_CARBON
664  NPNSWindow *window;
665#else
666  void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
667#endif
668} NP_GLContext;
669#endif /* !NP_NO_OPENGL */
670
671typedef enum {
672  NPCocoaEventDrawRect = 1,
673  NPCocoaEventMouseDown,
674  NPCocoaEventMouseUp,
675  NPCocoaEventMouseMoved,
676  NPCocoaEventMouseEntered,
677  NPCocoaEventMouseExited,
678  NPCocoaEventMouseDragged,
679  NPCocoaEventKeyDown,
680  NPCocoaEventKeyUp,
681  NPCocoaEventFlagsChanged,
682  NPCocoaEventFocusChanged,
683  NPCocoaEventWindowFocusChanged,
684  NPCocoaEventScrollWheel,
685  NPCocoaEventTextInput
686} NPCocoaEventType;
687
688typedef struct _NPCocoaEvent {
689  NPCocoaEventType type;
690  uint32_t version;
691  union {
692    struct {
693      uint32_t modifierFlags;
694      double   pluginX;
695      double   pluginY;
696      int32_t  buttonNumber;
697      int32_t  clickCount;
698      double   deltaX;
699      double   deltaY;
700      double   deltaZ;
701    } mouse;
702    struct {
703      uint32_t    modifierFlags;
704      NPNSString *characters;
705      NPNSString *charactersIgnoringModifiers;
706      NPBool      isARepeat;
707      uint16_t    keyCode;
708    } key;
709    struct {
710      CGContextRef context;
711      double x;
712      double y;
713      double width;
714      double height;
715    } draw;
716    struct {
717      NPBool hasFocus;
718    } focus;
719    struct {
720      NPNSString *text;
721    } text;
722  } data;
723} NPCocoaEvent;
724
725#ifndef NP_NO_CARBON
726/* Non-standard event types that can be passed to HandleEvent */
727enum NPEventType {
728  NPEventType_GetFocusEvent = (osEvt + 16),
729  NPEventType_LoseFocusEvent,
730  NPEventType_AdjustCursorEvent,
731  NPEventType_MenuCommandEvent,
732  NPEventType_ClippingChangedEvent,
733  NPEventType_ScrollingBeginsEvent = 1000,
734  NPEventType_ScrollingEndsEvent
735};
736#endif /* NP_NO_CARBON */
737
738#endif /* XP_MACOSX */
739
740/*
741 * Values for mode passed to NPP_New:
742 */
743#define NP_EMBED 1
744#define NP_FULL  2
745
746/*
747 * Values for stream type passed to NPP_NewStream:
748 */
749#define NP_NORMAL     1
750#define NP_SEEK       2
751#define NP_ASFILE     3
752#define NP_ASFILEONLY 4
753
754#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
755
756/*
757 * Flags for NPP_ClearSiteData.
758 */
759#define NP_CLEAR_ALL   0
760#define NP_CLEAR_CACHE (1 << 0)
761
762#if !defined(__LP64__)
763#if defined(XP_MACOSX)
764#pragma options align=reset
765#endif
766#endif /* __LP64__ */
767
768/*----------------------------------------------------------------------*/
769/*       Error and Reason Code definitions                              */
770/*----------------------------------------------------------------------*/
771
772/*
773 * Values of type NPError:
774 */
775#define NPERR_BASE                         0
776#define NPERR_NO_ERROR                    (NPERR_BASE + 0)
777#define NPERR_GENERIC_ERROR               (NPERR_BASE + 1)
778#define NPERR_INVALID_INSTANCE_ERROR      (NPERR_BASE + 2)
779#define NPERR_INVALID_FUNCTABLE_ERROR     (NPERR_BASE + 3)
780#define NPERR_MODULE_LOAD_FAILED_ERROR    (NPERR_BASE + 4)
781#define NPERR_OUT_OF_MEMORY_ERROR         (NPERR_BASE + 5)
782#define NPERR_INVALID_PLUGIN_ERROR        (NPERR_BASE + 6)
783#define NPERR_INVALID_PLUGIN_DIR_ERROR    (NPERR_BASE + 7)
784#define NPERR_INCOMPATIBLE_VERSION_ERROR  (NPERR_BASE + 8)
785#define NPERR_INVALID_PARAM               (NPERR_BASE + 9)
786#define NPERR_INVALID_URL                 (NPERR_BASE + 10)
787#define NPERR_FILE_NOT_FOUND              (NPERR_BASE + 11)
788#define NPERR_NO_DATA                     (NPERR_BASE + 12)
789#define NPERR_STREAM_NOT_SEEKABLE         (NPERR_BASE + 13)
790#define NPERR_TIME_RANGE_NOT_SUPPORTED    (NPERR_BASE + 14)
791#define NPERR_MALFORMED_SITE              (NPERR_BASE + 15)
792
793/*
794 * Values of type NPReason:
795 */
796#define NPRES_BASE          0
797#define NPRES_DONE         (NPRES_BASE + 0)
798#define NPRES_NETWORK_ERR  (NPRES_BASE + 1)
799#define NPRES_USER_BREAK   (NPRES_BASE + 2)
800
801/*
802 * Don't use these obsolete error codes any more.
803 */
804#define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
805#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
806#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
807
808/*
809 * Version feature information
810 */
811#define NPVERS_HAS_STREAMOUTPUT             8
812#define NPVERS_HAS_NOTIFICATION             9
813#define NPVERS_HAS_LIVECONNECT              9
814#define NPVERS_68K_HAS_LIVECONNECT          11
815#define NPVERS_HAS_WINDOWLESS               11
816#define NPVERS_HAS_XPCONNECT_SCRIPTING      13
817#define NPVERS_HAS_NPRUNTIME_SCRIPTING      14
818#define NPVERS_HAS_FORM_VALUES              15
819#define NPVERS_HAS_POPUPS_ENABLED_STATE     16
820#define NPVERS_HAS_RESPONSE_HEADERS         17
821#define NPVERS_HAS_NPOBJECT_ENUM            18
822#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
823#define NPVERS_HAS_ALL_NETWORK_STREAMS      20
824#define NPVERS_HAS_URL_AND_AUTH_INFO        21
825#define NPVERS_HAS_PRIVATE_MODE             22
826#define NPVERS_MACOSX_HAS_COCOA_EVENTS      23
827#define NPVERS_HAS_ADVANCED_KEY_HANDLING    25
828#define NPVERS_HAS_URL_REDIRECT_HANDLING    26
829#define NPVERS_HAS_CLEAR_SITE_DATA          27
830
831/*----------------------------------------------------------------------*/
832/*                        Function Prototypes                           */
833/*----------------------------------------------------------------------*/
834
835#if defined(__OS2__)
836#define NP_LOADDS _System
837#else
838#define NP_LOADDS
839#endif
840
841#ifdef __cplusplus
842extern "C" {
843#endif
844
845/* NPP_* functions are provided by the plugin and called by the navigator. */
846
847#if defined(XP_UNIX)
848const char* NPP_GetMIMEDescription(void);
849#endif
850
851NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
852                          uint16_t mode, int16_t argc, char* argn[],
853                          char* argv[], NPSavedData* saved);
854NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
855NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
856NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
857                                NPStream* stream, NPBool seekable,
858                                uint16_t* stype);
859NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
860                                    NPReason reason);
861int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
862int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
863                            int32_t len, void* buffer);
864void    NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
865                                   const char* fname);
866void    NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
867int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
868void    NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
869                                NPReason reason, void* notifyData);
870NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
871NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
872NPBool  NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
873void    NP_LOADDS NPP_LostFocus(NPP instance);
874void    NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
875NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
876char**  NP_LOADDS NPP_GetSitesWithData(void);
877void    NP_LOADDS NPP_DidComposite(NPP instance);
878
879/* NPN_* functions are provided by the navigator and called by the plugin. */
880void        NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
881                                  int* netscape_major, int* netscape_minor);
882NPError     NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
883                                       const char* target, void* notifyData);
884NPError     NP_LOADDS NPN_GetURL(NPP instance, const char* url,
885                                 const char* target);
886NPError     NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
887                                        const char* target, uint32_t len,
888                                        const char* buf, NPBool file,
889                                        void* notifyData);
890NPError     NP_LOADDS NPN_PostURL(NPP instance, const char* url,
891                                  const char* target, uint32_t len,
892                                  const char* buf, NPBool file);
893NPError     NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
894NPError     NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
895                                    const char* target, NPStream** stream);
896int32_t     NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
897                                void* buffer);
898NPError     NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
899                                        NPReason reason);
900void        NP_LOADDS NPN_Status(NPP instance, const char* message);
901const char* NP_LOADDS NPN_UserAgent(NPP instance);
902void*       NP_LOADDS NPN_MemAlloc(uint32_t size);
903void        NP_LOADDS NPN_MemFree(void* ptr);
904uint32_t    NP_LOADDS NPN_MemFlush(uint32_t size);
905void        NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
906NPError     NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
907                                   void *value);
908NPError     NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
909                                   void *value);
910void        NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
911void        NP_LOADDS NPN_InvalidateRegion(NPP instance,
912                                           NPRegion invalidRegion);
913void        NP_LOADDS NPN_ForceRedraw(NPP instance);
914void        NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
915void        NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
916void        NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
917                                                void (*func) (void *),
918                                                void *userData);
919NPError     NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
920                                         const char *url, char **value,
921                                         uint32_t *len);
922NPError     NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
923                                         const char *url, const char *value,
924                                         uint32_t len);
925NPError     NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
926                                                const char *protocol,
927                                                const char *host, int32_t port,
928                                                const char *scheme,
929                                                const char *realm,
930                                                char **username, uint32_t *ulen,
931                                                char **password,
932                                                uint32_t *plen);
933uint32_t    NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
934void        NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
935NPError     NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
936NPBool      NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
937NPBool      NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
938NPBool      NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
939void        NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
940NPError     NP_LOADDS NPN_InitAsyncSurface(NPP instance, NPSize *size,
941                                           NPImageFormat format, void *initData,
942                                           NPAsyncSurface *surface);
943NPError     NP_LOADDS NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
944void        NP_LOADDS NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
945
946#ifdef __cplusplus
947}  /* end extern "C" */
948#endif
949
950#endif /* RC_INVOKED */
951#if defined(__OS2__)
952#pragma pack()
953#endif
954
955#endif /* npapi_h_ */
Note: See TracBrowser for help on using the repository browser.