1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsUDPSocketProvider.h"
9 using mozilla::OriginAttributes
;
11 NS_IMPL_ISUPPORTS(nsUDPSocketProvider
, nsISocketProvider
)
14 nsUDPSocketProvider::NewSocket(int32_t aFamily
, const char* aHost
,
15 int32_t aPort
, nsIProxyInfo
* aProxy
,
16 const OriginAttributes
& originAttributes
,
17 uint32_t aFlags
, uint32_t aTlsFlags
,
18 PRFileDesc
** aFileDesc
,
19 nsITLSSocketControl
** aTLSSocketControl
) {
20 NS_ENSURE_ARG_POINTER(aFileDesc
);
22 PRFileDesc
* udpFD
= PR_OpenUDPSocket(aFamily
);
23 if (!udpFD
) return NS_ERROR_FAILURE
;
30 nsUDPSocketProvider::AddToSocket(int32_t aFamily
, const char* aHost
,
31 int32_t aPort
, nsIProxyInfo
* aProxy
,
32 const OriginAttributes
& originAttributes
,
33 uint32_t aFlags
, uint32_t aTlsFlags
,
34 struct PRFileDesc
* aFileDesc
,
35 nsITLSSocketControl
** aTLSSocketControl
) {
36 // does not make sense to strap a UDP socket onto an existing socket
37 MOZ_ASSERT_UNREACHABLE("Cannot layer UDP socket on an existing socket");
38 return NS_ERROR_UNEXPECTED
;