| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium 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 CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ | |
| 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ | |
| 7 | |
| 8 #include <deque> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "talk/xmpp/xmppclientsettings.h" | |
| 13 | |
| 14 namespace notifier { | |
| 15 | |
| 16 class ConnectionSettings { | |
| 17 public: | |
| 18 ConnectionSettings() : protocol_(cricket::PROTO_TCP) {} | |
| 19 | |
| 20 cricket::ProtocolType protocol() { return protocol_; } | |
| 21 const talk_base::SocketAddress& server() const { return server_; } | |
| 22 const talk_base::ProxyInfo& proxy() const { return proxy_; } | |
| 23 | |
| 24 void set_protocol(cricket::ProtocolType protocol) { protocol_ = protocol; } | |
| 25 talk_base::SocketAddress* mutable_server() { return &server_; } | |
| 26 talk_base::ProxyInfo* mutable_proxy() { return &proxy_; } | |
| 27 | |
| 28 void FillXmppClientSettings(buzz::XmppClientSettings* xcs) const; | |
| 29 | |
| 30 private: | |
| 31 cricket::ProtocolType protocol_; // PROTO_TCP, PROTO_SSLTCP, etc. | |
| 32 talk_base::SocketAddress server_; // Server. | |
| 33 talk_base::ProxyInfo proxy_; // Proxy info. | |
| 34 // Need copy constructor due to use in stl deque. | |
| 35 }; | |
| 36 | |
| 37 class ConnectionSettingsList { | |
| 38 public: | |
| 39 ConnectionSettingsList() {} | |
| 40 | |
| 41 void SetProxy(const talk_base::ProxyInfo& proxy) { | |
| 42 *(template_.mutable_proxy()) = proxy; | |
| 43 } | |
| 44 | |
| 45 const talk_base::ProxyInfo& proxy() const { | |
| 46 return template_.proxy(); | |
| 47 } | |
| 48 | |
| 49 int GetCount() { return list_.size(); } | |
| 50 ConnectionSettings* GetSettings(size_t index) { return &list_[index]; } | |
| 51 | |
| 52 void ClearPermutations() { | |
| 53 list_.clear(); | |
| 54 iplist_seen_.clear(); | |
| 55 } | |
| 56 | |
| 57 void AddPermutations(const std::string& hostname, | |
| 58 const std::vector<uint32>& iplist, | |
| 59 int16 port, | |
| 60 bool special_port_magic, | |
| 61 bool proxy_only); | |
| 62 private: | |
| 63 void PermuteForAddress(const talk_base::SocketAddress& server, | |
| 64 bool special_port_magic, | |
| 65 bool proxy_only, | |
| 66 std::deque<ConnectionSettings>* list_temp); | |
| 67 | |
| 68 ConnectionSettings template_; | |
| 69 std::deque<ConnectionSettings> list_; | |
| 70 std::vector<uint32> iplist_seen_; | |
| 71 DISALLOW_COPY_AND_ASSIGN(ConnectionSettingsList); | |
| 72 }; | |
| 73 | |
| 74 } // namespace notifier | |
| 75 | |
| 76 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ | |
| OLD | NEW |