1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_UCBHELPER_PROXYDECIDER_HXX
21 #define INCLUDED_UCBHELPER_PROXYDECIDER_HXX
23 #include <rtl/ustring.hxx>
24 #include <rtl/ref.hxx>
25 #include <ucbhelper/ucbhelperdllapi.h>
27 namespace com::sun::star::uno
{ class XComponentContext
; }
28 namespace com::sun::star::uno
{ template <class interface_type
> class Reference
; }
34 * This struct describes a proxy server.
36 struct InternetProxyServer
39 * The name of the proxy server.
44 * The port of the proxy server.
51 InternetProxyServer() : nPort( -1 ) {}
54 namespace proxydecider_impl
{ class InternetProxyDecider_Impl
; }
57 * This class is able to decide whether and which internet proxy server is to
58 * be used to access a given URI.
60 * The implementation reads the internet proxy settings from Office
61 * configuration. It listens for configuration changes and adapts itself
62 * accordingly. Because configuration data can change during runtime clients
63 * should not cache results obtained from InternetProxyDecider instances. One
64 * instance should be kept to be queried multiple times instead.
66 class UCBHELPER_DLLPUBLIC InternetProxyDecider
72 * Note: Every instance should be held alive as long as possible because
73 * because construction is quite expensive.
75 * @param rxSMgr is a Service Manager.
77 InternetProxyDecider( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
82 ~InternetProxyDecider();
85 * Returns the proxy server to be used.
87 * @param rProtocol contains the internet protocol to be used to
88 * access the server (i.e. "ftp", "http"). The protocol string
89 * is handled case-insensitive and must not be empty.
90 * @param rHost contains the name of the server that should be accessed.
91 * This parameter might be left empty. In this case the
92 * implementation will return the proxy that is configured
93 * for the given protocol.
94 * @param nPort contains the port of the server that should be accessed.
95 * If host is not empty this parameter must always contain a valid
96 * port number, for instance the default port for the requested
97 * protocol(i.e. 80 or http).
98 * @return an URL, with or without scheme.
99 * If empty no proxy server is to be used.
102 getProxy( const OUString
& rProtocol
,
103 const OUString
& rHost
,
104 sal_Int32 nPort
) const;
107 rtl::Reference
<proxydecider_impl::InternetProxyDecider_Impl
> m_xImpl
;
110 } // namespace ucbhelper
112 #endif /* ! INCLUDED_UCBHELPER_PROXYDECIDER_HXX */
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */