Struct xpcom::interfaces::nsITransport
[−]
[src]
#[repr(C)]pub struct nsITransport { /* fields omitted */ }
interface nsITransport : nsISupports
/**
* 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.
*/
Methods
impl nsITransport
[src]
pub fn coerce<T: nsITransportCoerce>(&self) -> &T
[src]
Cast this nsITransport
to one of its base interfaces.
impl nsITransport
[src]
pub const OPEN_BLOCKING: i64
OPEN_BLOCKING: i64 = 1
/**
* Open flags.
*/
pub const OPEN_UNBUFFERED: i64
OPEN_UNBUFFERED: i64 = 2
pub const STATUS_READING: i64
STATUS_READING: i64 = 2152398856
/**
* Generic nsITransportEventSink status codes. nsITransport
* implementations may override these status codes with their own more
* specific status codes (e.g., see nsISocketTransport).
*
* In C++, these constants have a type of uint32_t, so C++ callers must use
* the NS_NET_STATUS_* constants defined below, which have a type of
* nsresult.
*/
pub const STATUS_WRITING: i64
STATUS_WRITING: i64 = 2152398857
pub unsafe fn OpenInputStream(
&self,
aFlags: uint32_t,
aSegmentSize: uint32_t,
aSegmentCount: uint32_t,
_retval: *mut *const nsIInputStream
) -> nsresult
[src]
&self,
aFlags: uint32_t,
aSegmentSize: uint32_t,
aSegmentCount: uint32_t,
_retval: *mut *const nsIInputStream
) -> nsresult
/**
* 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.
*
* @param aFlags
* optional transport specific flags.
* @param aSegmentSize
* if OPEN_UNBUFFERED is not set, then this parameter specifies the
* size of each buffer segment (pass 0 to use default value).
* @param aSegmentCount
* if OPEN_UNBUFFERED is not set, then this parameter specifies the
* maximum number of buffer segments (pass 0 to use default value).
*/
nsIInputStream openInputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount);
pub unsafe fn OpenOutputStream(
&self,
aFlags: uint32_t,
aSegmentSize: uint32_t,
aSegmentCount: uint32_t,
_retval: *mut *const nsIOutputStream
) -> nsresult
[src]
&self,
aFlags: uint32_t,
aSegmentSize: uint32_t,
aSegmentCount: uint32_t,
_retval: *mut *const nsIOutputStream
) -> nsresult
/**
* 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 guaranteed to be
* implemented when this flag is NOT specified.
*
* @param aFlags
* optional transport specific flags.
* @param aSegmentSize
* if OPEN_UNBUFFERED is not set, then this parameter specifies the
* size of each buffer segment (pass 0 to use default value).
* @param aSegmentCount
* if OPEN_UNBUFFERED is not set, then this parameter specifies the
* maximum number of buffer segments (pass 0 to use default value).
*/
nsIOutputStream openOutputStream (in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount);
pub unsafe fn Close(&self, aReason: nsresult) -> nsresult
[src]
/**
* Close the transport and any open streams.
*
* @param aReason
* the reason for closing the stream.
*/
void close (in nsresult aReason);
pub unsafe fn SetEventSink(
&self,
aSink: *const nsITransportEventSink,
aEventTarget: *const nsIEventTarget
) -> nsresult
[src]
&self,
aSink: *const nsITransportEventSink,
aEventTarget: *const nsIEventTarget
) -> nsresult
/**
* Set the transport event sink.
*
* @param aSink
* receives transport layer notifications
* @param aEventTarget
* indicates the event target to which the notifications should
* be delivered. if NULL, then the notifications may occur on
* any thread.
*/
void setEventSink (in nsITransportEventSink aSink, in nsIEventTarget aEventTarget);
Methods from Deref<Target = nsISupports>
pub fn coerce<T: nsISupportsCoerce>(&self) -> &T
[src]
Cast this nsISupports
to one of its base interfaces.
pub unsafe fn QueryInterface(
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
[src]
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);
pub unsafe fn AddRef(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt AddRef ();
pub unsafe fn Release(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt Release ();
Trait Implementations
impl XpCom for nsITransport
[src]
const IID: nsIID
IID: nsIID = nsID(713843508, 42470, 20163, [152, 101, 18, 86, 84, 20, 70, 251])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsITransport
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsITransport
[src]
type Target = nsISupports
The resulting type after dereferencing.
fn deref(&self) -> &nsISupports
[src]
Dereferences the value.