Started hooking up socket transport synchronous streams. Added unix makefiles.

git-svn-id: svn://10.0.0.236/trunk@29125 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
1999-04-25 19:25:24 +00:00
parent 6c10b9393a
commit 70f38c9b80
16 changed files with 593 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
#! 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 = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = netwerk
include $(DEPTH)/config/autoconf.mk
DIRS= \
base \
build \
protocol \
test \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,34 @@
#! 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 = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = netwerk
include $(DEPTH)/config/autoconf.mk
DIRS= \
public \
src \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,45 @@
#!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 = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
EXPORTS = \
nsICancelable.h \
nsIConnectionGroup.h \
nsIFileTransportService.h \
nsISocketTransportService.h \
nsINetService.h \
nsIProtocolConnection.h \
nsIProtocolHandler.h \
nsISocketTransportService.h \
nsIStreamListener.h \
nsIStreamObserver.h \
nsITransport.h \
nsIUrl.h \
netCore.h \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,56 @@
# 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 = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
LIBRARY_NAME = netwerkbase_s
include $(DEPTH)/config/autoconf.mk
CPPSRCS = \
nsConnectionGroup.cpp \
nsMarshalingStreamListener.cpp \
nsSyncStreamListener.cpp \
nsFileTransport.cpp \
nsFileTransportService.cpp \
nsSocketTransport.cpp \
nsSocketTransportService.cpp \
nsNetService.cpp \
nsUrl.cpp \
$(NULL)
EXPORTS = \
nsConnectionGroup.h \
nsNetService.h \
nsFileTransportService.h \
nsSocketTransportService.h \
nsUrl.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
MODULE = netwerk
include $(topsrcdir)/config/config.mk
TARGET = $(LIBARY)
include $(DEPTH)/config/rules.mk

View File

@@ -41,7 +41,7 @@ nsFileTransport::nsFileTransport()
nsFileTransport::~nsFileTransport()
{
if (mPath) delete[] mPath;
if (mPath) nsCRT::free(mPath);
NS_IF_RELEASE(mListener);
NS_IF_RELEASE(mContext);
NS_IF_RELEASE(mService);

View File

@@ -179,6 +179,7 @@ NS_IMPL_ISUPPORTS_INHERITED(nsMarshalingStreamListener,
// OnStartBinding...
//
////////////////////////////////////////////////////////////////////////////////
class nsOnStartBindingEvent : public nsStreamListenerEvent
{
public:

View File

@@ -79,7 +79,7 @@ nsSocketState gStateTable[eSocketOperation_Max][eSocketState_Max] = {
eSocketState_Done, // WaitWrite -> Done
eSocketState_Connected, // Done -> Connected
eSocketState_Error, // Timeout -> Error
eSocketState_Connected // Error -> Connected
eSocketState_Connected // Error -> Connected
}
};
@@ -102,8 +102,6 @@ static PRIntervalTime gConnectTimeout = -1;
static char gIOBuffer[MAX_IO_BUFFER_SIZE];
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@@ -153,7 +151,7 @@ nsSocketTransport::~nsSocketTransport()
NS_IF_RELEASE(mService);
if (mHostName) {
PR_Free(mHostName);
nsCRT::free(mHostName);
}
if (mSocketFD) {
@@ -174,11 +172,6 @@ nsresult nsSocketTransport::Init(nsSocketTransportService* aService,
mPort = aPort;
if (aHost) {
// Copy the host name...
//
// XXX: This is so evil! Since this is a char* it must be freed with
// PR_Free(...) NOT delete[] like PRUnichar* buffers...
//
mHostName = nsCRT::strdup(aHost);
if (!mHostName) {
rv = NS_ERROR_OUT_OF_MEMORY;
@@ -733,13 +726,65 @@ nsSocketTransport::AsyncWrite(nsIInputStream* aFromStream,
NS_IMETHODIMP
nsSocketTransport::OpenInputStream(nsIInputStream* *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
nsresult rv = NS_OK;
if (eSocketOperation_None != mOperation) {
// XXX: This should be NS_ERROR_IN_PROGRESS...
rv = NS_ERROR_FAILURE;
}
if (NS_SUCCEEDED(rv) && !mReadStream) {
rv = NS_NewByteBufferInputStream(&mReadStream, PR_FALSE,
MAX_IO_BUFFER_SIZE);
}
if (NS_SUCCEEDED(rv)) {
NS_IF_RELEASE(mContext);
mContext = nsnull;
NS_IF_RELEASE(mListener);
rv = NS_NewSyncStreamListener(&mListener, result);
}
if (NS_SUCCEEDED(rv)) {
mOperation = eSocketOperation_Read;
mService->AddToWorkQ(this);
}
return rv;
}
NS_IMETHODIMP
nsSocketTransport::OpenOutputStream(nsIOutputStream* *result)
{
#if 0
nsresult rv = NS_OK;
if (eSocketOperation_None != mOperation) {
// XXX: This should be NS_ERROR_IN_PROGRESS...
rv = NS_ERROR_FAILURE;
}
if (NS_SUCCEEDED(rv)) {
NS_IF_RELEASE(mWriteStream);
mWriteStream = nsnull;
NS_IF_RELEASE(mContext);
mContext = nsnull;
NS_IF_RELEASE(mListener);
rv = NS_NewSyncStreamObserver(&mListener, result);
}
if (NS_SUCCEEDED(rv)) {
mOperation = eSocketOperation_Write;
mService->AddToWorkQ(this);
}
return rv;
#endif
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -0,0 +1,62 @@
# 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 = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
LIBRARY_NAME = netwerk
MODULE = netwerk
CPPSRCS = \
nsNetFactory.cpp \
$(NULL)
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libnetwerkbase_s.a \
$(NULL)
include $(topsrcdir)/config/config.mk
ifeq ($(OS_ARCH),HP-UX)
EXTRA_DSO_LDOPTS = -c objs/objslist
else
EXTRA_DSO_LDOPTS = \
$(MKSHLIB_FORCE_ALL) \
$(SHARED_LIBRARY_LIBS) \
$(MKSHLIB_UNFORCE_ALL) \
$(NULL)
endif
include $(DEPTH)/config/rules.mk
ifeq ($(OS_ARCH),HP-UX)
shared_library_objs: $(SHARED_LIBRARY_LIBS)
rm -rf objs
mkdir objs
(cd objs; for lib in $(SHARED_LIBRARY_LIBS); do ar xv ../$$lib; done) \
| awk '{ print "objs/"$$3 }' > objs/objslist
$(LIBRARY) $(SHARED_LIBRARY): shared_library_objs Makefile
else
$(LIBRARY) $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) Makefile
endif

View File

@@ -0,0 +1,34 @@
#! 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 = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = netwerk
include $(DEPTH)/config/autoconf.mk
DIRS= \
ftp \
http \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,34 @@
#! 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 = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = netwerk
include $(DEPTH)/config/autoconf.mk
DIRS= \
public \
src \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,34 @@
#!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 = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
EXPORTS = \
nsIFtpEventSink.h \
nsIFtpProtocolConnection.h \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,40 @@
# 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 = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
LIBRARY_NAME = ftp
include $(DEPTH)/config/autoconf.mk
CPPSRCS = \
nsFtpProtocolHandler.cpp \
nsFtpProtocolConnection.cpp \
nsFtpStreamListenerEvent.cpp \
nsFtpConnectionThread.cpp \
nsFtpFactory.cpp \
$(NULL)
MODULE = netwerk
include $(topsrcdir)/config/config.mk
TARGET = $(LIBARY)
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,34 @@
#! 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 = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = netwerk
include $(DEPTH)/config/autoconf.mk
DIRS= \
public \
src \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,34 @@
#!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 = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
EXPORTS = \
nsIHttpEventSink.h \
nsIHttpProtocolConnection.h \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,40 @@
# 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 = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
LIBRARY_NAME = http
include $(DEPTH)/config/autoconf.mk
CPPSRCS = \
nsHttpProtocolHandler.cpp \
nsHttpProtocolConnection.cpp \
nsHttpFactory.cpp \
$(NULL)
REQUIRES = xpcom netwerk raptor
MODULE = netwerk
include $(topsrcdir)/config/config.mk
TARGET = $(LIBARY)
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,53 @@
#
# 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 = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
IGNORE_MANIFEST=1
include $(DEPTH)/config/autoconf.mk
CPPSRCS = \
TestSocketIO.cpp \
TestSocketInput.cpp \
TestFileInput.cpp \
$(NULL)
BASE_LIBS = \
-lreg \
-lxpcom \
-lraptorbase \
-lnetwerk \
$(NULL)
LIBS = \
$(BASE_LIBS) \
$(NSPR_LIBS) \
$(NULL)
DEFINES += -DUSE_NSREG
INCLUDES += -I$(srcdir)/../public
REQUIRES=libreg xpcom
include $(topsrcdir)/config/config.mk
SIMPLE_PROGRAMS = $(addprefix $(OBJDIR)/, $(CPPSRCS:.cpp=))
include $(topsrcdir)/config/rules.mk