LCOV - code coverage report
Current view: top level - include/ucbhelper - proxydecider.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.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 file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_UCBHELPER_PROXYDECIDER_HXX
      21             : #define INCLUDED_UCBHELPER_PROXYDECIDER_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <com/sun/star/uno/Reference.hxx>
      25             : #include <com/sun/star/uno/XComponentContext.hpp>
      26             : #include <ucbhelper/ucbhelperdllapi.h>
      27             : 
      28             : namespace com { namespace sun { namespace star { namespace lang {
      29             :     class XMultiServiceFactory;
      30             : } } } }
      31             : 
      32             : namespace ucbhelper
      33             : {
      34             : 
      35             : /**
      36             :  * This struct describes a proxy server.
      37             :  */
      38           8 : struct InternetProxyServer
      39             : {
      40             :     /**
      41             :       * The name of the proxy server.
      42             :       */
      43             :     OUString aName;
      44             : 
      45             :     /**
      46             :       * The port of the proxy server.
      47             :       */
      48             :     sal_Int32 nPort;
      49             : 
      50             :     /**
      51             :       * Constructor.
      52             :       */
      53           8 :     InternetProxyServer() : nPort( -1 ) {}
      54             : };
      55             : 
      56             : namespace proxydecider_impl { class InternetProxyDecider_Impl; }
      57             : 
      58             : /**
      59             :  * This class is able to decide whether and which internet proxy server is to
      60             :  * be used to access a given URI.
      61             :  *
      62             :  * The implementation reads the internet proxy settings from Office
      63             :  * configuration. It listens for configuration changes and adapts itself
      64             :  * accordingly. Because configuration data can change during runtime clients
      65             :  * should not cache results obtained from InternetProxyDecider instances. One
      66             :  * instance should be kept to be queried multiple times instead.
      67             :  */
      68             : class UCBHELPER_DLLPUBLIC InternetProxyDecider
      69             : {
      70             : public:
      71             :     /**
      72             :       * Constructor.
      73             :       *
      74             :       * Note: Every instance should be held alive as long as possible because
      75             :       *       because construction is quite expensive.
      76             :       *
      77             :       * @param rxSMgr is a Service Manager.
      78             :       */
      79             :     InternetProxyDecider( const ::com::sun::star::uno::Reference<
      80             :                     ::com::sun::star::uno::XComponentContext >& rxContext );
      81             : 
      82             :     /**
      83             :       * Destructor.
      84             :       */
      85             :     ~InternetProxyDecider();
      86             : 
      87             :     /**
      88             :       * Informs whether a proxy server should be used.
      89             :       *
      90             :       * @param rProtocol contains the internet protocol to be used to
      91             :       *         access the server (i.e. "ftp", "http"). The protocol string
      92             :       *         is handled case-insensitive and must not be empty.
      93             :       * @param rHost contains the name of the server that should be accessed.
      94             :       *         This parameter might be left empty. In this case the
      95             :       *         implementation will return whether a proxy is configured
      96             :       *         for the given protocol.
      97             :       * @param nPort contains the port of the server that should be accessed.
      98             :       *         If host is not empty this parameter must always contain a valid
      99             :       *         port number, for instance the default port for the requested
     100             :       *         protocol(i.e. 80 or http).
     101             :       * @return true if a proxy server should be used, false otherwise.
     102             :       */
     103             :     bool
     104             :     shouldUseProxy( const OUString & rProtocol,
     105             :                     const OUString & rHost,
     106             :                     sal_Int32 nPort ) const;
     107             : 
     108             :     /**
     109             :       * Returns the proxy server to be used.
     110             :       *
     111             :       * @param rProtocol contains the internet protocol to be used to
     112             :       *         access the server (i.e. "ftp", "http"). The protocol string
     113             :       *         is handled case-insensitive and must not be empty.
     114             :       * @param rHost contains the name of the server that should be accessed.
     115             :       *         This parameter might be left empty. In this case the
     116             :       *         implementation will return the proxy that is configured
     117             :       *         for the given protocol.
     118             :       * @param nPort contains the port of the server that should be accessed.
     119             :       *         If host is not empty this parameter must always contain a valid
     120             :       *         port number, for instance the default port for the requested
     121             :       *         protocol(i.e. 80 or http).
     122             :       * @return a InternetProxyServer reference. If member aName of the
     123             :       *         InternetProxyServer is empty no proxy server is to be used.
     124             :       */
     125             :     const InternetProxyServer &
     126             :     getProxy( const OUString & rProtocol,
     127             :               const OUString & rHost,
     128             :               sal_Int32 nPort ) const;
     129             : 
     130             : private:
     131             :     proxydecider_impl::InternetProxyDecider_Impl * m_pImpl;
     132             : };
     133             : 
     134             : } // namespace ucbhelper
     135             : 
     136             : #endif /* ! INCLUDED_UCBHELPER_PROXYDECIDER_HXX */
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11