OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ | 5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ |
6 #define JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ | 6 #define JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "jingle/notifier/base/server_information.h" | 12 #include "jingle/notifier/base/server_information.h" |
13 #include "talk/base/socketaddress.h" | 13 #include "webrtc/base/socketaddress.h" |
14 | 14 |
15 namespace buzz { | 15 namespace buzz { |
16 class XmppClientSettings; | 16 class XmppClientSettings; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 namespace notifier { | 19 namespace notifier { |
20 | 20 |
21 // The port for SSLTCP (just the regular port for SSL). | 21 // The port for SSLTCP (just the regular port for SSL). |
22 extern const uint16 kSslTcpPort; | 22 extern const uint16 kSslTcpPort; |
23 | 23 |
24 enum SslTcpMode { DO_NOT_USE_SSLTCP, USE_SSLTCP }; | 24 enum SslTcpMode { DO_NOT_USE_SSLTCP, USE_SSLTCP }; |
25 | 25 |
26 struct ConnectionSettings { | 26 struct ConnectionSettings { |
27 public: | 27 public: |
28 ConnectionSettings(const talk_base::SocketAddress& server, | 28 ConnectionSettings(const rtc::SocketAddress& server, |
29 SslTcpMode ssltcp_mode, | 29 SslTcpMode ssltcp_mode, |
30 SslTcpSupport ssltcp_support); | 30 SslTcpSupport ssltcp_support); |
31 ConnectionSettings(); | 31 ConnectionSettings(); |
32 ~ConnectionSettings(); | 32 ~ConnectionSettings(); |
33 | 33 |
34 bool Equals(const ConnectionSettings& settings) const; | 34 bool Equals(const ConnectionSettings& settings) const; |
35 | 35 |
36 std::string ToString() const; | 36 std::string ToString() const; |
37 | 37 |
38 // Fill in the connection-related fields of |client_settings|. | 38 // Fill in the connection-related fields of |client_settings|. |
39 void FillXmppClientSettings(buzz::XmppClientSettings* client_settings) const; | 39 void FillXmppClientSettings(buzz::XmppClientSettings* client_settings) const; |
40 | 40 |
41 talk_base::SocketAddress server; | 41 rtc::SocketAddress server; |
42 SslTcpMode ssltcp_mode; | 42 SslTcpMode ssltcp_mode; |
43 SslTcpSupport ssltcp_support; | 43 SslTcpSupport ssltcp_support; |
44 }; | 44 }; |
45 | 45 |
46 typedef std::vector<ConnectionSettings> ConnectionSettingsList; | 46 typedef std::vector<ConnectionSettings> ConnectionSettingsList; |
47 | 47 |
48 // Given a list of servers in priority order, generate a list of | 48 // Given a list of servers in priority order, generate a list of |
49 // ConnectionSettings to try in priority order. If |try_ssltcp_first| | 49 // ConnectionSettings to try in priority order. If |try_ssltcp_first| |
50 // is set, for each server that supports SSLTCP, the | 50 // is set, for each server that supports SSLTCP, the |
51 // ConnectionSettings using SSLTCP will come first. If it is not set, | 51 // ConnectionSettings using SSLTCP will come first. If it is not set, |
52 // the ConnectionSettings using SSLTCP will come last. | 52 // the ConnectionSettings using SSLTCP will come last. |
53 ConnectionSettingsList MakeConnectionSettingsList( | 53 ConnectionSettingsList MakeConnectionSettingsList( |
54 const ServerList& servers, | 54 const ServerList& servers, |
55 bool try_ssltcp_first); | 55 bool try_ssltcp_first); |
56 | 56 |
57 } // namespace notifier | 57 } // namespace notifier |
58 | 58 |
59 #endif // JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ | 59 #endif // JINGLE_NOTIFIER_COMMUNICATOR_CONNECTION_SETTINGS_H_ |
OLD | NEW |