2001-01-10 01:32:29 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-31 09:33:35 +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/. */
|
2001-01-10 01:32:29 +00:00
|
|
|
|
|
|
|
#include "nsSSLSocketProvider.h"
|
|
|
|
#include "nsNSSIOLayer.h"
|
2012-07-27 14:03:27 +00:00
|
|
|
#include "nsError.h"
|
2001-01-10 01:32:29 +00:00
|
|
|
|
|
|
|
nsSSLSocketProvider::nsSSLSocketProvider()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSSLSocketProvider::~nsSSLSocketProvider()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_IMPL_ISUPPORTS(nsSSLSocketProvider, nsISocketProvider)
|
2001-01-10 01:32:29 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 15:56:38 +00:00
|
|
|
nsSSLSocketProvider::NewSocket(int32_t family,
|
2003-09-11 20:32:33 +00:00
|
|
|
const char *host,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t port,
|
2015-11-24 21:56:00 +00:00
|
|
|
nsIProxyInfo *proxy,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t flags,
|
2001-01-10 01:32:29 +00:00
|
|
|
PRFileDesc **_result,
|
|
|
|
nsISupports **securityInfo)
|
|
|
|
{
|
2003-09-11 20:32:33 +00:00
|
|
|
nsresult rv = nsSSLIOLayerNewSocket(family,
|
|
|
|
host,
|
2001-01-10 01:32:29 +00:00
|
|
|
port,
|
2015-11-24 21:56:00 +00:00
|
|
|
proxy,
|
2001-01-10 01:32:29 +00:00
|
|
|
_result,
|
|
|
|
securityInfo,
|
2011-10-17 14:59:28 +00:00
|
|
|
false,
|
2012-06-30 14:34:17 +00:00
|
|
|
flags);
|
2001-01-10 01:32:29 +00:00
|
|
|
return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the SSL IO layer to an existing socket
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 15:56:38 +00:00
|
|
|
nsSSLSocketProvider::AddToSocket(int32_t family,
|
2003-09-11 20:32:33 +00:00
|
|
|
const char *host,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t port,
|
2015-11-24 21:56:00 +00:00
|
|
|
nsIProxyInfo *proxy,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t flags,
|
2001-01-10 01:32:29 +00:00
|
|
|
PRFileDesc *aSocket,
|
|
|
|
nsISupports **securityInfo)
|
|
|
|
{
|
2003-09-11 20:32:33 +00:00
|
|
|
nsresult rv = nsSSLIOLayerAddToSocket(family,
|
|
|
|
host,
|
2001-01-10 01:32:29 +00:00
|
|
|
port,
|
2015-11-24 21:56:00 +00:00
|
|
|
proxy,
|
2001-01-10 01:32:29 +00:00
|
|
|
aSocket,
|
|
|
|
securityInfo,
|
2011-10-17 14:59:28 +00:00
|
|
|
false,
|
2012-06-30 14:34:17 +00:00
|
|
|
flags);
|
2001-01-10 01:32:29 +00:00
|
|
|
|
|
|
|
return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
|
|
|
|
}
|