"Fossies" - the Fresh Open Source Software Archive 
Member "mozplugger-2.1.6/npapi/npapi.h" (17 Apr 2014, 14183 Bytes) of package /linux/www/old/mozplugger-2.1.6.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
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 #include <stdint.h>
42
43 /*----------------------------------------------------------------------*/
44 /* Plugin Version Constants */
45 /*----------------------------------------------------------------------*/
46
47 #define NP_VERSION_MAJOR 0
48 #define NP_VERSION_MINOR 27
49
50 /*----------------------------------------------------------------------*/
51 /* Definition of Basic Types */
52 /*----------------------------------------------------------------------*/
53
54 typedef unsigned char NPBool;
55 typedef int16_t NPError;
56 typedef int16_t NPReason;
57 typedef char* NPMIMEType;
58
59 /*----------------------------------------------------------------------*/
60 /* Structures and definitions */
61 /*----------------------------------------------------------------------*/
62
63 /*
64 * NPP is a plug-in's opaque instance handle
65 */
66 typedef struct _NPP
67 {
68 void* pdata; /* plug-in private data */
69 void* ndata; /* netscape private data */
70 } NPP_t;
71
72 typedef NPP_t* NPP;
73
74 typedef struct _NPStream
75 {
76 void* pdata; /* plug-in private data */
77 void* ndata; /* netscape private data */
78 const char* url;
79 uint32_t end;
80 uint32_t lastmodified;
81 void* notifyData;
82 const char* headers; /* Response headers from host.
83 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
84 * Used for HTTP only; NULL for non-HTTP.
85 * Available from NPP_NewStream onwards.
86 * Plugin should copy this data before storing it.
87 * Includes HTTP status line and all headers,
88 * preferably verbatim as received from server,
89 * headers formatted as in HTTP ("Header: Value"),
90 * and newlines (\n, NOT \r\n) separating lines.
91 * Terminated by \n\0 (NOT \n\n\0). */
92 } NPStream;
93
94 typedef struct _NPByteRange
95 {
96 int32_t offset; /* negative offset means from the end */
97 uint32_t length;
98 struct _NPByteRange* next;
99 } NPByteRange;
100
101 typedef struct _NPSavedData
102 {
103 int32_t len;
104 void* buf;
105 } NPSavedData;
106
107 typedef struct _NPRect
108 {
109 uint16_t top;
110 uint16_t left;
111 uint16_t bottom;
112 uint16_t right;
113 } NPRect;
114
115 typedef struct _NPSize
116 {
117 int32_t width;
118 int32_t height;
119 } NPSize;
120
121 typedef enum
122 {
123 NPFocusNext = 0,
124 NPFocusPrevious = 1
125 } NPFocusDirection;
126
127 /* Return values for NPP_HandleEvent */
128 #define kNPEventNotHandled 0
129 #define kNPEventHandled 1
130 /* Exact meaning must be spec'd in event model. */
131 #define kNPEventStartIME 2
132
133 #if defined(XP_UNIX)
134 /*
135 * Unix specific structures and definitions
136 */
137
138 /*
139 * Callback Structures.
140 *
141 * These are used to pass additional platform specific information.
142 */
143 enum
144 {
145 NP_SETWINDOW = 1,
146 NP_PRINT
147 };
148
149 typedef struct
150 {
151 int32_t type;
152 } NPAnyCallbackStruct;
153
154 typedef struct
155 {
156 int32_t type;
157 Display* display;
158 Visual* visual;
159 Colormap colormap;
160 unsigned int depth;
161 } NPSetWindowCallbackStruct;
162
163 typedef struct
164 {
165 int32_t type;
166 FILE* fp;
167 } NPPrintCallbackStruct;
168
169 #endif /* XP_UNIX */
170
171
172 /*
173 * The following masks are applied on certain platforms to NPNV and
174 * NPPV selectors that pass around pointers to COM interfaces. Newer
175 * compilers on some platforms may generate vtables that are not
176 * compatible with older compilers. To prevent older plugins from
177 * not understanding a new browser's ABI, these masks change the
178 * values of those selectors on those platforms. To remain backwards
179 * compatible with different versions of the browser, plugins can
180 * use these masks to dynamically determine and use the correct C++
181 * ABI that the browser is expecting. This does not apply to Windows
182 * as Microsoft's COM ABI will likely not change.
183 */
184
185 #define NP_ABI_GCC3_MASK 0x10000000
186 /*
187 * gcc 3.x generated vtables on UNIX and OSX are incompatible with
188 * previous compilers.
189 */
190 #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
191 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
192 #else
193 #define _NP_ABI_MIXIN_FOR_GCC3 0
194 #endif
195
196 #define _NP_ABI_MIXIN_FOR_MACHO 0
197
198 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
199
200 /*
201 * List of variable names for which NPP_GetValue shall be implemented
202 */
203 typedef enum
204 {
205 NPPVpluginNameString = 1,
206 NPPVpluginDescriptionString,
207 NPPVpluginWindowBool,
208 NPPVpluginTransparentBool,
209 NPPVjavaClass,
210 NPPVpluginWindowSize,
211 NPPVpluginTimerInterval,
212 NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
213 NPPVpluginScriptableIID = 11,
214
215 /* Introduced in Mozilla 0.9.9 */
216 NPPVjavascriptPushCallerBool = 12,
217
218 /* Introduced in Mozilla 1.0 */
219 NPPVpluginKeepLibraryInMemory = 13,
220 NPPVpluginNeedsXEmbed = 14,
221
222 /* Get the NPObject for scripting the plugin. Introduced in Firefox
223 * 1.0 (NPAPI minor version 14).
224 */
225 NPPVpluginScriptableNPObject = 15,
226
227 /* Get the plugin value (as \0-terminated UTF-8 string data) for
228 * form submission if the plugin is part of a form. Use
229 * NPN_MemAlloc() to allocate memory for the string data. Introduced
230 * in NPAPI minor version 15.
231 */
232 NPPVformValue = 16,
233
234 NPPVpluginUrlRequestsDisplayedBool = 17,
235
236 /* Checks if the plugin is interested in receiving the http body of
237 * all http requests (including failed ones, http status != 200).
238 */
239 NPPVpluginWantsAllNetworkStreams = 18,
240
241 /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
242 NPPVpluginNativeAccessibleAtkPlugId = 19,
243
244 /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
245 NPPVpluginCancelSrcStream = 20,
246
247 NPPVsupportsAdvancedKeyHandling = 21,
248
249 NPPVpluginUsesDOMForCursorBool = 22
250
251
252
253 #ifdef MOZ_PLATFORM_HILDON
254 , NPPVpluginWindowlessLocalBool = 2002
255 #endif
256 } NPPVariable;
257
258 /*
259 * List of variable names for which NPN_GetValue should be implemented.
260 */
261 typedef enum
262 {
263 NPNVxDisplay = 1,
264 NPNVxtAppContext,
265 NPNVnetscapeWindow,
266 NPNVjavascriptEnabledBool,
267 NPNVasdEnabledBool,
268 NPNVisOfflineBool,
269
270 /* 10 and over are available on Mozilla builds starting with 0.9.4 */
271 NPNVserviceManager = (10 | NP_ABI_MASK),
272 NPNVDOMElement = (11 | NP_ABI_MASK),
273 NPNVDOMWindow = (12 | NP_ABI_MASK),
274 NPNVToolkit = (13 | NP_ABI_MASK),
275 NPNVSupportsXEmbedBool = 14,
276
277 /* Get the NPObject wrapper for the browser window. */
278 NPNVWindowNPObject = 15,
279
280 /* Get the NPObject wrapper for the plugins DOM element. */
281 NPNVPluginElementNPObject = 16,
282
283 NPNVSupportsWindowless = 17,
284
285 NPNVprivateModeBool = 18,
286
287 NPNVsupportsAdvancedKeyHandling = 21,
288
289 NPNVdocumentOrigin = 22
290
291 #ifdef MOZ_PLATFORM_HILDON
292 , NPNVSupportsWindowlessLocal = 2002
293 #endif
294 } NPNVariable;
295
296 typedef enum
297 {
298 NPNURLVCookie = 501,
299 NPNURLVProxy
300 } NPNURLVariable;
301 /*
302 * The type of Toolkit the widgets use
303 */
304 typedef enum
305 {
306 NPNVGtk12 = 1,
307 NPNVGtk2
308 } NPNToolkitType;
309
310 /*
311 * The type of a NPWindow - it specifies the type of the data structure
312 * returned in the window field.
313 */
314 typedef enum
315 {
316 NPWindowTypeWindow = 1,
317 NPWindowTypeDrawable
318 } NPWindowType;
319
320 typedef struct _NPWindow
321 {
322 void* window; /* Platform specific window handle */
323 /* OS/2: x - Position of bottom left corner */
324 /* OS/2: y - relative to visible netscape window */
325 int32_t x; /* Position of top left corner relative */
326 int32_t y; /* to a netscape page. */
327 uint32_t width; /* Maximum window size */
328 uint32_t height;
329 NPRect clipRect; /* Clipping rectangle in port coordinates */
330 #if defined(XP_UNIX)
331 void * ws_info; /* Platform-dependent additional data */
332 #endif /* XP_UNIX */
333 NPWindowType type; /* Is this a window or a drawable? */
334 } NPWindow;
335
336 typedef struct _NPImageExpose
337 {
338 char* data; /* image pointer */
339 int32_t stride; /* Stride of data image pointer */
340 int32_t depth; /* Depth of image pointer */
341 int32_t x; /* Expose x */
342 int32_t y; /* Expose y */
343 uint32_t width; /* Expose width */
344 uint32_t height; /* Expose height */
345 NPSize dataSize; /* Data buffer size */
346 float translateX; /* translate X matrix value */
347 float translateY; /* translate Y matrix value */
348 float scaleX; /* scale X matrix value */
349 float scaleY; /* scale Y matrix value */
350 } NPImageExpose;
351
352 typedef struct _NPFullPrint
353 {
354 NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
355 NPBool printOne; /* TRUE if plugin should print one copy to default
356 printer */
357 void* platformPrint; /* Platform-specific printing info */
358 } NPFullPrint;
359
360 typedef struct _NPEmbedPrint
361 {
362 NPWindow window;
363 void* platformPrint; /* Platform-specific printing info */
364 } NPEmbedPrint;
365
366 typedef struct _NPPrint
367 {
368 uint16_t mode; /* NP_FULL or NP_EMBED */
369 union
370 {
371 NPFullPrint fullPrint; /* if mode is NP_FULL */
372 NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
373 } print;
374 } NPPrint;
375
376 typedef void* NPEvent;
377
378 typedef void *NPRegion;
379
380 typedef struct _NPNSString NPNSString;
381 typedef struct _NPNSWindow NPNSWindow;
382 typedef struct _NPNSMenu NPNSMenu;
383
384 typedef void *NPMenu;
385
386 typedef enum
387 {
388 NPCoordinateSpacePlugin = 1,
389 NPCoordinateSpaceWindow,
390 NPCoordinateSpaceFlippedWindow,
391 NPCoordinateSpaceScreen,
392 NPCoordinateSpaceFlippedScreen
393 } NPCoordinateSpace;
394
395 /*
396 * Values for mode passed to NPP_New:
397 */
398 #define NP_EMBED 1
399 #define NP_FULL 2
400
401 /*
402 * Values for stream type passed to NPP_NewStream:
403 */
404 #define NP_NORMAL 1
405 #define NP_SEEK 2
406 #define NP_ASFILE 3
407 #define NP_ASFILEONLY 4
408
409 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
410
411
412 /*----------------------------------------------------------------------*/
413 /* Error and Reason Code definitions */
414 /*----------------------------------------------------------------------*/
415
416 /*
417 * Values of type NPError:
418 */
419 #define NPERR_BASE 0
420 #define NPERR_NO_ERROR (NPERR_BASE + 0)
421 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
422 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
423 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
424 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
425 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
426 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
427 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
428 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
429 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
430 #define NPERR_INVALID_URL (NPERR_BASE + 10)
431 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
432 #define NPERR_NO_DATA (NPERR_BASE + 12)
433 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
434 #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
435 #define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
436
437 /*
438 * Values of type NPReason:
439 */
440 #define NPRES_BASE 0
441 #define NPRES_DONE (NPRES_BASE + 0)
442 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
443 #define NPRES_USER_BREAK (NPRES_BASE + 2)
444
445 /*
446 * Don't use these obsolete error codes any more.
447 */
448 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
449 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
450 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
451
452 /*
453 * Version feature information
454 */
455 #define NPVERS_HAS_STREAMOUTPUT 8
456 #define NPVERS_HAS_NOTIFICATION 9
457 #define NPVERS_HAS_LIVECONNECT 9
458 #define NPVERS_68K_HAS_LIVECONNECT 11
459 #define NPVERS_HAS_WINDOWLESS 11
460 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
461 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
462 #define NPVERS_HAS_FORM_VALUES 15
463 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16
464 #define NPVERS_HAS_RESPONSE_HEADERS 17
465 #define NPVERS_HAS_NPOBJECT_ENUM 18
466 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
467 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20
468 #define NPVERS_HAS_URL_AND_AUTH_INFO 21
469 #define NPVERS_HAS_PRIVATE_MODE 22
470 #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23
471 #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25
472 #define NPVERS_HAS_URL_REDIRECT_HANDLING 26
473 #define NPVERS_HAS_CLEAR_SITE_DATA 27
474
475 #endif /* npapi_h_ */