Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / security / manager / ssl / nsTLSSocketProvider.cpp
blobbc26d47966947e96cfd55633e288c2ce43aaf2d6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 "mozilla/BasePrincipal.h"
8 #include "nsTLSSocketProvider.h"
9 #include "nsNSSIOLayer.h"
10 #include "nsError.h"
12 using mozilla::OriginAttributes;
14 nsTLSSocketProvider::nsTLSSocketProvider() = default;
16 nsTLSSocketProvider::~nsTLSSocketProvider() = default;
18 NS_IMPL_ISUPPORTS(nsTLSSocketProvider, nsISocketProvider)
20 NS_IMETHODIMP
21 nsTLSSocketProvider::NewSocket(int32_t family, const char* host, int32_t port,
22 nsIProxyInfo* proxy,
23 const OriginAttributes& originAttributes,
24 uint32_t flags, uint32_t tlsFlags,
25 PRFileDesc** _result,
26 nsITLSSocketControl** tlsSocketControl) {
27 nsresult rv =
28 nsSSLIOLayerNewSocket(family, host, port, proxy, originAttributes,
29 _result, tlsSocketControl, true, flags, tlsFlags);
31 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
34 // Add the SSL IO layer to an existing socket
35 NS_IMETHODIMP
36 nsTLSSocketProvider::AddToSocket(int32_t family, const char* host, int32_t port,
37 nsIProxyInfo* proxy,
38 const OriginAttributes& originAttributes,
39 uint32_t flags, uint32_t tlsFlags,
40 PRFileDesc* aSocket,
41 nsITLSSocketControl** tlsSocketControl) {
42 nsresult rv =
43 nsSSLIOLayerAddToSocket(family, host, port, proxy, originAttributes,
44 aSocket, tlsSocketControl, true, flags, tlsFlags);
46 return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;