~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/xrx/plugin/include/npapi.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: npapi.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */
 
2
/* -*- Mode: C; tab-width: 4; -*- */
 
3
/*
 
4
 *  npapi.h Revision: 1.76
 
5
 *  Netscape client plug-in API spec
 
6
 */
 
7
/* $XFree86: xc/programs/xrx/plugin/include/npapi.h,v 1.5 2001/07/25 15:05:28 dawes Exp $ */
 
8
 
 
9
#ifndef _NPAPI_H_
 
10
#define _NPAPI_H_
 
11
 
 
12
#include "jri.h"                /* Java Runtime Interface */
 
13
 
 
14
 
 
15
/* XXX this needs to get out of here */
 
16
#if defined(__MWERKS__)
 
17
#ifndef XP_MAC
 
18
#define XP_MAC
 
19
#endif
 
20
#endif
 
21
 
 
22
 
 
23
 
 
24
/*----------------------------------------------------------------------*/
 
25
/*                   Plugin Version Constants                           */
 
26
/*----------------------------------------------------------------------*/
 
27
 
 
28
#define NP_VERSION_MAJOR 0
 
29
#define NP_VERSION_MINOR 9
 
30
 
 
31
 
 
32
 
 
33
/*----------------------------------------------------------------------*/
 
34
/*                   Definition of Basic Types                          */
 
35
/*----------------------------------------------------------------------*/
 
36
 
 
37
#ifndef _UINT16
 
38
typedef unsigned short uint16;
 
39
#endif
 
40
#ifndef _UINT32
 
41
typedef unsigned int uint32;
 
42
#endif
 
43
#ifndef _INT16
 
44
typedef short int16;
 
45
#endif
 
46
#ifndef _INT32
 
47
typedef int int32;
 
48
#endif
 
49
 
 
50
#ifndef FALSE
 
51
#define FALSE (0)
 
52
#endif
 
53
#ifndef TRUE
 
54
#define TRUE (1)
 
55
#endif
 
56
#include <stddef.h>
 
57
 
 
58
typedef unsigned char   NPBool;
 
59
typedef void*                   NPEvent;
 
60
typedef int16                   NPError;
 
61
typedef int16                   NPReason;
 
62
typedef char*                   NPMIMEType;
 
63
 
 
64
 
 
65
 
 
66
/*----------------------------------------------------------------------*/
 
67
/*                   Structures and definitions                         */
 
68
/*----------------------------------------------------------------------*/
 
69
 
 
70
/*
 
71
 *  NPP is a plug-in's opaque instance handle
 
72
 */
 
73
typedef struct _NPP
 
74
{
 
75
    void*       pdata;                  /* plug-in private data */
 
76
    void*       ndata;                  /* netscape private data */
 
77
} NPP_t;
 
78
 
 
79
typedef NPP_t*  NPP;
 
80
 
 
81
 
 
82
typedef struct _NPStream
 
83
{
 
84
    void*               pdata;          /* plug-in private data */
 
85
    void*               ndata;          /* netscape private data */
 
86
    const char*         url;
 
87
    uint32              end;
 
88
    uint32              lastmodified;
 
89
    void*               notifyData;
 
90
} NPStream;
 
91
 
 
92
 
 
93
typedef struct _NPByteRange
 
94
{
 
95
    int32       offset;                 /* negative offset means from the end */
 
96
    uint32      length;
 
97
    struct _NPByteRange* next;
 
98
} NPByteRange;
 
99
 
 
100
 
 
101
typedef struct _NPSavedData
 
102
{
 
103
    int32       len;
 
104
    void*       buf;
 
105
} NPSavedData;
 
106
 
 
107
 
 
108
typedef struct _NPRect
 
109
{
 
110
    uint16      top;
 
111
    uint16      left;
 
112
    uint16      bottom;
 
113
    uint16      right;
 
114
} NPRect;
 
115
 
 
116
 
 
117
#ifdef XP_UNIX
 
118
/*
 
119
 * Unix specific structures and definitions
 
120
 */
 
121
#include <X11/Xlib.h>
 
122
 
 
123
/*
 
124
 * Callback Structures.
 
125
 *
 
126
 * These are used to pass additional platform specific information.
 
127
 */
 
128
enum {
 
129
        NP_SETWINDOW = 1
 
130
};
 
131
 
 
132
typedef struct
 
133
{
 
134
    int32               type;
 
135
} NPAnyCallbackStruct;
 
136
 
 
137
typedef struct
 
138
{
 
139
    int32                       type;
 
140
    Display*            display;
 
141
    Visual*                     visual;
 
142
    Colormap            colormap;
 
143
    unsigned int        depth;
 
144
} NPSetWindowCallbackStruct;
 
145
 
 
146
/*
 
147
 * List of variable names for which NPP_GetValue shall be implemented
 
148
 */
 
149
typedef enum {
 
150
        NPPVpluginNameString = 1,
 
151
        NPPVpluginDescriptionString
 
152
} NPPVariable;
 
153
 
 
154
/*
 
155
 * List of variable names for which NPN_GetValue is implemented by Mozilla
 
156
 */
 
157
typedef enum {
 
158
        NPNVxDisplay = 1,
 
159
        NPNVxtAppContext
 
160
} NPNVariable;
 
161
 
 
162
#endif /* XP_UNIX */
 
163
 
 
164
 
 
165
typedef struct _NPWindow 
 
166
{
 
167
    void*       window;         /* Platform specific window handle */
 
168
    uint32      x;                      /* Position of top left corner relative */
 
169
    uint32      y;                      /*      to a netscape page.                                     */
 
170
    uint32      width;          /* Maximum window size */
 
171
    uint32      height;
 
172
    NPRect      clipRect;       /* Clipping rectangle in port coordinates */
 
173
                                                /* Used by MAC only.                      */
 
174
#ifdef XP_UNIX
 
175
    void *      ws_info;        /* Platform-dependent additonal data */
 
176
#endif /* XP_UNIX */
 
177
} NPWindow;
 
178
 
 
179
 
 
180
typedef struct _NPFullPrint
 
181
{
 
182
    NPBool      pluginPrinted;  /* Set TRUE if plugin handled fullscreen */
 
183
                                                        /*      printing                                                         */
 
184
    NPBool      printOne;               /* TRUE if plugin should print one copy  */
 
185
                                                        /*      to default printer                                       */
 
186
    void*       platformPrint;  /* Platform-specific printing info */
 
187
} NPFullPrint;
 
188
 
 
189
typedef struct _NPEmbedPrint
 
190
{
 
191
    NPWindow    window;
 
192
    void*       platformPrint;  /* Platform-specific printing info */
 
193
} NPEmbedPrint;
 
194
 
 
195
typedef struct _NPPrint
 
196
{
 
197
    uint16      mode;                                           /* NP_FULL or NP_EMBED */
 
198
    union
 
199
    {
 
200
                NPFullPrint             fullPrint;              /* if mode is NP_FULL */
 
201
                NPEmbedPrint    embedPrint;             /* if mode is NP_EMBED */
 
202
    } print;
 
203
} NPPrint;
 
204
 
 
205
 
 
206
#ifdef XP_MAC
 
207
/*
 
208
 *  Mac-specific structures and definitions.
 
209
 */
 
210
 
 
211
#include <Quickdraw.h>
 
212
#include <Events.h>
 
213
 
 
214
typedef struct NP_Port
 
215
{
 
216
    CGrafPtr    port;           /* Grafport */
 
217
    int32               portx;          /* position inside the topmost window */
 
218
    int32               porty;
 
219
} NP_Port;
 
220
 
 
221
/*
 
222
 *  Non-standard event types that can be passed to HandleEvent
 
223
 */
 
224
#define getFocusEvent       (osEvt + 16)
 
225
#define loseFocusEvent      (osEvt + 17)
 
226
#define adjustCursorEvent   (osEvt + 18)
 
227
 
 
228
#endif /* XP_MAC */
 
229
 
 
230
 
 
231
/*
 
232
 * Values for mode passed to NPP_New:
 
233
 */
 
234
#define NP_EMBED                1
 
235
#define NP_FULL                 2
 
236
 
 
237
/*
 
238
 * Values for stream type passed to NPP_NewStream:
 
239
 */
 
240
#define NP_NORMAL               1
 
241
#define NP_SEEK                 2
 
242
#define NP_ASFILE               3
 
243
#define NP_ASFILEONLY           4
 
244
 
 
245
#define NP_MAXREADY     (((unsigned)(~0)<<1)>>1)
 
246
 
 
247
 
 
248
 
 
249
/*----------------------------------------------------------------------*/
 
250
/*                   Error and Reason Code definitions                  */
 
251
/*----------------------------------------------------------------------*/
 
252
 
 
253
/*
 
254
 *      Values of type NPError:
 
255
 */
 
256
#define NPERR_BASE                                                      0
 
257
#define NPERR_NO_ERROR                                          (NPERR_BASE + 0)
 
258
#define NPERR_GENERIC_ERROR                                     (NPERR_BASE + 1)
 
259
#define NPERR_INVALID_INSTANCE_ERROR            (NPERR_BASE + 2)
 
260
#define NPERR_INVALID_FUNCTABLE_ERROR           (NPERR_BASE + 3)
 
261
#define NPERR_MODULE_LOAD_FAILED_ERROR          (NPERR_BASE + 4)
 
262
#define NPERR_OUT_OF_MEMORY_ERROR                       (NPERR_BASE + 5)
 
263
#define NPERR_INVALID_PLUGIN_ERROR                      (NPERR_BASE + 6)
 
264
#define NPERR_INVALID_PLUGIN_DIR_ERROR          (NPERR_BASE + 7)
 
265
#define NPERR_INCOMPATIBLE_VERSION_ERROR        (NPERR_BASE + 8)
 
266
#define NPERR_INVALID_PARAM                             (NPERR_BASE + 9)
 
267
#define NPERR_INVALID_URL                                       (NPERR_BASE + 10)
 
268
#define NPERR_FILE_NOT_FOUND                            (NPERR_BASE + 11)
 
269
#define NPERR_NO_DATA                                           (NPERR_BASE + 12)
 
270
#define NPERR_STREAM_NOT_SEEKABLE                       (NPERR_BASE + 13)
 
271
 
 
272
/*
 
273
 *      Values of type NPReason:
 
274
 */
 
275
#define NPRES_BASE                              0
 
276
#define NPRES_DONE                                      (NPRES_BASE + 0)
 
277
#define NPRES_NETWORK_ERR                       (NPRES_BASE + 1)
 
278
#define NPRES_USER_BREAK                        (NPRES_BASE + 2)
 
279
 
 
280
/*
 
281
 *      Don't use these obsolete error codes any more.
 
282
 */
 
283
#define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
 
284
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
 
285
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
 
286
 
 
287
/*
 
288
 * Version feature information
 
289
 */
 
290
#define NPVERS_HAS_STREAMOUTPUT         8
 
291
#define NPVERS_HAS_NOTIFICATION         9
 
292
#define NPVERS_HAS_LIVECONNECT          9
 
293
 
 
294
 
 
295
/*----------------------------------------------------------------------*/
 
296
/*                   Function Prototypes                                */
 
297
/*----------------------------------------------------------------------*/
 
298
 
 
299
#if defined(_WINDOWS) && !defined(WIN32)
 
300
#define NP_LOADDS  _loadds
 
301
#else
 
302
#define NP_LOADDS
 
303
#endif
 
304
 
 
305
#ifdef __cplusplus
 
306
extern "C" {
 
307
#endif
 
308
 
 
309
/*
 
310
 * NPP_* functions are provided by the plugin and called by the navigator.
 
311
 */
 
312
 
 
313
#ifdef XP_UNIX
 
314
char*                                   NPP_GetMIMEDescription(void);
 
315
NPError                                 NPP_GetValue(void *instance, NPPVariable variable,
 
316
                                                                         void *value);
 
317
#endif /* XP_UNIX */
 
318
NPError                 NPP_Initialize(void);
 
319
void                    NPP_Shutdown(void);
 
320
NPError     NP_LOADDS   NPP_New(NPMIMEType pluginType, NPP instance,
 
321
                                                                uint16 mode, int16 argc, char* argn[],
 
322
                                                                char* argv[], NPSavedData* saved);
 
323
NPError     NP_LOADDS   NPP_Destroy(NPP instance, NPSavedData** save);
 
324
NPError     NP_LOADDS   NPP_SetWindow(NPP instance, NPWindow* window);
 
325
NPError     NP_LOADDS   NPP_NewStream(NPP instance, NPMIMEType type,
 
326
                                                                          NPStream* stream, NPBool seekable,
 
327
                                                                          uint16* stype);
 
328
NPError     NP_LOADDS   NPP_DestroyStream(NPP instance, NPStream* stream,
 
329
                                                                                  NPReason reason);
 
330
int32       NP_LOADDS   NPP_WriteReady(NPP instance, NPStream* stream);
 
331
int32       NP_LOADDS   NPP_Write(NPP instance, NPStream* stream, int32 offset,
 
332
                                                                  int32 len, void* buffer);
 
333
void        NP_LOADDS   NPP_StreamAsFile(NPP instance, NPStream* stream,
 
334
                                                                                 const char* fname);
 
335
void        NP_LOADDS   NPP_Print(NPP instance, NPPrint* platformPrint);
 
336
int16                   NPP_HandleEvent(NPP instance, void* event);
 
337
void                    NPP_URLNotify(NPP instance, const char* url,
 
338
                                                                          NPReason reason, void* notifyData);
 
339
jref                                    NPP_GetJavaClass(void);
 
340
 
 
341
 
 
342
/*
 
343
 * NPN_* functions are provided by the navigator and called by the plugin.
 
344
 */
 
345
 
 
346
#ifdef XP_UNIX
 
347
NPError                 NPN_GetValue(NPP instance, NPNVariable variable,
 
348
                                                         void *value);
 
349
#endif /* XP_UNIX */
 
350
void            NPN_Version(int* plugin_major, int* plugin_minor,
 
351
                                                        int* netscape_major, int* netscape_minor);
 
352
NPError         NPN_GetURLNotify(NPP instance, const char* url,
 
353
                                                                 const char* target, void* notifyData);
 
354
NPError         NPN_GetURL(NPP instance, const char* url,
 
355
                                                   const char* target);
 
356
NPError         NPN_PostURLNotify(NPP instance, const char* url,
 
357
                                                                  const char* target, uint32 len,
 
358
                                                                  const char* buf, NPBool file,
 
359
                                                                  void* notifyData);
 
360
NPError         NPN_PostURL(NPP instance, const char* url,
 
361
                                                        const char* target, uint32 len,
 
362
                                                        const char* buf, NPBool file);
 
363
NPError         NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
 
364
NPError         NPN_NewStream(NPP instance, NPMIMEType type,
 
365
                                                          const char* target, NPStream** stream);
 
366
int32           NPN_Write(NPP instance, NPStream* stream, int32 len,
 
367
                                                  void* buffer);
 
368
NPError                 NPN_DestroyStream(NPP instance, NPStream* stream,
 
369
                                                                  NPReason reason);
 
370
void            NPN_Status(NPP instance, const char* message);
 
371
const char*     NPN_UserAgent(NPP instance);
 
372
void*           NPN_MemAlloc(uint32 size);
 
373
void            NPN_MemFree(void* ptr);
 
374
uint32          NPN_MemFlush(uint32 size);
 
375
void                    NPN_ReloadPlugins(NPBool reloadPages);
 
376
JRIEnv*                 NPN_GetJavaEnv(void);
 
377
jref                    NPN_GetJavaPeer(NPP instance);
 
378
 
 
379
 
 
380
#ifdef __cplusplus
 
381
}  /* end extern "C" */
 
382
#endif
 
383
 
 
384
#endif /* _NPAPI_H_ */