Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: remoting/protocol/session_config.h

Issue 4446005: Chromoting: Rename ChromotocolConfig -> SessionConfig (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Rename candidate_config vars Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/session_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_CHROMOTOCOL_CONFIG_H_ 5 #ifndef REMOTING_PROTOCOL_SESSION_CONFIG_H_
6 #define REMOTING_PROTOCOL_CHROMOTOCOL_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 12
13 namespace remoting { 13 namespace remoting {
14 namespace protocol {
14 15
15 extern const int kDefaultStreamVersion; 16 extern const int kDefaultStreamVersion;
16 17
17 // Struct for configuration parameters of a single channel. 18 // Struct for configuration parameters of a single channel.
19 // Some channels (like video) may have multiple underlying sockets that need
20 // to be configured simultaneously.
18 struct ChannelConfig { 21 struct ChannelConfig {
19 enum TransportType { 22 enum TransportType {
20 TRANSPORT_STREAM, 23 TRANSPORT_STREAM,
21 TRANSPORT_DATAGRAM, 24 TRANSPORT_DATAGRAM,
22 TRANSPORT_SRTP, 25 TRANSPORT_SRTP,
23 TRANSPORT_RTP_DTLS, 26 TRANSPORT_RTP_DTLS,
24 }; 27 };
25 28
26 enum Codec { 29 enum Codec {
27 CODEC_UNDEFINED, // Used for event and control channels. 30 CODEC_UNDEFINED, // Used for event and control channels.
(...skipping 19 matching lines...) Expand all
47 struct ScreenResolution { 50 struct ScreenResolution {
48 ScreenResolution(); 51 ScreenResolution();
49 ScreenResolution(int width, int height); 52 ScreenResolution(int width, int height);
50 53
51 bool IsValid() const; 54 bool IsValid() const;
52 55
53 int width; 56 int width;
54 int height; 57 int height;
55 }; 58 };
56 59
57 // ChromotocolConfig is used by ChromotingConnection to store negotiated 60 // SessionConfig is used by the chromoting Session to store negotiated
58 // chromotocol configuration. 61 // chromotocol configuration.
59 class ChromotocolConfig { 62 class SessionConfig {
60 public: 63 public:
61 ~ChromotocolConfig(); 64 ~SessionConfig();
62 65
63 const ChannelConfig& control_config() const { return control_config_; } 66 const ChannelConfig& control_config() const { return control_config_; }
64 const ChannelConfig& event_config() const { return event_config_; } 67 const ChannelConfig& event_config() const { return event_config_; }
65 const ChannelConfig& video_config() const { return video_config_; } 68 const ChannelConfig& video_config() const { return video_config_; }
66 const ScreenResolution& initial_resolution() const { 69 const ScreenResolution& initial_resolution() const {
67 return initial_resolution_; 70 return initial_resolution_;
68 } 71 }
69 72
70 void SetControlConfig(const ChannelConfig& control_config); 73 void SetControlConfig(const ChannelConfig& control_config);
71 void SetEventConfig(const ChannelConfig& event_config); 74 void SetEventConfig(const ChannelConfig& event_config);
72 void SetVideoConfig(const ChannelConfig& video_config); 75 void SetVideoConfig(const ChannelConfig& video_config);
73 void SetInitialResolution(const ScreenResolution& initial_resolution); 76 void SetInitialResolution(const ScreenResolution& initial_resolution);
74 77
75 ChromotocolConfig* Clone() const; 78 SessionConfig* Clone() const;
76 79
77 static ChromotocolConfig* CreateDefault(); 80 static SessionConfig* CreateDefault();
78 81
79 private: 82 private:
80 ChromotocolConfig(); 83 SessionConfig();
81 explicit ChromotocolConfig(const ChromotocolConfig& config); 84 explicit SessionConfig(const SessionConfig& config);
82 ChromotocolConfig& operator=(const ChromotocolConfig& b); 85 SessionConfig& operator=(const SessionConfig& b);
83 86
84 ChannelConfig control_config_; 87 ChannelConfig control_config_;
85 ChannelConfig event_config_; 88 ChannelConfig event_config_;
86 ChannelConfig video_config_; 89 ChannelConfig video_config_;
87 ScreenResolution initial_resolution_; 90 ScreenResolution initial_resolution_;
88 }; 91 };
89 92
90 // Defines session description that is sent from client to the host in the 93 // Defines session description that is sent from client to the host in the
91 // session-initiate message. It is different from the regular ChromotocolConfig 94 // session-initiate message. It is different from the regular Config
92 // because it allows one to specify multiple configurations for each channel. 95 // because it allows one to specify multiple configurations for each channel.
93 class CandidateChromotocolConfig { 96 class CandidateSessionConfig {
94 public: 97 public:
95 ~CandidateChromotocolConfig(); 98 ~CandidateSessionConfig();
96 99
97 const std::vector<ChannelConfig>& control_configs() const { 100 const std::vector<ChannelConfig>& control_configs() const {
98 return control_configs_; 101 return control_configs_;
99 } 102 }
100 103
101 const std::vector<ChannelConfig>& event_configs() const { 104 const std::vector<ChannelConfig>& event_configs() const {
102 return event_configs_; 105 return event_configs_;
103 } 106 }
104 107
105 const std::vector<ChannelConfig>& video_configs() const { 108 const std::vector<ChannelConfig>& video_configs() const {
106 return video_configs_; 109 return video_configs_;
107 } 110 }
108 111
109 const ScreenResolution& initial_resolution() const { 112 const ScreenResolution& initial_resolution() const {
110 return initial_resolution_; 113 return initial_resolution_;
111 } 114 }
112 115
113 void AddControlConfig(const ChannelConfig& control_config); 116 void AddControlConfig(const ChannelConfig& control_config);
114 void AddEventConfig(const ChannelConfig& event_config); 117 void AddEventConfig(const ChannelConfig& event_config);
115 void AddVideoConfig(const ChannelConfig& video_config); 118 void AddVideoConfig(const ChannelConfig& video_config);
116 void SetInitialResolution(const ScreenResolution& initial_resolution); 119 void SetInitialResolution(const ScreenResolution& initial_resolution);
117 120
118 // Selects session configuration that is supported by both participants. 121 // Selects session configuration that is supported by both participants.
119 // NULL is returned if such configuration doesn't exist. When selecting 122 // NULL is returned if such configuration doesn't exist. When selecting
120 // channel configuration priority is given to the configs listed first 123 // channel configuration priority is given to the configs listed first
121 // in |client_config|. 124 // in |client_config|.
122 ChromotocolConfig* Select(const CandidateChromotocolConfig* client_config, 125 SessionConfig* Select(const CandidateSessionConfig* client_config,
123 bool force_host_resolution); 126 bool force_host_resolution);
124 127
125 // Returns true if |config| is supported. 128 // Returns true if |config| is supported.
126 bool IsSupported(const ChromotocolConfig* config) const; 129 bool IsSupported(const SessionConfig* config) const;
127 130
128 // Extracts final protocol configuration. Must be used for the description 131 // Extracts final protocol configuration. Must be used for the description
129 // received in the session-accept stanza. If the selection is ambiguous 132 // received in the session-accept stanza. If the selection is ambiguous
130 // (e.g. there is more than one configuration for one of the channel) 133 // (e.g. there is more than one configuration for one of the channel)
131 // or undefined (e.g. no configurations for a channel) then NULL is returned. 134 // or undefined (e.g. no configurations for a channel) then NULL is returned.
132 ChromotocolConfig* GetFinalConfig() const; 135 SessionConfig* GetFinalConfig() const;
133 136
134 CandidateChromotocolConfig* Clone() const; 137 CandidateSessionConfig* Clone() const;
135 138
136 static CandidateChromotocolConfig* CreateEmpty(); 139 static CandidateSessionConfig* CreateEmpty();
137 static CandidateChromotocolConfig* CreateFrom( 140 static CandidateSessionConfig* CreateFrom(const SessionConfig* config);
138 const ChromotocolConfig* config); 141 static CandidateSessionConfig* CreateDefault();
139 static CandidateChromotocolConfig* CreateDefault();
140 142
141 private: 143 private:
142 CandidateChromotocolConfig(); 144 CandidateSessionConfig();
143 explicit CandidateChromotocolConfig(const CandidateChromotocolConfig& config); 145 explicit CandidateSessionConfig(const CandidateSessionConfig& config);
144 CandidateChromotocolConfig& operator=(const CandidateChromotocolConfig& b); 146 CandidateSessionConfig& operator=(const CandidateSessionConfig& b);
145 147
146 static bool SelectCommonChannelConfig( 148 static bool SelectCommonChannelConfig(
147 const std::vector<ChannelConfig>& host_configs_, 149 const std::vector<ChannelConfig>& host_configs_,
148 const std::vector<ChannelConfig>& client_configs_, 150 const std::vector<ChannelConfig>& client_configs_,
149 ChannelConfig* config); 151 ChannelConfig* config);
150 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector, 152 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector,
151 const ChannelConfig& value); 153 const ChannelConfig& value);
152 154
153 std::vector<ChannelConfig> control_configs_; 155 std::vector<ChannelConfig> control_configs_;
154 std::vector<ChannelConfig> event_configs_; 156 std::vector<ChannelConfig> event_configs_;
155 std::vector<ChannelConfig> video_configs_; 157 std::vector<ChannelConfig> video_configs_;
156 158
157 ScreenResolution initial_resolution_; 159 ScreenResolution initial_resolution_;
158 }; 160 };
159 161
162 } // namespace protocol
160 } // namespace remoting 163 } // namespace remoting
161 164
162 #endif // REMOTING_PROTOCOL_CHROMOTOCOL_CONFIG_H_ 165 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
OLDNEW
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/session_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698