gecko-dev/netwerk/base/public/nsIChannel.idl

140 lines
5.4 KiB
Plaintext
Raw Normal View History

1999-06-07 21:33:30 +00:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIRequest.idl"
1999-06-07 21:33:30 +00:00
interface nsIURI;
interface nsIInputStream;
interface nsIOutputStream;
interface nsIStreamObserver;
interface nsIStreamListener;
interface nsILoadGroup;
1999-06-07 21:33:30 +00:00
typedef unsigned long nsLoadFlags;
1999-06-07 21:33:30 +00:00
/**
* nsIChannel is the abstract base class for transports and URLs.
* It's abstract in that it doesn't provide a means to specify the
* location/destination of the data being accessed.
*/
[scriptable, uuid(89f4afe0-1868-11d3-9337-00104ba0fd40)]
interface nsIChannel : nsIRequest
1999-06-07 21:33:30 +00:00
{
/**
* Returns the URL to which the channel refers.
*/
readonly attribute nsIURI URI;
/**
* Opens a blocking input stream to the URL's specified source.
* @param startPosition - The offset from the start of the data
* from which to read.
* @param readCount - The number of bytes to read. If -1, everything
* up to the end of the data is read. If greater than the end of
* the data, the amount available is returned in the stream.
1999-06-07 21:33:30 +00:00
*/
nsIInputStream OpenInputStream(in unsigned long startPosition,
in long readCount);
1999-06-07 21:33:30 +00:00
/**
* Opens a blocking output stream to the URL's specified destination.
* @param startPosition - The offset from the start of the data
* from which to begin writing.
1999-06-07 21:33:30 +00:00
*/
nsIOutputStream OpenOutputStream(in unsigned long startPosition);
1999-06-07 21:33:30 +00:00
/**
* Reads asynchronously from the URL's specified source. Notifications
* are provided to the stream listener on the thread of the specified
* event queue.
* The startPosition argument designates the offset in the source where
* the data will be read.
* If the readCount == -1 then all the available data is delivered to
* the stream listener.
*/
void AsyncRead(in unsigned long startPosition,
in long readCount,
in nsISupports ctxt,
in nsIStreamListener listener);
1999-06-07 21:33:30 +00:00
/**
* Writes asynchronously to the URL's specified destination. Notifications
* are provided to the stream observer on the thread of the specified
* event queue.
* The startPosition argument designates the offset in the destination where
* the data will be written.
* If the writeCount == -1, then all the available data in the input
* stream is written.
*/
void AsyncWrite(in nsIInputStream fromStream,
in unsigned long startPosition,
in long writeCount,
in nsISupports ctxt,
in nsIStreamObserver observer);
1999-06-07 21:33:30 +00:00
/**
* Load attribute flags. These may be or'd together.
*
* Note that more will follow for each protocol's implementation of a channel,
* although channel writers have to be careful to not let the flag bits
* overlap. Otherwise, users won't be able to create a single flag word
* of load attributes that applies to a number of different channel types.
*/
const unsigned long LOAD_NORMAL = 0; /* no special load attributes -- use defaults */
const unsigned long LOAD_BACKGROUND = 1 << 0; /* don't deliver status notifications to the
* nsIProgressEventSink, or keep this load from
* completing the nsILoadGroup it may belong to */
/**
* Accesses the load attributes for the channel. E.g. setting the load
* attributes with the LOAD_QUIET bit set causes the loading process to
* not deliver status notifications to the program performing the load,
* and to not contribute to keeping any nsILoadGroup it may be contained
* in from firing its OnLoadComplete notification.
*/
attribute nsLoadFlags LoadAttributes;
/**
* Returns the content MIME type of the channel if available. Note that the
* content type can often be wrongly specified (wrong file extension, wrong
* MIME type, wrong document type stored on a server, etc.) and the caller
* most likely wants to verify with the actual data.
*/
readonly attribute string ContentType;
/**
* Returns the length of the data assiciated with the channel if available.
* If the length is unknown then -1 is returned.
*/
readonly attribute long ContentLength;
/**
* Accesses the owner corresponding to the entity that is
* responsible for this channel. Used by security code to grant
* or diminish privileges to mobile code loaded from this channel.
*/
attribute nsISupports Owner;
/**
* Returns the load group in which the channel is a currently a member.
*/
1999-08-26 22:45:55 +00:00
readonly attribute nsILoadGroup LoadGroup;
1999-06-07 21:33:30 +00:00
};