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