/src/mozilla-central/netwerk/socket/nsUDPSocketProvider.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
4 | | |
5 | | #include "nsUDPSocketProvider.h" |
6 | | |
7 | | #include "nspr.h" |
8 | | |
9 | | using mozilla::OriginAttributes; |
10 | | |
11 | | NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider) |
12 | | |
13 | | NS_IMETHODIMP |
14 | | nsUDPSocketProvider::NewSocket(int32_t aFamily, |
15 | | const char *aHost, |
16 | | int32_t aPort, |
17 | | nsIProxyInfo *aProxy, |
18 | | const OriginAttributes &originAttributes, |
19 | | uint32_t aFlags, |
20 | | uint32_t aTlsFlags, |
21 | | PRFileDesc * *aFileDesc, |
22 | | nsISupports **aSecurityInfo) |
23 | 0 | { |
24 | 0 | NS_ENSURE_ARG_POINTER(aFileDesc); |
25 | 0 |
|
26 | 0 | PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily); |
27 | 0 | if (!udpFD) |
28 | 0 | return NS_ERROR_FAILURE; |
29 | 0 | |
30 | 0 | *aFileDesc = udpFD; |
31 | 0 | return NS_OK; |
32 | 0 | } |
33 | | |
34 | | NS_IMETHODIMP |
35 | | nsUDPSocketProvider::AddToSocket(int32_t aFamily, |
36 | | const char *aHost, |
37 | | int32_t aPort, |
38 | | nsIProxyInfo *aProxy, |
39 | | const OriginAttributes &originAttributes, |
40 | | uint32_t aFlags, |
41 | | uint32_t aTlsFlags, |
42 | | struct PRFileDesc * aFileDesc, |
43 | | nsISupports **aSecurityInfo) |
44 | 0 | { |
45 | 0 | // does not make sense to strap a UDP socket onto an existing socket |
46 | 0 | MOZ_ASSERT_UNREACHABLE("Cannot layer UDP socket on an existing socket"); |
47 | 0 | return NS_ERROR_UNEXPECTED; |
48 | 0 | } |