blob: af228d2a5a875f993ae487a7272e1ae2c7b2bdf1 [file] [log] [blame]
Andrew de los Reyes9cd120d2010-11-18 17:50:03 -08001// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PROXY_RESOLVER_H__
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PROXY_RESOLVER_H__
7
8#include <base/logging.h>
9
Andrew de los Reyes45168102010-11-22 11:13:50 -080010#include <deque>
Andrew de los Reyes9cd120d2010-11-18 17:50:03 -080011#include <string>
Andrew de los Reyes9cd120d2010-11-18 17:50:03 -080012
13namespace chromeos_update_engine {
14
15extern const char kNoProxy[];
16
17class ProxyResolver {
18 public:
19 ProxyResolver() {}
20 virtual ~ProxyResolver() {}
21
22 // Stores a list of proxies for a given |url| in |out_proxy|.
23 // Returns true on success. The resultant proxy will be in one of the
24 // following forms:
25 // http://<host>[:<port>] - HTTP proxy
26 // socks{4,5}://<host>[:<port>] - SOCKS4/5 proxy
27 // kNoProxy - no proxy
28 virtual bool GetProxiesForUrl(const std::string& url,
Andrew de los Reyes45168102010-11-22 11:13:50 -080029 std::deque<std::string>* out_proxies) = 0;
Andrew de los Reyes9cd120d2010-11-18 17:50:03 -080030
31 private:
32 DISALLOW_COPY_AND_ASSIGN(ProxyResolver);
33};
34
35// Always says to not use a proxy
36class DirectProxyResolver : public ProxyResolver {
37 public:
Andrew de los Reyes45168102010-11-22 11:13:50 -080038 DirectProxyResolver() {}
Andrew de los Reyes9cd120d2010-11-18 17:50:03 -080039 virtual bool GetProxiesForUrl(const std::string& url,
Andrew de los Reyes45168102010-11-22 11:13:50 -080040 std::deque<std::string>* out_proxies);
Andrew de los Reyes9cd120d2010-11-18 17:50:03 -080041
42 private:
43 DISALLOW_COPY_AND_ASSIGN(DirectProxyResolver);
44};
45
46} // namespace chromeos_update_engine
47
48#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PROXY_RESOLVER_H__