Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsITransport Interface Reference

nsITransport More...

import "nsITransport.idl";

Inheritance diagram for nsITransport:
Inheritance graph
[legend]
Collaboration diagram for nsITransport:
Collaboration graph
[legend]

List of all members.

Public Member Functions

nsIInputStream openInputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount)
 Open an input stream on this transport.
nsIOutputStream openOutputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount)
 Open an output stream on this transport.
void close (in nsresult aReason)
 Close the transport and any open streams.
void setEventSink (in nsITransportEventSink aSink, in nsIEventTarget aEventTarget)
 Set the transport event sink.

Public Attributes

const unsigned long OPEN_BLOCKING = 1<<0
 Open flags.
const unsigned long OPEN_UNBUFFERED = 1<<1
const unsigned long STATUS_READING = 0x804b0008
 Generic nsITransportEventSink status codes.
const unsigned long STATUS_WRITING = 0x804b0009

Detailed Description

nsITransport

This interface provides a common way of accessing i/o streams connected to some resource. This interface does not in any way specify the resource. It provides methods to open blocking or non-blocking, buffered or unbuffered streams to the resource. The name "transport" is meant to connote the inherent data transfer implied by this interface (i.e., data is being transfered in some fashion via the streams exposed by this interface).

A transport can have an event sink associated with it. The event sink receives transport-specific events as the transfer is occuring. For a socket transport, these events can include status about the connection. See nsISocketTransport for more info about socket transport specifics.

Definition at line 61 of file nsITransport.idl.


Member Function Documentation

Close the transport and any open streams.

Parameters:
aReasonthe reason for closing the stream.
nsIInputStream nsITransport::openInputStream ( in unsigned long  aFlags,
in unsigned long  aSegmentSize,
in unsigned long  aSegmentCount 
)

Open an input stream on this transport.

Flags have the following meaning:

OPEN_BLOCKING If specified, then the resulting stream will have blocking stream semantics. This means that if the stream has no data and is not closed, then reading from it will block the calling thread until at least one byte is available or until the stream is closed. If this flag is NOT specified, then the stream has non-blocking stream semantics. This means that if the stream has no data and is not closed, then reading from it returns NS_BASE_STREAM_WOULD_BLOCK. In addition, in non-blocking mode, the stream is guaranteed to support nsIAsyncInputStream. This interface allows the consumer of the stream to be notified when the stream can again be read.

OPEN_UNBUFFERED If specified, the resulting stream may not support ReadSegments. ReadSegments is only gauranteed to be implemented when this flag is NOT specified.

Parameters:
aFlagsoptional transport specific flags.
aSegmentSizeif OPEN_UNBUFFERED is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value).
aSegmentCountif OPEN_UNBUFFERED is not set, then this parameter specifies the maximum number of buffer segments (pass 0 to use default value).
nsIOutputStream nsITransport::openOutputStream ( in unsigned long  aFlags,
in unsigned long  aSegmentSize,
in unsigned long  aSegmentCount 
)

Open an output stream on this transport.

Flags have the following meaning:

OPEN_BLOCKING If specified, then the resulting stream will have blocking stream semantics. This means that if the stream is full and is not closed, then writing to it will block the calling thread until ALL of the data can be written or until the stream is closed. If this flag is NOT specified, then the stream has non-blocking stream semantics. This means that if the stream is full and is not closed, then writing to it returns NS_BASE_STREAM_WOULD_BLOCK. In addition, in non- blocking mode, the stream is guaranteed to support nsIAsyncOutputStream. This interface allows the consumer of the stream to be notified when the stream can again accept more data.

OPEN_UNBUFFERED If specified, the resulting stream may not support WriteSegments and WriteFrom. WriteSegments and WriteFrom are only gauranteed to be implemented when this flag is NOT specified.

Parameters:
aFlagsoptional transport specific flags.
aSegmentSizeif OPEN_UNBUFFERED is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value).
aSegmentCountif OPEN_UNBUFFERED is not set, then this parameter specifies the maximum number of buffer segments (pass 0 to use default value).

Set the transport event sink.

Parameters:
aSinkreceives transport layer notifications
aEventTargetindicates the event target to which the notifications should be delivered. if NULL, then the notifications may occur on any thread.

Member Data Documentation

Open flags.

Definition at line 66 of file nsITransport.idl.

Definition at line 67 of file nsITransport.idl.

const unsigned long nsITransport::STATUS_READING = 0x804b0008

Generic nsITransportEventSink status codes.

nsITransport implementations may override these status codes with their own more specific status codes (e.g., see nsISocketTransport).

Definition at line 165 of file nsITransport.idl.

const unsigned long nsITransport::STATUS_WRITING = 0x804b0009

Definition at line 166 of file nsITransport.idl.


The documentation for this interface was generated from the following file: