|
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 "nsTLSSocketProvider.h" |
|
8 #include "nsNSSIOLayer.h" |
|
9 #include "nsError.h" |
|
10 |
|
11 nsTLSSocketProvider::nsTLSSocketProvider() |
|
12 { |
|
13 } |
|
14 |
|
15 nsTLSSocketProvider::~nsTLSSocketProvider() |
|
16 { |
|
17 } |
|
18 |
|
19 NS_IMPL_ISUPPORTS(nsTLSSocketProvider, nsISocketProvider) |
|
20 |
|
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); |
|
38 |
|
39 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK; |
|
40 } |
|
41 |
|
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); |
|
60 |
|
61 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK; |
|
62 } |