1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsTLSSocketProvider.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsTLSSocketProvider.h" 1.11 +#include "nsNSSIOLayer.h" 1.12 +#include "nsError.h" 1.13 + 1.14 +nsTLSSocketProvider::nsTLSSocketProvider() 1.15 +{ 1.16 +} 1.17 + 1.18 +nsTLSSocketProvider::~nsTLSSocketProvider() 1.19 +{ 1.20 +} 1.21 + 1.22 +NS_IMPL_ISUPPORTS(nsTLSSocketProvider, nsISocketProvider) 1.23 + 1.24 +NS_IMETHODIMP 1.25 +nsTLSSocketProvider::NewSocket(int32_t family, 1.26 + const char *host, 1.27 + int32_t port, 1.28 + nsIProxyInfo *proxy, 1.29 + uint32_t flags, 1.30 + PRFileDesc **_result, 1.31 + nsISupports **securityInfo) 1.32 +{ 1.33 + nsresult rv = nsSSLIOLayerNewSocket(family, 1.34 + host, 1.35 + port, 1.36 + proxy, 1.37 + _result, 1.38 + securityInfo, 1.39 + true, 1.40 + flags); 1.41 + 1.42 + return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK; 1.43 +} 1.44 + 1.45 +// Add the SSL IO layer to an existing socket 1.46 +NS_IMETHODIMP 1.47 +nsTLSSocketProvider::AddToSocket(int32_t family, 1.48 + const char *host, 1.49 + int32_t port, 1.50 + nsIProxyInfo *proxy, 1.51 + uint32_t flags, 1.52 + PRFileDesc *aSocket, 1.53 + nsISupports **securityInfo) 1.54 +{ 1.55 + nsresult rv = nsSSLIOLayerAddToSocket(family, 1.56 + host, 1.57 + port, 1.58 + proxy, 1.59 + aSocket, 1.60 + securityInfo, 1.61 + true, 1.62 + flags); 1.63 + 1.64 + return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK; 1.65 +}