LCOV - code coverage report
Current view: top level - netwerk/socket - nsSOCKSSocketProvider.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       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/. */
       6             : 
       7             : #include "nsIServiceManager.h"
       8             : #include "nsNamedPipeIOLayer.h"
       9             : #include "nsSOCKSSocketProvider.h"
      10             : #include "nsSOCKSIOLayer.h"
      11             : #include "nsCOMPtr.h"
      12             : #include "nsError.h"
      13             : 
      14             : using mozilla::OriginAttributes;
      15             : 
      16             : //////////////////////////////////////////////////////////////////////////
      17             : 
      18           0 : NS_IMPL_ISUPPORTS(nsSOCKSSocketProvider, nsISocketProvider)
      19             : 
      20             : nsresult
      21           0 : nsSOCKSSocketProvider::CreateV4(nsISupports *aOuter, REFNSIID aIID, void **aResult)
      22             : {
      23             :     nsresult rv;
      24             :     nsCOMPtr<nsISocketProvider> inst =
      25           0 :             new nsSOCKSSocketProvider(NS_SOCKS_VERSION_4);
      26           0 :     if (!inst)
      27           0 :         rv = NS_ERROR_OUT_OF_MEMORY;
      28             :     else
      29           0 :         rv = inst->QueryInterface(aIID, aResult);
      30           0 :     return rv;
      31             : }
      32             : 
      33             : nsresult
      34           0 : nsSOCKSSocketProvider::CreateV5(nsISupports *aOuter, REFNSIID aIID, void **aResult)
      35             : {
      36             :     nsresult rv;
      37             :     nsCOMPtr<nsISocketProvider> inst =
      38           0 :             new nsSOCKSSocketProvider(NS_SOCKS_VERSION_5);
      39           0 :     if (!inst)
      40           0 :         rv = NS_ERROR_OUT_OF_MEMORY;
      41             :     else
      42           0 :         rv = inst->QueryInterface(aIID, aResult);
      43           0 :     return rv;
      44             : }
      45             : 
      46             : NS_IMETHODIMP
      47           0 : nsSOCKSSocketProvider::NewSocket(int32_t family,
      48             :                                  const char *host,
      49             :                                  int32_t port,
      50             :                                  nsIProxyInfo *proxy,
      51             :                                  const OriginAttributes &originAttributes,
      52             :                                  uint32_t flags,
      53             :                                  PRFileDesc **result,
      54             :                                  nsISupports **socksInfo)
      55             : {
      56             :     PRFileDesc *sock;
      57             : 
      58             : #if defined(XP_WIN)
      59             :     nsAutoCString proxyHost;
      60             :     proxy->GetHost(proxyHost);
      61             :     if (IsNamedPipePath(proxyHost)) {
      62             :         sock = CreateNamedPipeLayer();
      63             :     } else
      64             : #endif
      65             :     {
      66           0 :         sock = PR_OpenTCPSocket(family);
      67           0 :         if (!sock) {
      68           0 :             return NS_ERROR_OUT_OF_MEMORY;
      69             :         }
      70             :     }
      71             : 
      72           0 :     nsresult rv = nsSOCKSIOLayerAddToSocket(family,
      73             :                                             host,
      74             :                                             port,
      75             :                                             proxy,
      76           0 :                                             mVersion,
      77             :                                             flags,
      78             :                                             sock,
      79           0 :                                             socksInfo);
      80           0 :     if (NS_SUCCEEDED(rv)) {
      81           0 :         *result = sock;
      82           0 :         return NS_OK;
      83             :     }
      84             : 
      85           0 :     return NS_ERROR_SOCKET_CREATE_FAILED;
      86             : }
      87             : 
      88             : NS_IMETHODIMP
      89           0 : nsSOCKSSocketProvider::AddToSocket(int32_t family,
      90             :                                    const char *host,
      91             :                                    int32_t port,
      92             :                                    nsIProxyInfo *proxy,
      93             :                                    const OriginAttributes &originAttributes,
      94             :                                    uint32_t flags,
      95             :                                    PRFileDesc *sock,
      96             :                                    nsISupports **socksInfo)
      97             : {
      98           0 :     nsresult rv = nsSOCKSIOLayerAddToSocket(family,
      99             :                                             host,
     100             :                                             port,
     101             :                                             proxy,
     102           0 :                                             mVersion,
     103             :                                             flags,
     104             :                                             sock,
     105           0 :                                             socksInfo);
     106             : 
     107           0 :     if (NS_FAILED(rv))
     108           0 :         rv = NS_ERROR_SOCKET_CREATE_FAILED;
     109           0 :     return rv;
     110             : }

Generated by: LCOV version 1.13