Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsTLSSocketProvider.h"
8 #include "nsNSSIOLayer.h"
9 #include "nsError.h"
11 nsTLSSocketProvider::nsTLSSocketProvider()
12 {
13 }
15 nsTLSSocketProvider::~nsTLSSocketProvider()
16 {
17 }
19 NS_IMPL_ISUPPORTS(nsTLSSocketProvider, nsISocketProvider)
21 NS_IMETHODIMP
22 nsTLSSocketProvider::NewSocket(int32_t family,
23 const char *host,
24 int32_t port,
25 nsIProxyInfo *proxy,
26 uint32_t flags,
27 PRFileDesc **_result,
28 nsISupports **securityInfo)
29 {
30 nsresult rv = nsSSLIOLayerNewSocket(family,
31 host,
32 port,
33 proxy,
34 _result,
35 securityInfo,
36 true,
37 flags);
39 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
40 }
42 // Add the SSL IO layer to an existing socket
43 NS_IMETHODIMP
44 nsTLSSocketProvider::AddToSocket(int32_t family,
45 const char *host,
46 int32_t port,
47 nsIProxyInfo *proxy,
48 uint32_t flags,
49 PRFileDesc *aSocket,
50 nsISupports **securityInfo)
51 {
52 nsresult rv = nsSSLIOLayerAddToSocket(family,
53 host,
54 port,
55 proxy,
56 aSocket,
57 securityInfo,
58 true,
59 flags);
61 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
62 }