|
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 "nsSSLSocketProvider.h" |
|
8 #include "nsNSSIOLayer.h" |
|
9 #include "nsError.h" |
|
10 |
|
11 nsSSLSocketProvider::nsSSLSocketProvider() |
|
12 { |
|
13 } |
|
14 |
|
15 nsSSLSocketProvider::~nsSSLSocketProvider() |
|
16 { |
|
17 } |
|
18 |
|
19 NS_IMPL_ISUPPORTS(nsSSLSocketProvider, nsISocketProvider) |
|
20 |
|
21 NS_IMETHODIMP |
|
22 nsSSLSocketProvider::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 false, |
|
37 flags); |
|
38 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK; |
|
39 } |
|
40 |
|
41 // Add the SSL IO layer to an existing socket |
|
42 NS_IMETHODIMP |
|
43 nsSSLSocketProvider::AddToSocket(int32_t family, |
|
44 const char *host, |
|
45 int32_t port, |
|
46 nsIProxyInfo *proxy, |
|
47 uint32_t flags, |
|
48 PRFileDesc *aSocket, |
|
49 nsISupports **securityInfo) |
|
50 { |
|
51 nsresult rv = nsSSLIOLayerAddToSocket(family, |
|
52 host, |
|
53 port, |
|
54 proxy, |
|
55 aSocket, |
|
56 securityInfo, |
|
57 false, |
|
58 flags); |
|
59 |
|
60 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK; |
|
61 } |