| 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 REMOTING_PROTOCOL_SESSION_CONFIG_H_ | 5 #ifndef REMOTING_PROTOCOL_SESSION_CONFIG_H_ |
| 6 #define REMOTING_PROTOCOL_SESSION_CONFIG_H_ | 6 #define REMOTING_PROTOCOL_SESSION_CONFIG_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 "base/memory/scoped_ptr.h" |
| 12 | 13 |
| 13 namespace remoting { | 14 namespace remoting { |
| 14 namespace protocol { | 15 namespace protocol { |
| 15 | 16 |
| 16 extern const int kDefaultStreamVersion; | 17 extern const int kDefaultStreamVersion; |
| 17 | 18 |
| 18 // Struct for configuration parameters of a single channel. | 19 // Struct for configuration parameters of a single channel. |
| 19 // Some channels (like video) may have multiple underlying sockets that need | 20 // Some channels (like video) may have multiple underlying sockets that need |
| 20 // to be configured simultaneously. | 21 // to be configured simultaneously. |
| 21 struct ChannelConfig { | 22 struct ChannelConfig { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 113 |
| 113 // Returns true if |config| is supported. | 114 // Returns true if |config| is supported. |
| 114 bool IsSupported(const SessionConfig& config) const; | 115 bool IsSupported(const SessionConfig& config) const; |
| 115 | 116 |
| 116 // Extracts final protocol configuration. Must be used for the description | 117 // Extracts final protocol configuration. Must be used for the description |
| 117 // received in the session-accept stanza. If the selection is ambiguous | 118 // received in the session-accept stanza. If the selection is ambiguous |
| 118 // (e.g. there is more than one configuration for one of the channel) | 119 // (e.g. there is more than one configuration for one of the channel) |
| 119 // or undefined (e.g. no configurations for a channel) then NULL is returned. | 120 // or undefined (e.g. no configurations for a channel) then NULL is returned. |
| 120 bool GetFinalConfig(SessionConfig* result) const; | 121 bool GetFinalConfig(SessionConfig* result) const; |
| 121 | 122 |
| 122 CandidateSessionConfig* Clone() const; | 123 scoped_ptr<CandidateSessionConfig> Clone() const; |
| 123 | 124 |
| 124 static CandidateSessionConfig* CreateEmpty(); | 125 static scoped_ptr<CandidateSessionConfig> CreateEmpty(); |
| 125 static CandidateSessionConfig* CreateFrom(const SessionConfig& config); | 126 static scoped_ptr<CandidateSessionConfig> CreateFrom( |
| 126 static CandidateSessionConfig* CreateDefault(); | 127 const SessionConfig& config); |
| 128 static scoped_ptr<CandidateSessionConfig> CreateDefault(); |
| 127 | 129 |
| 128 private: | 130 private: |
| 129 CandidateSessionConfig(); | 131 CandidateSessionConfig(); |
| 130 explicit CandidateSessionConfig(const CandidateSessionConfig& config); | 132 explicit CandidateSessionConfig(const CandidateSessionConfig& config); |
| 131 CandidateSessionConfig& operator=(const CandidateSessionConfig& b); | 133 CandidateSessionConfig& operator=(const CandidateSessionConfig& b); |
| 132 | 134 |
| 133 static bool SelectCommonChannelConfig( | 135 static bool SelectCommonChannelConfig( |
| 134 const std::vector<ChannelConfig>& host_configs_, | 136 const std::vector<ChannelConfig>& host_configs_, |
| 135 const std::vector<ChannelConfig>& client_configs_, | 137 const std::vector<ChannelConfig>& client_configs_, |
| 136 ChannelConfig* config); | 138 ChannelConfig* config); |
| 137 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector, | 139 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector, |
| 138 const ChannelConfig& value); | 140 const ChannelConfig& value); |
| 139 | 141 |
| 140 std::vector<ChannelConfig> control_configs_; | 142 std::vector<ChannelConfig> control_configs_; |
| 141 std::vector<ChannelConfig> event_configs_; | 143 std::vector<ChannelConfig> event_configs_; |
| 142 std::vector<ChannelConfig> video_configs_; | 144 std::vector<ChannelConfig> video_configs_; |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 } // namespace protocol | 147 } // namespace protocol |
| 146 } // namespace remoting | 148 } // namespace remoting |
| 147 | 149 |
| 148 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ | 150 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ |
| OLD | NEW |