Line data Source code
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/. */
6 :
7 : #include "mozilla/BasePrincipal.h"
8 : #include "nsTLSSocketProvider.h"
9 : #include "nsNSSIOLayer.h"
10 : #include "nsError.h"
11 :
12 : using mozilla::OriginAttributes;
13 :
14 0 : nsTLSSocketProvider::nsTLSSocketProvider()
15 : {
16 0 : }
17 :
18 0 : nsTLSSocketProvider::~nsTLSSocketProvider()
19 : {
20 0 : }
21 :
22 0 : NS_IMPL_ISUPPORTS(nsTLSSocketProvider, nsISocketProvider)
23 :
24 : NS_IMETHODIMP
25 0 : nsTLSSocketProvider::NewSocket(int32_t family,
26 : const char *host,
27 : int32_t port,
28 : nsIProxyInfo *proxy,
29 : const OriginAttributes &originAttributes,
30 : uint32_t flags,
31 : PRFileDesc **_result,
32 : nsISupports **securityInfo)
33 : {
34 : nsresult rv = nsSSLIOLayerNewSocket(family,
35 : host,
36 : port,
37 : proxy,
38 : originAttributes,
39 : _result,
40 : securityInfo,
41 : true,
42 0 : flags);
43 :
44 0 : return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
45 : }
46 :
47 : // Add the SSL IO layer to an existing socket
48 : NS_IMETHODIMP
49 0 : nsTLSSocketProvider::AddToSocket(int32_t family,
50 : const char *host,
51 : int32_t port,
52 : nsIProxyInfo *proxy,
53 : const OriginAttributes &originAttributes,
54 : uint32_t flags,
55 : PRFileDesc *aSocket,
56 : nsISupports **securityInfo)
57 : {
58 : nsresult rv = nsSSLIOLayerAddToSocket(family,
59 : host,
60 : port,
61 : proxy,
62 : originAttributes,
63 : aSocket,
64 : securityInfo,
65 : true,
66 0 : flags);
67 :
68 0 : return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
69 : }
|