Netscape DevEdge

Skip to: [content] [navigation]

TOC PREV NEXT

plug-ins!


NPStream


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;
 
} 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.

  • For these streams, notifyData is set to the value of the notifyData parameter to NPN_GetURLNotify or NPN_PostURLNotify.
  • For other streams, notifyData is null.

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
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT
A+R