This commit is contained in:
warren%netscape.com 1999-06-07 22:19:20 +00:00
Родитель 3f748629d6
Коммит 550ed382f3
5 изменённых файлов: 0 добавлений и 457 удалений

Просмотреть файл

@ -1,45 +0,0 @@
/* -*- 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.
*/
#ifndef nsICancelable_h___
#define nsICancelable_h___
#include "nsISupports.h"
#define NS_ICANCELABLE_IID \
{ /* 077437d0-ea35-11d2-931b-00104ba0fd40 */ \
0x077437d0, \
0xea35, \
0x11d2, \
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
}
class nsICancelable : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICANCELABLE_IID);
NS_IMETHOD Cancel(void) = 0;
NS_IMETHOD Suspend(void) = 0;
NS_IMETHOD Resume(void) = 0;
};
#endif /* nsICancelable_h___ */

Просмотреть файл

@ -1,70 +0,0 @@
/* -*- 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.
*/
#ifndef nsIProtocolHandler_h___
#define nsIProtocolHandler_h___
#include "nsISupports.h"
#include "nsIEventQueue.h"
class nsIConnectionGroup;
class nsIUrl;
class nsIProtocolConnection;
#define NS_IPROTOCOLHANDLER_IID \
{ /* 5da8b1b0-ea35-11d2-931b-00104ba0fd40 */ \
0x5da8b1b0, \
0xea35, \
0x11d2, \
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
}
class nsIProtocolHandler : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPROTOCOLHANDLER_IID);
NS_IMETHOD GetScheme(const char* *result) const = 0;
NS_IMETHOD GetDefaultPort(PRInt32 *result) const = 0;
NS_IMETHOD MakeAbsoluteUrl(const char* aSpec,
nsIUrl* aBaseUrl,
char* *result) const = 0;
/**
* Makes a URL object that is suitable for loading by this protocol.
* In the usual case (when only the accessors provided by nsIUrl are
* needed), this method just constructs a typical URL using the
* component manager with kTypicalUrlCID.
*/
NS_IMETHOD NewUrl(const char* aSpec,
nsIUrl* *result,
nsIUrl* aBaseUrl=0) const = 0;
NS_IMETHOD NewConnection(nsIUrl* url,
nsISupports* eventSink,
nsIEventQueue* eventQueue,
nsIProtocolConnection* *result) = 0;
};
#define NS_NETWORK_PROTOCOL_PROGID "component://netscape/network/protocol"
#define NS_NETWORK_PROTOCOL_PROGID_PREFIX NS_NETWORK_PROTOCOL_PROGID "?name="
#define NS_NETWORK_PROTOCOL_PROGID_PREFIX_LENGTH 43 // nsCRT::strlen(NS_NETWORK_PROTOCOL_PROGID_PREFIX)
#endif /* nsIIProtocolHandler_h___ */

Просмотреть файл

@ -1,91 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*/
#ifndef _nsIProtocolInstance_h_
#define _nsIProtocolInstance_h_
#include "nsICancelable.h"
class nsIInputStream;
class nsIOutputStream;
/*
The nsIProtocolInstance class is a common interface to all protocol
functionality. This base interface will support at getting the input
stream and the outputstream for the "connection"
There are still issues on what is the most common interface for the
extreme cases of an interactive protocol like HTTP vs. events based
one like SMTP/IMAP. This interface will probably go thru some
redesigning.
-Gagan Saksena 03/15/99
*/
class nsIProtocolInstance : public nsICancelable
{
public:
/*
The BLOCKING GetInputStream function. Note that this function is not
a const and calling it may result in a state change for the protocol
instance. Its upto the protocol to reflect an already open input
stream through the return methods.
*/
NS_IMETHOD GetInputStream(nsIInputStream* *o_Stream) = 0;
/*
The BLOCKING GetOutputStream function. Note that this function is not
a const and calling it may result in a state change for the protocol
instance. Its upto the protocol to reflect an already closed
connection through the return methods.
*/
NS_IMETHOD GetOutputStream(nsIOutputStream* *o_Stream) = 0;
/*
The load function that makes the actual attempt to starts the
retrieval process. Depending upon the protocol's implementation
this function may open the network connection.
*/
NS_IMETHOD Connect(nsISupports* i_EventSink) = 0;
static const nsIID& GetIID() {
// {3594D180-CB85-11d2-A1BA-444553540000}
static const nsIID NS_IProtocolInstance_IID =
{ 0x3594d180, 0xcb85, 0x11d2, { 0xa1, 0xba, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
return NS_IProtocolInstance_IID;
};
protected:
/*
Protocol's check for connection status. Once Load is called, this
should return true. TODO THINK
NS_IMETHOD_(PRBool) IsConnected(void) = 0;
*/
};
//Possible errors
#define NS_ERROR_ALREADY_CONNECTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 150);
#endif /* _nsIProtocolInstance_h_ */

Просмотреть файл

@ -1,171 +0,0 @@
/* -*- 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.
*/
#ifndef nsIUrl_h___
#define nsIUrl_h___
#include "nsISupports.h"
#include "nsIConnectionGroup.h"
#include "nscore.h"
#undef GetPort // Windows (sigh)
#define NS_IURL_IID \
{ /* 82c1b000-ea35-11d2-931b-00104ba0fd40 */ \
0x82c1b000, \
0xea35, \
0x11d2, \
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
}
/**
* The nsIUrl class is an interface to the URL behaviour for parsing
* portions out of a URI. This follows Tim Berners-Lee's URI spec at-
*
* http://www.w3.org/Addressing/URI/URI_Overview.html
*
* For the purpose of this class, here is the most elaborate form of a URI
* and its corresponding parts-
*
* ftp://username:password@hostname:portnumber/pathname
* \ / \ / \ / \ /\ /
* - --------------- ------ -------- -------
* | | | | |
* | | | | Path
* | | | Port
* | | Host
* | PreHost
* Scheme
*
* Note that this class does not assume knowledge of search/query portions
* embedded within the path portion of the URI.
*
* This class pretty much "final" and there shouldn't be anything added.
* If you do feel something belongs here, please do send me a mail. Thanks!
*/
class nsIUrl : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IURL_IID);
/**
* Parses a URL spec (a string) relative to a base URL.
* Any defaults not specified in the spec (because it is a relative
* spec) are pulled from the base. The baseUrl can be null in which
* case the spec must be an absolute URL.
*/
NS_IMETHOD Init(const char* spec, nsIUrl* baseUrl) = 0;
/**
* The Scheme is the protocol that this URI refers to.
*/
NS_IMETHOD GetScheme(const char* *result) = 0;
NS_IMETHOD SetScheme(const char* scheme) = 0;
/**
* The PreHost portion includes elements like the optional
* username:password, or maybe other scheme specific items.
*/
NS_IMETHOD GetPreHost(const char* *result) = 0;
NS_IMETHOD SetPreHost(const char* preHost) = 0;
/**
* The Host is the internet domain name to which this URI refers.
* Note that it could be an IP address as well.
*/
NS_IMETHOD GetHost(const char* *result) = 0;
NS_IMETHOD SetHost(const char* host) = 0;
/**
* A return value of -1 indicates that no port value is set and the
* implementor of the specific scheme will use its default port.
* Similarly setting a value of -1 indicates that the default is to be used.
* Thus as an example-
* for HTTP, Port 80 is same as a return value of -1.
* However after setting a port (even if its default), the port number will
* appear in the ToString function.
*/
NS_IMETHOD GetPort(PRInt32 *result) = 0;
NS_IMETHOD SetPort(PRInt32 port) = 0;
/**
* Note that the path includes the leading '/' Thus if no path is
* available the GetPath will return a "/"
* For SetPath if none is provided, one would be prefixed to the path.
*/
NS_IMETHOD GetPath(const char* *result) = 0;
NS_IMETHOD SetPath(const char* path) = 0;
// Other utility functions
/**
* Note that this comparison is only on char* level. Use
* the scheme specific URI to do a more thorough check. For example--
* in HTTP-
* http://foo.com:80 == http://foo.com
* but this function through nsIURI alone will not return equality
* for this case.
* @return NS_OK if equal
* @return NS_COMFALSE if not equal
*/
NS_IMETHOD Equals(nsIUrl* other) = 0;
/**
* Makes a copy of the URL.
*/
NS_IMETHOD Clone(nsIUrl* *result) = 0;
/**
* Writes a string representation of the URI.
* Free string with delete[].
*/
NS_IMETHOD ToNewCString(char* *uriString) = 0;
};
////////////////////////////////////////////////////////////////////////////////
/**
* Protocol writers can obtain a default nsIUrl implementation by calling the
* component manager with NS_STANDARDURL_CID. The implementation returned will
* only implement the set of accessors specified by nsIUrl. After obtaining the
* instance from the component manager, the Init routine must be called on it
* to initialize it from the user's URL spec.
*/
#define NS_STANDARDURL_CID \
{ /* 46fc2a26-ff66-11d2-8ccb-0060b0fc14a3 */ \
0x46fc2a26, \
0xff66, \
0x11d2, \
{0x8c, 0xcb, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
}
////////////////////////////////////////////////////////////////////////////////
extern nsresult
NS_NewURL(nsIUrl** aInstancePtrResult, const char *aSpec, nsIUrl* aBaseUrl);
extern nsresult
NS_NewConnection(nsIUrl* url,
nsISupports* eventSink,
nsIConnectionGroup* group,
nsIProtocolConnection* *result);
////////////////////////////////////////////////////////////////////////////////
#endif /* nsIIUrl_h___ */

Просмотреть файл

@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*/
#ifndef _nsIHTTPConnection_h_
#define _nsIHTTPConnection_h_
#include "nsIProtocolConnection.h"
#include "nsHTTPEnums.h"
#include "nsIStreamListener.h"
class nsIHTTPEventSink;
/*
The nsIHTTPConnection class is the interface to an intance
of the HTTP that acts on a per URL basis. This used to be the
nsIHTTPInstance class when nsIProtocolConnection used to be
correctly called nsIProtocolInstance. If this confuses you
don't blame me :-)
-Gagan Saksena 03/06/99
*/
class nsIHTTPConnection : public nsIProtocolConnection
{
public:
/*
Request functions-
These functions set/get parameters on the outbound request and may only
be set before Load() function gets called. Calling them after
the Load() method will result in a NS_ERROR_ALREADY_CONNECTED
*/
NS_IMETHOD GetRequestHeader(const char* i_Header, const char* *o_Value) const = 0;
NS_IMETHOD SetRequestHeader(const char* i_Header, const char* i_Value) = 0;
NS_IMETHOD SetRequestMethod(HTTPMethod i_Method=HM_GET) = 0;
/*
Response funtions. A call to any of these implicitly calls Load() on this
protocol instance.
*/
NS_IMETHOD GetResponseHeader(const char* i_Header, const char* *o_Value) = 0;
NS_IMETHOD GetResponseStatus(PRInt32* o_Status) = 0;
NS_IMETHOD GetResponseString(const char* *o_String) = 0;
NS_IMETHOD EventSink(nsIHTTPEventSink* *o_EventSink) const = 0;
static const nsIID& GetIID() {
// {843D1020-D0DF-11d2-B013-006097BFC036}
static const nsIID NS_IHTTPConnection_IID =
{ 0x843d1020, 0xd0df, 0x11d2, { 0xb0, 0x13, 0x0, 0x60, 0x97, 0xbf, 0xc0, 0x36 } };
return NS_IHTTPConnection_IID;
};
NS_IMETHOD GetResponseDataListener(nsIStreamListener* *aListener) = 0;
};
//Possible errors
//#define NS_ERROR_WHATEVER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 400);
#endif /* _nsIHTTPConnection_h_ */