2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-08-22 14:40:41 +00:00
|
|
|
|
2000-03-31 10:13:22 +00:00
|
|
|
#include "nsString.h"
|
1999-08-22 14:40:41 +00:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsISocketProvider.h"
|
2003-09-11 20:32:33 +00:00
|
|
|
#include "nsSocketProviderService.h"
|
|
|
|
#include "nsNetError.h"
|
1999-08-22 14:40:41 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
nsresult
|
1999-08-22 14:40:41 +00:00
|
|
|
nsSocketProviderService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
2003-09-11 20:32:33 +00:00
|
|
|
nsCOMPtr<nsISocketProviderService> inst = new nsSocketProviderService();
|
|
|
|
if (!inst)
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else
|
|
|
|
rv = inst->QueryInterface(aIID, aResult);
|
1999-08-22 14:40:41 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2003-09-07 23:12:15 +00:00
|
|
|
NS_IMPL_THREADSAFE_ISUPPORTS1(nsSocketProviderService, nsISocketProviderService)
|
1999-08-22 14:40:41 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2003-09-11 20:32:33 +00:00
|
|
|
nsSocketProviderService::GetSocketProvider(const char *type,
|
|
|
|
nsISocketProvider **result)
|
1999-08-22 14:40:41 +00:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2001-10-16 03:53:44 +00:00
|
|
|
nsCAutoString contractID(
|
2003-09-11 20:32:33 +00:00
|
|
|
NS_LITERAL_CSTRING(NS_NETWORK_SOCKET_CONTRACTID_PREFIX) +
|
|
|
|
nsDependentCString(type));
|
1999-08-22 14:40:41 +00:00
|
|
|
|
2003-09-11 20:32:33 +00:00
|
|
|
rv = CallGetService(contractID.get(), result);
|
1999-08-22 14:40:41 +00:00
|
|
|
if (NS_FAILED(rv))
|
2003-09-11 20:32:33 +00:00
|
|
|
rv = NS_ERROR_UNKNOWN_SOCKET_TYPE;
|
|
|
|
return rv;
|
1999-08-22 14:40:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|