From f92f31446c4c027ec34c453b2bf9fe820f09e205 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Thu, 28 Jan 1999 01:57:30 +0000 Subject: [PATCH] Add socket transport support to the nsINetService interface. git-svn-id: svn://10.0.0.236/trunk@18883 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/network/module/nsNetService.cpp | 15 +++++++++++++++ mozilla/network/module/nsNetService.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/mozilla/network/module/nsNetService.cpp b/mozilla/network/module/nsNetService.cpp index 857731cfd51..e7813f16e64 100644 --- a/mozilla/network/module/nsNetService.cpp +++ b/mozilla/network/module/nsNetService.cpp @@ -48,6 +48,7 @@ extern "C" { #include "nsIEventQueueService.h" #include "nsXPComCIID.h" #include "nsCRT.h" +#include "nsSocketTransport.h" #ifdef XP_PC #include @@ -1034,7 +1035,21 @@ nsNetlibService::CreateURL(nsIURL* *aURL, return protocolURLFactory->CreateURL(aURL, aSpec, aContextURL, aContainer, aGroup); } +NS_IMETHODIMP nsNetlibService::CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName) +{ + nsSocketTransport *pNSSocketTransport = NULL; + NS_DEFINE_IID(kITransportIID, NS_ITRANSPORT_IID); + + pNSSocketTransport = new nsSocketTransport(aPortToUse, aHostName); + if (pNSSocketTransport->QueryInterface(kITransportIID, (void**)aTransport) != NS_OK) { + // then we're trying get a interface other than nsISupports and + // nsITransport + return NS_ERROR_FAILURE; + } + + return NS_OK; +} NS_IMETHODIMP diff --git a/mozilla/network/module/nsNetService.h b/mozilla/network/module/nsNetService.h index 568268b39a7..b877f0af396 100644 --- a/mozilla/network/module/nsNetService.h +++ b/mozilla/network/module/nsNetService.h @@ -22,6 +22,7 @@ #include "nspr.h" #include "nsIPref.h" +#include "nsITransport.h" #include "nsIEventQueueService.h" #include "nsINetService.h" #include "nsNetThread.h" @@ -97,6 +98,8 @@ public: nsIURLGroup* aGroup = nsnull); NS_IMETHOD AreThereActiveConnections(void); + NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName); + protected: virtual ~nsNetlibService();