mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Initial stab at new networking implementation.
This commit is contained in:
parent
30efc98a78
commit
e7997a1925
27
netwerk/base/makefile.win
Normal file
27
netwerk/base/makefile.win
Normal file
@ -0,0 +1,27 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..\..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
35
netwerk/base/public/makefile.win
Normal file
35
netwerk/base/public/makefile.win
Normal file
@ -0,0 +1,35 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsICancelable.h \
|
||||
nsIConnectionGroup.h \
|
||||
nsINetService.h \
|
||||
nsIProtocolConnection.h \
|
||||
nsIProtocolHandler.h \
|
||||
nsIStreamListener.h \
|
||||
nsITransport.h \
|
||||
nsITransportService.h \
|
||||
nsIUrl.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
46
netwerk/base/public/nsICancelable.h
Normal file
46
netwerk/base/public/nsICancelable.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* -*- 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"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ICANCELABLE_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x6f, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
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___ */
|
63
netwerk/base/public/nsIConnectionGroup.h
Normal file
63
netwerk/base/public/nsIConnectionGroup.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- 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 nsIConnectionGroup_h___
|
||||
#define nsIConnectionGroup_h___
|
||||
|
||||
#include "nsICancelable.h"
|
||||
#include "nsICollection.h"
|
||||
|
||||
class nsIProtocolConnection;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ICONNECTIONGROUP_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x6f, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIConnectionGroup : public nsICancelable, public nsICollection
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONNECTIONGROUP_IID);
|
||||
|
||||
/**
|
||||
* Add a child to an nsIConnectionGroup.
|
||||
*
|
||||
* @param aGroup The nsIConnectionGroup to be added as a child. When the
|
||||
* child is added it will receive the nsILoadAttribs
|
||||
* of its parent...
|
||||
*
|
||||
* @return Returns NS_OK if successful, otherwise NS_ERROR_FAILURE.
|
||||
*/
|
||||
NS_IMETHOD AddChildGroup(nsIConnectionGroup* aGroup) = 0;
|
||||
|
||||
/**
|
||||
* Remove a child from an nsIConnectionGroup.
|
||||
*
|
||||
* @param aGroup The nsIConnectionGroup to be removed.
|
||||
*
|
||||
* @return Returns NS_OK if successful, otherwise NS_ERROR_FAILURE.
|
||||
*/
|
||||
NS_IMETHOD RemoveChildGroup(nsIConnectionGroup* aGroup) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIConnectionGroup_h___ */
|
72
netwerk/base/public/nsINetService.h
Normal file
72
netwerk/base/public/nsINetService.h
Normal file
@ -0,0 +1,72 @@
|
||||
/* -*- 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 nsINetService_h___
|
||||
#define nsINetService_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIUrl;
|
||||
class nsIProtocolConnection;
|
||||
class nsIConnectionGroup;
|
||||
class nsIProtocolHandler;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_INETSERVICE_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_NETSERVICE_CID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x01, 0x60, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsINetService : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INETSERVICE_IID);
|
||||
|
||||
NS_IMETHOD GetProtocolHandler(nsIUrl* url, nsIProtocolHandler* *result) = 0;
|
||||
|
||||
NS_IMETHOD NewConnectionGroup(nsIConnectionGroup* *result) = 0;
|
||||
|
||||
NS_IMETHOD NewURL(nsIUrl* *result,
|
||||
const char* aSpec,
|
||||
const nsIUrl* aBaseURL,
|
||||
nsISupports* aContainer) = 0;
|
||||
|
||||
NS_IMETHOD Open(nsIUrl* url, nsISupports* eventSink,
|
||||
nsIConnectionGroup* group,
|
||||
nsIProtocolConnection* *result) = 0;
|
||||
|
||||
/**
|
||||
* @return NS_OK if there are active connections
|
||||
* @return NS_COMFALSE if there are not.
|
||||
*/
|
||||
NS_IMETHOD HasActiveConnections() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIINetService_h___ */
|
58
netwerk/base/public/nsIProtocolConnection.h
Normal file
58
netwerk/base/public/nsIProtocolConnection.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*- 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 nsIProtocolConnection_h___
|
||||
#define nsIProtocolConnection_h___
|
||||
|
||||
#include "nsICancelable.h"
|
||||
|
||||
class nsIUrl;
|
||||
class nsIInputStream;
|
||||
class nsIOutputStream;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IPROTOCOLCONNECTION_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIProtocolConnection : public nsICancelable
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPROTOCOLCONNECTION_IID);
|
||||
|
||||
NS_IMETHOD Open(nsIUrl* url, nsISupports* eventSink) = 0;
|
||||
|
||||
// blocking:
|
||||
NS_IMETHOD GetInputStream(nsIInputStream* *result) = 0;
|
||||
|
||||
// blocking:
|
||||
NS_IMETHOD GetOutputStream(nsIOutputStream* *result) = 0;
|
||||
|
||||
// bletch...
|
||||
NS_IMETHOD AsyncWrite(nsIInputStream* data, PRUint32 count,
|
||||
nsresult (*callback)(void* closure, PRUint32 count),
|
||||
void* closure) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIIProtocolConnection_h___ */
|
||||
|
52
netwerk/base/public/nsIProtocolHandler.h
Normal file
52
netwerk/base/public/nsIProtocolHandler.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* -*- 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"
|
||||
|
||||
class nsIConnectionGroup;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IPROTOCOLHANDLER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xa8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIProtocolHandler : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPROTOCOLHANDLER_IID);
|
||||
|
||||
NS_IMETHOD GetScheme(const char* *o_Scheme) = 0;
|
||||
|
||||
NS_IMETHOD GetDefaultPort(PRInt32 *result) = 0;
|
||||
|
||||
NS_IMETHOD Open(nsIUrl* url, nsISupports* eventSink,
|
||||
nsIConnectionGroup* group,
|
||||
nsIProtocolConnection* *result) = 0;
|
||||
};
|
||||
|
||||
#define NS_NETWORK_PROTOCOL_PROGID "component://netscape/network/protocol?name="
|
||||
#define NS_NETWORK_PROTOCOL_PROGID_PREFIX NS_NETWORK_PROTOCOL_PROGID "?name="
|
||||
|
||||
#endif /* nsIIProtocolHandler_h___ */
|
104
netwerk/base/public/nsIStreamListener.h
Normal file
104
netwerk/base/public/nsIStreamListener.h
Normal file
@ -0,0 +1,104 @@
|
||||
/* -*- 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 nsIStreamListener_h___
|
||||
#define nsIStreamListener_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
#include "plevent.h"
|
||||
|
||||
class nsIUrl;
|
||||
class nsIInputStream;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ISTREAMLISTENER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0x09, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
struct nsStreamBindingInfo {
|
||||
PRBool seekable;
|
||||
/* ...more... */
|
||||
};
|
||||
|
||||
class nsIStreamListener : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTREAMLISTENER_IID);
|
||||
|
||||
/**
|
||||
* Notify the listener that the URL has started to load. This method is
|
||||
* called only once, at the beginning of a URL load.<BR><BR>
|
||||
*
|
||||
* @return The return value is currently ignored. In the future it may be
|
||||
* used to cancel the URL load..
|
||||
*/
|
||||
NS_IMETHOD OnStartBinding(nsIUrl* aUrl, const char *aContentType) = 0;
|
||||
|
||||
/**
|
||||
* Notify the client that data is available in the input stream. This
|
||||
* method is called whenver data is written into the input stream by the
|
||||
* networking library...<BR><BR>
|
||||
*
|
||||
* @param pIStream The input stream containing the data. This stream can
|
||||
* be either a blocking or non-blocking stream.
|
||||
* @param length The amount of data that was just pushed into the stream.
|
||||
* @return The return value is currently ignored.
|
||||
*/
|
||||
NS_IMETHOD OnDataAvailable(nsIUrl* aUrl, nsIInputStream *aIStream,
|
||||
PRUint32 aLength) = 0;
|
||||
|
||||
/**
|
||||
* Notify the listener that the URL has finished loading. This method is
|
||||
* called once when the networking library has finished processing the
|
||||
* URL transaction initiatied via the nsINetService::Open(...) call.<BR><BR>
|
||||
*
|
||||
* This method is called regardless of whether the URL loaded successfully.<BR><BR>
|
||||
*
|
||||
* @param status Status code for the URL load.
|
||||
* @param msg A text string describing the error.
|
||||
* @return The return value is currently ignored.
|
||||
*/
|
||||
NS_IMETHOD OnStopBinding(nsIUrl* aUrl, nsresult aStatus, const PRUnichar* aMsg) = 0;
|
||||
|
||||
/**
|
||||
* Return information regarding the current URL load.<BR>
|
||||
* The info structure that is passed in is filled out and returned
|
||||
* to the caller.
|
||||
*
|
||||
* This method is currently not called.
|
||||
*/
|
||||
NS_IMETHOD GetBindInfo(nsIUrl* aUrl, nsStreamBindingInfo* aInfo) = 0;
|
||||
|
||||
};
|
||||
|
||||
/* Generic status codes for OnStopBinding */
|
||||
#define NS_BINDING_SUCCEEDED NS_OK
|
||||
#define NS_BINDING_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
|
||||
#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
|
||||
|
||||
extern nsresult
|
||||
NS_NewMarshalingStreamListener(PLEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver,
|
||||
nsIStreamListener* *result);
|
||||
|
||||
#endif /* nsIIStreamListener_h___ */
|
46
netwerk/base/public/nsITransport.h
Normal file
46
netwerk/base/public/nsITransport.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* -*- 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 nsITransport_h___
|
||||
#define nsITransport_h___
|
||||
|
||||
#include "nsICancelable.h"
|
||||
|
||||
class nsIStreamListener;
|
||||
class nsIStreamObserver;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ITRANSPORT_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xe8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsITransport : public nsICancelable
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITRANSPORT_IID);
|
||||
|
||||
NS_IMETHOD AsyncRead(nsIStreamListener* listener) = 0;
|
||||
|
||||
NS_IMETHOD AsyncWrite(nsIStreamObserver* observer) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIITransport_h___ */
|
69
netwerk/base/public/nsITransportService.h
Normal file
69
netwerk/base/public/nsITransportService.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* -*- 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 nsITransportService_h___
|
||||
#define nsITransportService_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "plevent.h"
|
||||
|
||||
class nsITransport;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ITRANSPORTSERVICE_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xd8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_TRANSPORTSERVICE_CID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x87, 0x6a, 0x00, 0x60, 0xd8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsITransportService : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITRANSPORTSERVICE_IID);
|
||||
|
||||
NS_IMETHOD GetFileTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* path,
|
||||
nsITransport* *result) = 0;
|
||||
|
||||
NS_IMETHOD GetSocketTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* host, PRInt32 port,
|
||||
nsITransport* *result) = 0;
|
||||
|
||||
NS_IMETHOD GetJarTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* jarFilePath, const char* jarEntryPath,
|
||||
nsITransport* *result) = 0;
|
||||
|
||||
/**
|
||||
* @return NS_OK if there are active transports
|
||||
* @return NS_COMFALSE if there are not.
|
||||
*/
|
||||
NS_IMETHOD HasActiveTransports() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIITransportService_h___ */
|
128
netwerk/base/public/nsIUrl.h
Normal file
128
netwerk/base/public/nsIUrl.h
Normal file
@ -0,0 +1,128 @@
|
||||
/* -*- 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"
|
||||
|
||||
#undef GetPort // Windows (sigh)
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IURL_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xf8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
/**
|
||||
* The nsIURI class is an interface to the URI 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);
|
||||
|
||||
// Core parsing functions
|
||||
|
||||
/**
|
||||
* 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(const nsIUrl* other) = 0;
|
||||
|
||||
/**
|
||||
* Writes a string representation of the URI.
|
||||
* Free string with delete[].
|
||||
*/
|
||||
NS_IMETHOD ToNewCString(const char* *uriString) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIIUrl_h___ */
|
50
netwerk/base/src/makefile.win
Normal file
50
netwerk/base/src/makefile.win
Normal file
@ -0,0 +1,50 @@
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
LCFLAGS = -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
LIBRARY_NAME=netwerkbase_s
|
||||
|
||||
EXPORTS = \
|
||||
nsConnectionGroup.h \
|
||||
nsNetService.h \
|
||||
nsTransportService.h \
|
||||
nsUrl.h \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsConnectionGroup.obj \
|
||||
.\$(OBJDIR)\nsMarshalingStreamListener.obj \
|
||||
.\$(OBJDIR)\nsNetService.obj \
|
||||
.\$(OBJDIR)\nsTransportService.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\netwerk \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
164
netwerk/base/src/nsConnectionGroup.cpp
Normal file
164
netwerk/base/src/nsConnectionGroup.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
/* -*- 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 "nsConnectionGroup.h"
|
||||
#include "nsIProtocolConnection.h"
|
||||
#include "nscore.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsConnectionGroup::nsConnectionGroup()
|
||||
: mElements(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsConnectionGroup::Init()
|
||||
{
|
||||
nsresult rv = NS_NewISupportsArray(&mElements);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsConnectionGroup::~nsConnectionGroup()
|
||||
{
|
||||
NS_IF_RELEASE(mElements);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsConnectionGroup);
|
||||
NS_IMPL_RELEASE(nsConnectionGroup);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (result == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIConnectionGroup::GetIID()) ||
|
||||
iid.Equals(kISupportsIID)) {
|
||||
*result = NS_STATIC_CAST(nsIConnectionGroup*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsICancelable::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsICancelable*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsICollection::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsICollection*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsICancelable methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::Cancel(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 cnt = mElements->Count();
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsIProtocolConnection* connection =
|
||||
(nsIProtocolConnection*)(*mElements)[i];
|
||||
rv = connection->Cancel();
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::Suspend(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 cnt = mElements->Count();
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsIProtocolConnection* connection =
|
||||
(nsIProtocolConnection*)(*mElements)[i];
|
||||
rv = connection->Suspend();
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::Resume(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 cnt = mElements->Count();
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsIProtocolConnection* connection =
|
||||
(nsIProtocolConnection*)(*mElements)[i];
|
||||
rv = connection->Resume();
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsICollection methods:
|
||||
|
||||
NS_IMETHODIMP_(PRUint32)
|
||||
nsConnectionGroup::Count(void) const
|
||||
{
|
||||
return mElements->Count();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::AppendElement(nsISupports* connection)
|
||||
{
|
||||
return mElements->AppendElement(connection);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::RemoveElement(nsISupports* connection)
|
||||
{
|
||||
return mElements->RemoveElement(connection);
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::Enumerate(nsIEnumerator* *result)
|
||||
{
|
||||
return mElements->Enumerate(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::Clear(void)
|
||||
{
|
||||
return mElements->Clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIConnectionGroup methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::AddChildGroup(nsIConnectionGroup* aGroup)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConnectionGroup::RemoveChildGroup(nsIConnectionGroup* aGroup)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
59
netwerk/base/src/nsConnectionGroup.h
Normal file
59
netwerk/base/src/nsConnectionGroup.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* -*- 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 nsConnectionGroup_h__
|
||||
#define nsConnectionGroup_h__
|
||||
|
||||
#include "nsIConnectionGroup.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsIProtocolConnection;
|
||||
|
||||
class nsConnectionGroup : public nsIConnectionGroup
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsICancelable methods:
|
||||
NS_IMETHOD Cancel(void);
|
||||
NS_IMETHOD Suspend(void);
|
||||
NS_IMETHOD Resume(void);
|
||||
|
||||
// nsICollection methods:
|
||||
NS_IMETHOD_(PRUint32) Count(void) const;
|
||||
NS_IMETHOD AppendElement(nsISupports *aItem);
|
||||
NS_IMETHOD RemoveElement(nsISupports *aItem);
|
||||
NS_IMETHOD Enumerate(nsIEnumerator* *result);
|
||||
NS_IMETHOD Clear(void);
|
||||
|
||||
// nsIConnectionGroup methods:
|
||||
NS_IMETHOD AddChildGroup(nsIConnectionGroup* aGroup);
|
||||
NS_IMETHOD RemoveChildGroup(nsIConnectionGroup* aGroup);
|
||||
|
||||
// nsConnectionGroup methods:
|
||||
nsConnectionGroup();
|
||||
virtual ~nsConnectionGroup();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
nsISupportsArray* mElements;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsConnectionGroup_h__
|
391
netwerk/base/src/nsMarshalingStreamListener.cpp
Normal file
391
netwerk/base/src/nsMarshalingStreamListener.cpp
Normal file
@ -0,0 +1,391 @@
|
||||
/* -*- 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 "nsIStreamListener.h"
|
||||
#include "nsIUrl.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
class nsMarshalingStreamListener : public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnStartBinding(nsIUrl* aUrl, const char *aContentType);
|
||||
NS_IMETHOD OnDataAvailable(nsIUrl* aUrl, nsIInputStream *aIStream,
|
||||
PRUint32 aLength);
|
||||
NS_IMETHOD OnStopBinding(nsIUrl* aUrl, nsresult aStatus, const PRUnichar* aMsg);
|
||||
NS_IMETHOD GetBindInfo(nsIUrl* aUrl, nsStreamBindingInfo* aInfo);
|
||||
|
||||
// nsMarshalingStreamListener methods:
|
||||
nsMarshalingStreamListener(PLEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver)
|
||||
: mEventQueue(eventQueue), mReceiver(receiver) {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsMarshalingStreamListener();
|
||||
|
||||
nsIStreamListener* GetReceiver() { return mReceiver; }
|
||||
nsresult GetStatus() { return mStatus; }
|
||||
void SetStatus(nsresult value) { mStatus = value; }
|
||||
|
||||
protected:
|
||||
PLEventQueue* mEventQueue;
|
||||
nsIStreamListener* mReceiver;
|
||||
nsresult mStatus;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsStreamListenerEvent : public PLEvent
|
||||
{
|
||||
public:
|
||||
nsStreamListenerEvent(nsMarshalingStreamListener* listener, nsIUrl* url);
|
||||
virtual ~nsStreamListenerEvent();
|
||||
|
||||
nsresult Fire(PLEventQueue* aEventQ);
|
||||
|
||||
NS_IMETHOD HandleEvent() = 0;
|
||||
|
||||
protected:
|
||||
static void PR_CALLBACK HandlePLEvent(PLEvent* aEvent);
|
||||
static void PR_CALLBACK DestroyPLEvent(PLEvent* aEvent);
|
||||
|
||||
nsMarshalingStreamListener* mListener;
|
||||
nsIUrl* mURL;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsStreamListenerEvent::nsStreamListenerEvent(nsMarshalingStreamListener* listener, nsIUrl* url)
|
||||
: mListener(listener), mURL(url)
|
||||
{
|
||||
NS_ADDREF(mListener);
|
||||
NS_ADDREF(mURL);
|
||||
}
|
||||
|
||||
nsStreamListenerEvent::~nsStreamListenerEvent()
|
||||
{
|
||||
NS_RELEASE(mListener);
|
||||
NS_RELEASE(mURL);
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsStreamListenerEvent::HandlePLEvent(PLEvent* aEvent)
|
||||
{
|
||||
// WARNING: This is a dangerous cast since it must adjust the pointer
|
||||
// to compensate for the vtable...
|
||||
nsStreamListenerEvent *ev = (nsStreamListenerEvent*)aEvent;
|
||||
|
||||
nsresult rv = ev->HandleEvent();
|
||||
ev->mListener->SetStatus(rv);
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsStreamListenerEvent::DestroyPLEvent(PLEvent* aEvent)
|
||||
{
|
||||
// WARNING: This is a dangerous cast since it must adjust the pointer
|
||||
// to compensate for the vtable...
|
||||
nsStreamListenerEvent *ev = (nsStreamListenerEvent*)aEvent;
|
||||
|
||||
delete ev;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStreamListenerEvent::Fire(PLEventQueue* aEventQueue)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aEventQueue, "PLEventQueue for thread is null");
|
||||
|
||||
PL_InitEvent(this, nsnull,
|
||||
(PLHandleEventProc) nsStreamListenerEvent::HandlePLEvent,
|
||||
(PLDestroyEventProc) nsStreamListenerEvent::DestroyPLEvent);
|
||||
|
||||
PRStatus status = PL_PostEvent(aEventQueue, this);
|
||||
return status == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsMarshalingStreamListener::~nsMarshalingStreamListener()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsMarshalingStreamListener, nsIStreamListener::GetIID());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStartBindingEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStartBindingEvent(nsMarshalingStreamListener* listener, nsIUrl* url)
|
||||
: nsStreamListenerEvent(listener, url), mContentType(nsnull) {}
|
||||
virtual ~nsOnStartBindingEvent();
|
||||
|
||||
nsresult Init(const char* aContentType);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
char* mContentType;
|
||||
};
|
||||
|
||||
nsOnStartBindingEvent::~nsOnStartBindingEvent()
|
||||
{
|
||||
if (mContentType)
|
||||
delete[] mContentType;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnStartBindingEvent::Init(const char* aContentType)
|
||||
{
|
||||
mContentType = nsCRT::strdup(aContentType);
|
||||
if (mContentType == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStartBindingEvent::HandleEvent()
|
||||
{
|
||||
return mListener->GetReceiver()->OnStartBinding(mURL, mContentType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamListener::OnStartBinding(nsIUrl* aUrl, const char *aContentType)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStartBindingEvent* event =
|
||||
new nsOnStartBindingEvent(this, aUrl);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aContentType);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnDataAvailableEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnDataAvailableEvent(nsMarshalingStreamListener* listener, nsIUrl* url)
|
||||
: nsStreamListenerEvent(listener, url), mIStream(nsnull), mLength(0) {}
|
||||
virtual ~nsOnDataAvailableEvent();
|
||||
|
||||
nsresult Init(nsIInputStream* aIStream, PRUint32 aLength);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsIInputStream* mIStream;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
nsOnDataAvailableEvent::~nsOnDataAvailableEvent()
|
||||
{
|
||||
NS_RELEASE(mIStream);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnDataAvailableEvent::Init(nsIInputStream* aIStream, PRUint32 aLength)
|
||||
{
|
||||
mLength = aLength;
|
||||
mIStream = aIStream;
|
||||
NS_ADDREF(mIStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnDataAvailableEvent::HandleEvent()
|
||||
{
|
||||
return mListener->GetReceiver()->OnDataAvailable(mURL, mIStream, mLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamListener::OnDataAvailable(nsIUrl* aUrl, nsIInputStream *aIStream,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnDataAvailableEvent* event =
|
||||
new nsOnDataAvailableEvent(this, aUrl);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aIStream, aLength);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStopBindingEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStopBindingEvent(nsMarshalingStreamListener* listener, nsIUrl* url)
|
||||
: nsStreamListenerEvent(listener, url), mStatus(NS_OK), mMessage(nsnull) {}
|
||||
virtual ~nsOnStopBindingEvent();
|
||||
|
||||
nsresult Init(nsresult status, const PRUnichar* aMsg);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsresult mStatus;
|
||||
PRUnichar* mMessage;
|
||||
};
|
||||
|
||||
nsOnStopBindingEvent::~nsOnStopBindingEvent()
|
||||
{
|
||||
if (mMessage)
|
||||
delete[] mMessage;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnStopBindingEvent::Init(nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
mStatus = status;
|
||||
mMessage = nsCRT::strdup(aMsg);
|
||||
if (mMessage == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStopBindingEvent::HandleEvent()
|
||||
{
|
||||
return mListener->GetReceiver()->OnStopBinding(mURL, mStatus, mMessage);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamListener::OnStopBinding(nsIUrl* aUrl, nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStopBindingEvent* event =
|
||||
new nsOnStopBindingEvent(this, aUrl);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if 0
|
||||
class nsGetBindInfoEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsGetBindInfoEvent(nsMarshalingStreamListener* listener, nsIUrl* url)
|
||||
: nsStreamListenerEvent(listener, url), mContentType(nsnull) {}
|
||||
virtual ~nsGetBindInfoEvent();
|
||||
|
||||
nsresult Init(const char* aContentType);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
char* mContentType;
|
||||
};
|
||||
|
||||
nsGetBindInfoEvent::~nsGetBindInfoEvent()
|
||||
{
|
||||
if (mContentType)
|
||||
delete[] mContentType;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGetBindInfoEvent::Init(const char* aContentType)
|
||||
{
|
||||
mContentType = nsCRT::strdup(aContentType);
|
||||
if (mContentType == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGetBindInfoEvent::HandleEvent()
|
||||
{
|
||||
return mListener->GetReceiver()->GetBindInfo(mURL, mContentType);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamListener::GetBindInfo(nsIUrl* aUrl, nsStreamBindingInfo* aInfo)
|
||||
{
|
||||
#if 0
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsGetBindInfoEvent* event =
|
||||
new nsGetBindInfoEvent(this, aUrl);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aContentType);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewMarshalingStreamListener(PLEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver,
|
||||
nsIStreamListener* *result)
|
||||
{
|
||||
nsMarshalingStreamListener* l =
|
||||
new nsMarshalingStreamListener(eventQueue, receiver);
|
||||
if (l == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(l);
|
||||
*result = l;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
134
netwerk/base/src/nsNetService.cpp
Normal file
134
netwerk/base/src/nsNetService.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/* -*- 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 "nsNetService.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsUrl.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString2.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsITransportService.h"
|
||||
#include "nsConnectionGroup.h"
|
||||
|
||||
static NS_DEFINE_CID(kTransportService, NS_TRANSPORTSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsNetService::nsNetService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNetService::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsNetService::~nsNetService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsNetService, nsINetService::GetIID());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetService::GetProtocolHandler(nsIUrl* url, nsIProtocolHandler* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
const char* scheme;
|
||||
|
||||
rv = url->GetScheme(&scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
# define BUF_SIZE 128
|
||||
char buf[BUF_SIZE];
|
||||
nsAutoString2 progID(NS_NETWORK_PROTOCOL_PROGID_PREFIX);
|
||||
progID += scheme;
|
||||
progID.ToCString(buf, BUF_SIZE);
|
||||
|
||||
nsIProtocolHandler* handler;
|
||||
rv = nsServiceManager::GetService(buf, nsIProtocolHandler::GetIID(),
|
||||
(nsISupports**)&handler);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = handler;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetService::NewConnectionGroup(nsIConnectionGroup* *result)
|
||||
{
|
||||
nsConnectionGroup* group = new nsConnectionGroup();
|
||||
if (group == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsresult rv = group->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete group;
|
||||
return rv;
|
||||
}
|
||||
NS_ADDREF(group);
|
||||
*result = group;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetService::NewURL(nsIUrl* *result,
|
||||
const char* aSpec,
|
||||
const nsIUrl* aBaseURL,
|
||||
nsISupports* aContainer)
|
||||
{
|
||||
nsresult rv;
|
||||
nsUrl* url = new nsUrl();
|
||||
if (url == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = url->Init(aSpec, aBaseURL, aContainer);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete url;
|
||||
return rv;
|
||||
}
|
||||
NS_ADDREF(url);
|
||||
*result = url;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetService::Open(nsIUrl* url, nsISupports* eventSink,
|
||||
nsIConnectionGroup* group,
|
||||
nsIProtocolConnection* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIProtocolHandler* handler;
|
||||
rv = GetProtocolHandler(url, &handler);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return handler->Open(url, eventSink, group, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetService::HasActiveConnections()
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsITransportService, trans, kTransportService, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return trans->HasActiveTransports();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
51
netwerk/base/src/nsNetService.h
Normal file
51
netwerk/base/src/nsNetService.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* -*- 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 nsNetService_h__
|
||||
#define nsNetService_h__
|
||||
|
||||
#include "nsINetService.h"
|
||||
|
||||
class nsNetService : public nsINetService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetService methods:
|
||||
NS_IMETHOD GetProtocolHandler(nsIUrl* url, nsIProtocolHandler* *result);
|
||||
NS_IMETHOD NewConnectionGroup(nsIConnectionGroup* *result);
|
||||
NS_IMETHOD NewURL(nsIUrl* *result,
|
||||
const char* aSpec,
|
||||
const nsIUrl* aBaseURL,
|
||||
nsISupports* aContainer);
|
||||
NS_IMETHOD Open(nsIUrl* url, nsISupports* eventSink,
|
||||
nsIConnectionGroup* aGroup,
|
||||
nsIProtocolConnection* *result);
|
||||
NS_IMETHOD HasActiveConnections();
|
||||
|
||||
// nsNetService methods:
|
||||
nsNetService();
|
||||
virtual ~nsNetService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // nsNetService_h__
|
75
netwerk/base/src/nsTransportService.cpp
Normal file
75
netwerk/base/src/nsTransportService.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
/* -*- 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 "nsTransportService.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsTransportService, nsITransportService::GetIID());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsTransportService methods:
|
||||
|
||||
nsTransportService::nsTransportService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTransportService::~nsTransportService()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTransportService::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsITransportService methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransportService::GetFileTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* path,
|
||||
nsITransport* *result)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransportService::GetSocketTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* host, PRInt32 port,
|
||||
nsITransport* *result)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransportService::GetJarTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* jarFilePath, const char* jarEntryPath,
|
||||
nsITransport* *result)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransportService::HasActiveTransports()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
51
netwerk/base/src/nsTransportService.h
Normal file
51
netwerk/base/src/nsTransportService.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* -*- 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 nsTransportService_h___
|
||||
#define nsTransportService_h___
|
||||
|
||||
#include "nsITransportService.h"
|
||||
|
||||
class nsTransportService : public nsITransportService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsITransportService methods:
|
||||
NS_IMETHOD GetFileTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* path,
|
||||
nsITransport* *result);
|
||||
NS_IMETHOD GetSocketTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* host, PRInt32 port,
|
||||
nsITransport* *result);
|
||||
NS_IMETHOD GetJarTransport(PLEventQueue* appEventQueue, nsISupports* eventSink,
|
||||
const char* jarFilePath, const char* jarEntryPath,
|
||||
nsITransport* *result);
|
||||
NS_IMETHOD HasActiveTransports();
|
||||
|
||||
// nsTransportService methods:
|
||||
nsTransportService();
|
||||
virtual ~nsTransportService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsTransportService_h___ */
|
21
netwerk/base/src/nsUrl.cpp
Normal file
21
netwerk/base/src/nsUrl.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/* -*- 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 "nsUrl.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
65
netwerk/base/src/nsUrl.h
Normal file
65
netwerk/base/src/nsUrl.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- 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 nsUrl_h__
|
||||
#define nsUrl_h__
|
||||
|
||||
#include "nsIUrl.h"
|
||||
|
||||
class nsUrl : public nsIUrl
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIUrl methods:
|
||||
|
||||
NS_IMETHOD GetScheme(const char* *result);
|
||||
NS_IMETHOD SetScheme(const char* scheme);
|
||||
|
||||
NS_IMETHOD GetPreHost(const char* *result);
|
||||
NS_IMETHOD SetPreHost(const char* preHost);
|
||||
|
||||
NS_IMETHOD GetHost(const char* *result);
|
||||
NS_IMETHOD SetHost(const char* host);
|
||||
|
||||
NS_IMETHOD GetPort(PRInt32 *result);
|
||||
NS_IMETHOD SetPort(PRInt32 port);
|
||||
|
||||
NS_IMETHOD GetPath(const char* *result);
|
||||
NS_IMETHOD SetPath(const char* path);
|
||||
|
||||
NS_IMETHOD Equals(const nsIUrl* other);
|
||||
|
||||
NS_IMETHOD ToNewCString(const char* *uriString);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsUrl methods:
|
||||
|
||||
nsUrl();
|
||||
virtual ~nsUrl();
|
||||
|
||||
nsresult Init(const char* aSpec,
|
||||
const nsIUrl* aBaseURL,
|
||||
nsISupports* aContainer);
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // nsUrl_h__
|
49
netwerk/build/makefile.win
Normal file
49
netwerk/build/makefile.win
Normal file
@ -0,0 +1,49 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=rdf
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=netwerk
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsNetFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\netwerkbase_s.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
MISCDEP=$(LLIBS)
|
||||
|
||||
# XXX Note dependencies on implementation dirs for factory methods.
|
||||
|
||||
LINCS= -I$(PUBLIC)\netwerk \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\raptor \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
178
netwerk/build/nsNetFactory.cpp
Normal file
178
netwerk/build/nsNetFactory.cpp
Normal file
@ -0,0 +1,178 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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 "nsIFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsNetService.h"
|
||||
#include "nsTransportService.h"
|
||||
#include "nscore.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
static NS_DEFINE_CID(kTransportServiceCID, NS_TRANSPORTSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsNetFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
nsNetFactory(const nsCID &aClass);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~nsNetFactory();
|
||||
|
||||
protected:
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsNetFactory::nsNetFactory(const nsCID &aClass)
|
||||
: mClassID(aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsNetFactory::~nsNetFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsNetFactory, nsIFactory::GetIID());
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (aResult == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kNetServiceCID)) {
|
||||
nsNetService* net = new nsNetService();
|
||||
if (net == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = net->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete net;
|
||||
return rv;
|
||||
}
|
||||
inst = net;
|
||||
}
|
||||
else if (mClassID.Equals(kTransportServiceCID)) {
|
||||
nsTransportService* trans = new nsTransportService();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = trans->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete trans;
|
||||
return rv;
|
||||
}
|
||||
inst = trans;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF(inst);
|
||||
*aResult = inst;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsNetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsNetFactory* factory = new nsNetFactory(aClass);
|
||||
if (factory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(factory);
|
||||
*aFactory = factory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kNetServiceCID,
|
||||
"Network Service",
|
||||
"component://netscape/network/net-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;;
|
||||
|
||||
rv = compMgr->RegisterComponent(kTransportServiceCID,
|
||||
"Transport Service",
|
||||
"component://netscape/network/transport-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kNetServiceCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kTransportServiceCID, aPath);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
28
netwerk/makefile.win
Normal file
28
netwerk/makefile.win
Normal file
@ -0,0 +1,28 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DIRS= \
|
||||
base \
|
||||
build \
|
||||
protocol \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
57
netwerk/protocol/http/public/nsIHttpListener.h
Normal file
57
netwerk/protocol/http/public/nsIHttpListener.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* -*- 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 nsIHttpListener_h___
|
||||
#define nsIHttpListener_h___
|
||||
|
||||
// XXX maybe we should inherit from this:
|
||||
#include "nsIStreamListener.h" // same error codes
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIUrl;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPLISTENER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x85, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIHttpListener : public nsIHttpObserver
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTTPLISTENER_IID);
|
||||
|
||||
/**
|
||||
* Notify the client that data is available in the input stream. This
|
||||
* method is called whenver data is written into the input stream by the
|
||||
* networking library...<BR><BR>
|
||||
*
|
||||
* @param pIStream The input stream containing the data. This stream can
|
||||
* be either a blocking or non-blocking stream.
|
||||
* @param length The amount of data that was just pushed into the stream.
|
||||
* @return The return value is currently ignored.
|
||||
*/
|
||||
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aIStream,
|
||||
PRUint32 aLength) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIIHttpListener_h___ */
|
85
netwerk/protocol/http/public/nsIHttpObserver.h
Normal file
85
netwerk/protocol/http/public/nsIHttpObserver.h
Normal file
@ -0,0 +1,85 @@
|
||||
/* -*- 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 nsIHttpObserver_h___
|
||||
#define nsIHttpObserver_h___
|
||||
|
||||
// XXX maybe we should inherit from this:
|
||||
#include "nsIStreamListener.h" // same error codes
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIUrl;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPOBSERVER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x85, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIHttpObserver : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTTPOBSERVER_IID);
|
||||
|
||||
/**
|
||||
* Notify the observer that the URL has started to load. This method is
|
||||
* called only once, at the beginning of a URL load.<BR><BR>
|
||||
*
|
||||
* @return The return value is currently ignored. In the future it may be
|
||||
* used to cancel the URL load..
|
||||
*/
|
||||
NS_IMETHOD OnStartBinding(nsIUrl* aURL, const char *aContentType) = 0;
|
||||
|
||||
/**
|
||||
* Return information regarding the current URL load.<BR>
|
||||
* The info structure that is passed in is filled out and returned
|
||||
* to the caller.
|
||||
*
|
||||
* This method is currently not called.
|
||||
*/
|
||||
NS_IMETHOD GetBindInfo(nsIURL* aURL, nsStreamBindingInfo* aInfo) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that progress as occurred for the URL load.<BR>
|
||||
*/
|
||||
NS_IMETHOD OnProgress(nsIUrl* aURL, PRUint32 aProgress, PRUint32 aProgressMax) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer with a status message for the URL load.<BR>
|
||||
*/
|
||||
NS_IMETHOD OnStatus(nsIUrl* aURL, const PRUnichar* aMsg) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that the URL has finished loading. This method is
|
||||
* called once when the networking library has finished processing the
|
||||
* URL transaction initiatied via the nsINetService::Open(...) call.<BR><BR>
|
||||
*
|
||||
* This method is called regardless of whether the URL loaded successfully.<BR><BR>
|
||||
*
|
||||
* @param status Status code for the URL load.
|
||||
* @param msg A text string describing the error.
|
||||
* @return The return value is currently ignored.
|
||||
*/
|
||||
NS_IMETHOD OnStopBinding(nsIUrl* aURL, nsresult aStatus, const PRUnichar* aMsg) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIIHttpObserver_h___ */
|
48
netwerk/protocol/http/public/nsIHttpProtocolConnection.h
Normal file
48
netwerk/protocol/http/public/nsIHttpProtocolConnection.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* -*- 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 nsIHttpProtocolConnection_h___
|
||||
#define nsIHttpProtocolConnection_h___
|
||||
|
||||
#include "nsIProtocolConnection.h"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPPROTOCOLCONNECTION_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x83, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIHttpProtocolConnection : public nsIProtocolConnection
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTTPPROTOCOLCONNECTION_IID);
|
||||
|
||||
NS_IMETHOD Get(void) = 0;
|
||||
|
||||
NS_IMETHOD GetByteRange(PRUint32 from, PRUint32 to) = 0;
|
||||
|
||||
NS_IMETHOD Put(void) = 0;
|
||||
|
||||
NS_IMETHOD Post(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIIHttpProtocolConnection_h___ */
|
40
netwerk/protocol/http/public/nsIHttpProtocolHandler.h
Normal file
40
netwerk/protocol/http/public/nsIHttpProtocolHandler.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* -*- 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 nsIHttpProtocolHandler_h___
|
||||
#define nsIHttpProtocolHandler_h___
|
||||
|
||||
#include "nsIProtocolHandler.h"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPPROTOCOLHANDLER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
0x11d2, \
|
||||
{0x86, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsIHttpProtocolHandler : public nsIProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTTPPROTOCOLHANDLER_IID);
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIIHttpProtocolHandler_h___ */
|
25
netwerk/protocol/makefile.win
Normal file
25
netwerk/protocol/makefile.win
Normal file
@ -0,0 +1,25 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..\..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
#DIRS= \
|
||||
# $(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
Loading…
Reference in New Issue
Block a user