NPStream

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

« Gecko Plugin API Reference « Plug-in Side Plug-in API

Summary

Represents a stream of data either produced by the browser and consumed by the plug-in, or produced by the plug-in and consumed by the browser.

Syntax

typedef struct _NPStream
{
    void* pdata;    /* plug-in private data */
    void* ndata;    /* Netscape private data */
    const char* url;
    uint32      end;
    uint32      lastmodified;
    void*       notifyData;
    const char *headers;
} NPStream;

Fields

The data structure has the following fields: Plug-in-private value that the plug-in can use to store a pointer to private data associated with the instance; not modified by the browser.

ndata
Browser-private value that can store data associated with the instance; should not be modified by the plug-in.
url
The URL that the data in the stream is read from or written to.
end
Offset in bytes of the end of the stream (equivalent to the length of the stream in bytes). Can be zero for streams of unknown length, such as streams returned from older FTP servers or generated "on the fly" by CGI scripts.
lastmodified
Time the data in the URL was last modified (if applicable), measured in seconds since 12:00 midnight GMT, January 1, 1970.
notifyData
Used only for streams generated in response to a NPN_GetURLNotify or NPN_PostURLNotify request.
headers
The response headers from the host. This field is only available if the NP version is greater than or equal to NPVERS_HAS_RESPONSE_HEADERS. This field is used only for HTTP and is null for other types of streams. The plug-in should copy this data before making use of it. The headers include the HTTP status line and all headers, verbatim as received from the server. Lines are terminated by newline characters ("\n"), and the headers are terminated by a newline followed by null ("\n\0").

Description

The browser allocates and initializes the NPStream object and passes it to the plug-in in as a parameter to NPP_NewStream or NPN_NewStream. The browser cannot delete the object until after it calls NPP_DestroyStream or the plug-in calls NPN_DestroyStream.

Streams produced by the browser: the browser creates the NPStream object and passes it to the plug-in initially as a parameter to NPP_NewStream. All API calls that operate on the stream (such as NPP_WriteReady and NPP_Write) use a pointer to this stream. The browser informs the plug-in when the stream is about to be deleted through NPP_DestroyStream, after which the NPStream object is no longer valid.

Streams produced by the plug-in: the browser creates the NPStream object and returns it as an output parameter when the plug-in calls NPP_NewStream. The plug-in must pass a pointer to the NPStream to all API calls that operate on the stream, such as NPN_Write and NPN_DestroyStream.

See Also

NPP_NewStream, NPP_DestroyStream, NPP_DestroyStream

Document Tags and Contributors

タグ:
Contributors to this page: Pmash, Sheppy
最終更新者: Sheppy,