Add the ability to open a file based socket. (Part of the nsITransport) code....

This commit is contained in:
mscott%netscape.com 1999-02-11 02:59:53 +00:00
Родитель 34b1e85458
Коммит 435e274507
3 изменённых файлов: 28 добавлений и 0 удалений

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

@ -251,6 +251,14 @@ struct nsINetService : public nsISupports
*/
NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName) = 0;
/**
* Protocol connection pools should use this call into the service manager to produce
* a transport interface to a file based socket. You need to pass in the name of the file
* you want to associate with the socket transport
*/
NS_IMETHOD CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName) = 0;
NS_IMETHOD AreThereActiveConnections(void) = 0;
};

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

@ -1056,6 +1056,24 @@ NS_IMETHODIMP nsNetlibService::CreateSocketTransport(nsITransport **aTransport,
return NS_OK;
}
NS_IMETHODIMP nsNetlibService::CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName)
{
NS_PRECONDITION(aFileName, "You need to specify the file name of the file you wish to create a socket for");
nsSocketTransport *pNSSocketTransport = NULL;
NS_DEFINE_IID(kITransportIID, NS_ITRANSPORT_IID);
pNSSocketTransport = new nsSocketTransport(aFileName);
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
nsNetlibService::AreThereActiveConnections()

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

@ -100,6 +100,8 @@ public:
NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName);
NS_IMETHOD CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName);
protected:
virtual ~nsNetlibService();