Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / jingle / notifier / communicator / connection_settings.h
blob9091fcbf24bb8fa4778a8d03fcff67a0340b1097
1 // Copyright (c) 2012 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.
5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_
6 #define JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "jingle/notifier/base/server_information.h"
13 #include "webrtc/base/socketaddress.h"
15 namespace buzz {
16 class XmppClientSettings;
17 } // namespace
19 namespace notifier {
21 // The port for SSLTCP (just the regular port for SSL).
22 extern const uint16 kSslTcpPort;
24 enum SslTcpMode { DO_NOT_USE_SSLTCP, USE_SSLTCP };
26 struct ConnectionSettings {
27 public:
28 ConnectionSettings(const rtc::SocketAddress& server,
29 SslTcpMode ssltcp_mode,
30 SslTcpSupport ssltcp_support);
31 ConnectionSettings();
32 ~ConnectionSettings();
34 bool Equals(const ConnectionSettings& settings) const;
36 std::string ToString() const;
38 // Fill in the connection-related fields of |client_settings|.
39 void FillXmppClientSettings(buzz::XmppClientSettings* client_settings) const;
41 rtc::SocketAddress server;
42 SslTcpMode ssltcp_mode;
43 SslTcpSupport ssltcp_support;
46 typedef std::vector<ConnectionSettings> ConnectionSettingsList;
48 // Given a list of servers in priority order, generate a list of
49 // ConnectionSettings to try in priority order. If |try_ssltcp_first|
50 // is set, for each server that supports SSLTCP, the
51 // ConnectionSettings using SSLTCP will come first. If it is not set,
52 // the ConnectionSettings using SSLTCP will come last.
53 ConnectionSettingsList MakeConnectionSettingsList(
54 const ServerList& servers,
55 bool try_ssltcp_first);
57 } // namespace notifier
59 #endif // JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_