netwerk/socket/nsUDPSocketProvider.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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"
     7 #include "nspr.h"
     9 NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider)
    11 nsUDPSocketProvider::~nsUDPSocketProvider()
    12 {
    13 }
    15 NS_IMETHODIMP 
    16 nsUDPSocketProvider::NewSocket(int32_t aFamily,
    17                                const char *aHost, 
    18                                int32_t aPort, 
    19                                nsIProxyInfo *aProxy,
    20                                uint32_t aFlags,
    21                                PRFileDesc * *aFileDesc, 
    22                                nsISupports **aSecurityInfo)
    23 {
    24     NS_ENSURE_ARG_POINTER(aFileDesc);
    26     PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily);
    27     if (!udpFD)
    28         return NS_ERROR_FAILURE;
    30     *aFileDesc = udpFD;
    31     return NS_OK;
    32 }
    34 NS_IMETHODIMP 
    35 nsUDPSocketProvider::AddToSocket(int32_t aFamily,
    36                                  const char *aHost,
    37                                  int32_t aPort,
    38                                  nsIProxyInfo *aProxy,
    39                                  uint32_t aFlags,
    40                                  struct PRFileDesc * aFileDesc,
    41                                  nsISupports **aSecurityInfo)
    42 {
    43     // does not make sense to strap a UDP socket onto an existing socket
    44     NS_NOTREACHED("Cannot layer UDP socket on an existing socket");
    45     return NS_ERROR_UNEXPECTED;
    46 }

mercurial