Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsUDPSocketProvider.h" |
michael@0 | 6 | |
michael@0 | 7 | #include "nspr.h" |
michael@0 | 8 | |
michael@0 | 9 | NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider) |
michael@0 | 10 | |
michael@0 | 11 | nsUDPSocketProvider::~nsUDPSocketProvider() |
michael@0 | 12 | { |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | NS_IMETHODIMP |
michael@0 | 16 | nsUDPSocketProvider::NewSocket(int32_t aFamily, |
michael@0 | 17 | const char *aHost, |
michael@0 | 18 | int32_t aPort, |
michael@0 | 19 | nsIProxyInfo *aProxy, |
michael@0 | 20 | uint32_t aFlags, |
michael@0 | 21 | PRFileDesc * *aFileDesc, |
michael@0 | 22 | nsISupports **aSecurityInfo) |
michael@0 | 23 | { |
michael@0 | 24 | NS_ENSURE_ARG_POINTER(aFileDesc); |
michael@0 | 25 | |
michael@0 | 26 | PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily); |
michael@0 | 27 | if (!udpFD) |
michael@0 | 28 | return NS_ERROR_FAILURE; |
michael@0 | 29 | |
michael@0 | 30 | *aFileDesc = udpFD; |
michael@0 | 31 | return NS_OK; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | NS_IMETHODIMP |
michael@0 | 35 | nsUDPSocketProvider::AddToSocket(int32_t aFamily, |
michael@0 | 36 | const char *aHost, |
michael@0 | 37 | int32_t aPort, |
michael@0 | 38 | nsIProxyInfo *aProxy, |
michael@0 | 39 | uint32_t aFlags, |
michael@0 | 40 | struct PRFileDesc * aFileDesc, |
michael@0 | 41 | nsISupports **aSecurityInfo) |
michael@0 | 42 | { |
michael@0 | 43 | // does not make sense to strap a UDP socket onto an existing socket |
michael@0 | 44 | NS_NOTREACHED("Cannot layer UDP socket on an existing socket"); |
michael@0 | 45 | return NS_ERROR_UNEXPECTED; |
michael@0 | 46 | } |