LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/ucbhelper - proxydecider.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 _UCBHELPER_PROXYDECIDER_HXX
      21                 :            : #define _UCBHELPER_PROXYDECIDER_HXX
      22                 :            : 
      23                 :            : #include <rtl/ustring.hxx>
      24                 :            : #include <com/sun/star/uno/Reference.hxx>
      25                 :            : #include "ucbhelper/ucbhelperdllapi.h"
      26                 :            : 
      27                 :            : namespace com { namespace sun { namespace star { namespace lang {
      28                 :            :     class XMultiServiceFactory;
      29                 :            : } } } }
      30                 :            : 
      31                 :            : namespace ucbhelper
      32                 :            : {
      33                 :            : 
      34                 :            : /**
      35                 :            :  * This struct describes a proxy server.
      36                 :            :  */
      37                 :         16 : struct InternetProxyServer
      38                 :            : {
      39                 :            :     /**
      40                 :            :       * The name of the proxy server.
      41                 :            :       */
      42                 :            :     ::rtl::OUString aName;
      43                 :            : 
      44                 :            :     /**
      45                 :            :       * The port of the proxy server.
      46                 :            :       */
      47                 :            :     sal_Int32 nPort;
      48                 :            : 
      49                 :            :     /**
      50                 :            :       * Constructor.
      51                 :            :       */
      52                 :         16 :     InternetProxyServer() : nPort( -1 ) {}
      53                 :            : };
      54                 :            : 
      55                 :            : namespace proxydecider_impl { class InternetProxyDecider_Impl; }
      56                 :            : 
      57                 :            : /**
      58                 :            :  * This class is able to decide whether and which internet proxy server is to
      59                 :            :  * be used to access a given URI.
      60                 :            :  *
      61                 :            :  * The implementation reads the internet proxy settings from Office
      62                 :            :  * configuration. It listens for configuration changes and adapts itself
      63                 :            :  * accordingly. Because configuration data can change during runtime clients
      64                 :            :  * should not cache results obtained from InternetProxyDecider instances. One
      65                 :            :  * instance should be kept to be queried multiple times instead.
      66                 :            :  */
      67                 :            : class UCBHELPER_DLLPUBLIC InternetProxyDecider
      68                 :            : {
      69                 :            : public:
      70                 :            :     /**
      71                 :            :       * Constructor.
      72                 :            :       *
      73                 :            :       * Note: Every instance should be held alive as long as possible because
      74                 :            :       *       because construction is quite expensive.
      75                 :            :       *
      76                 :            :       * @param rxSMgr is a Service Manager.
      77                 :            :       */
      78                 :            :     InternetProxyDecider( const ::com::sun::star::uno::Reference<
      79                 :            :                     ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
      80                 :            : 
      81                 :            :     /**
      82                 :            :       * Destructor.
      83                 :            :       */
      84                 :            :     ~InternetProxyDecider();
      85                 :            : 
      86                 :            :     /**
      87                 :            :       * Informs whether a proxy server should be used.
      88                 :            :       *
      89                 :            :       * @param rProtocol contains the internet protocol to be used to
      90                 :            :       *         access the server (i.e. "ftp", "http"). The protocol string
      91                 :            :       *         is handled case-insensitive and must not be empty.
      92                 :            :       * @param rHost contains the name of the server that should be accessed.
      93                 :            :       *         This parameter might be left empty. In this case the
      94                 :            :       *         implementation will return whether a proxy is configured
      95                 :            :       *         for the given protocol.
      96                 :            :       * @param nPort contains the port of the server that should be accessed.
      97                 :            :       *         If host is not empty this parameter must always contain a valid
      98                 :            :       *         port number, for instance the default port for the requested
      99                 :            :       *         protocol(i.e. 80 or http).
     100                 :            :       * @return true if a proxy server should be used, false otherwise.
     101                 :            :       */
     102                 :            :     bool
     103                 :            :     shouldUseProxy( const rtl::OUString & rProtocol,
     104                 :            :                     const rtl::OUString & rHost,
     105                 :            :                     sal_Int32 nPort ) const;
     106                 :            : 
     107                 :            :     /**
     108                 :            :       * Returns the proxy server to be used.
     109                 :            :       *
     110                 :            :       * @param rProtocol contains the internet protocol to be used to
     111                 :            :       *         access the server (i.e. "ftp", "http"). The protocol string
     112                 :            :       *         is handled case-insensitive and must not be empty.
     113                 :            :       * @param rHost contains the name of the server that should be accessed.
     114                 :            :       *         This parameter might be left empty. In this case the
     115                 :            :       *         implementation will return the proxy that is configured
     116                 :            :       *         for the given protocol.
     117                 :            :       * @param nPort contains the port of the server that should be accessed.
     118                 :            :       *         If host is not empty this parameter must always contain a valid
     119                 :            :       *         port number, for instance the default port for the requested
     120                 :            :       *         protocol(i.e. 80 or http).
     121                 :            :       * @return a InternetProxyServer reference. If member aName of the
     122                 :            :       *         InternetProxyServer is empty no proxy server is to be used.
     123                 :            :       */
     124                 :            :     const InternetProxyServer &
     125                 :            :     getProxy( const rtl::OUString & rProtocol,
     126                 :            :               const rtl::OUString & rHost,
     127                 :            :               sal_Int32 nPort ) const;
     128                 :            : 
     129                 :            : private:
     130                 :            :     proxydecider_impl::InternetProxyDecider_Impl * m_pImpl;
     131                 :            : };
     132                 :            : 
     133                 :            : } // namespace ucbhelper
     134                 :            : 
     135                 :            : #endif /* !_UCBHELPER_PROXYDECIDER_HXX */
     136                 :            : 
     137                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10