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_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // is set to false some data sent by the peers may be | 73 // is set to false some data sent by the peers may be |
74 // delayed. This is used to indicate in the UI when connection is | 74 // delayed. This is used to indicate in the UI when connection is |
75 // temporarily broken. | 75 // temporarily broken. |
76 virtual void OnConnectionReady(bool ready) = 0; | 76 virtual void OnConnectionReady(bool ready) = 0; |
77 | 77 |
78 // Called when the route type (direct vs. STUN vs. proxied) changes. | 78 // Called when the route type (direct vs. STUN vs. proxied) changes. |
79 virtual void OnRouteChanged(const std::string& channel_name, | 79 virtual void OnRouteChanged(const std::string& channel_name, |
80 const protocol::TransportRoute& route) = 0; | 80 const protocol::TransportRoute& route) = 0; |
81 }; | 81 }; |
82 | 82 |
83 ConnectionToHost(bool allow_nat_traversal); | 83 ConnectionToHost(); |
84 virtual ~ConnectionToHost(); | 84 virtual ~ConnectionToHost(); |
85 | 85 |
86 // Set the stubs which will handle messages from the host. | 86 // Set the stubs which will handle messages from the host. |
87 // The caller must ensure that stubs out-live the connection. | 87 // The caller must ensure that stubs out-live the connection. |
88 // Unless otherwise specified, all stubs must be set before Connect() | 88 // Unless otherwise specified, all stubs must be set before Connect() |
89 // is called. | 89 // is called. |
90 void set_client_stub(ClientStub* client_stub); | 90 void set_client_stub(ClientStub* client_stub); |
91 void set_clipboard_stub(ClipboardStub* clipboard_stub); | 91 void set_clipboard_stub(ClipboardStub* clipboard_stub); |
92 void set_video_stub(VideoStub* video_stub); | 92 void set_video_stub(VideoStub* video_stub); |
93 // If no audio stub is specified then audio will not be requested. | 93 // If no audio stub is specified then audio will not be requested. |
94 void set_audio_stub(AudioStub* audio_stub); | 94 void set_audio_stub(AudioStub* audio_stub); |
95 | 95 |
96 // Initiates a connection to the host specified by |host_jid|. | 96 // Initiates a connection to the host specified by |host_jid|. |
97 // |signal_strategy| is used to signal to the host, and must outlive the | 97 // |signal_strategy| is used to signal to the host, and must outlive the |
98 // connection. Data channels will be negotiated over |transport_factory|. | 98 // connection. Data channels will be negotiated over |transport_factory|. |
99 // |authenticator| will be used to authenticate the session and data channels. | 99 // |authenticator| will be used to authenticate the session and data channels. |
100 // |event_callback| will be notified of changes in the state of the connection | 100 // |event_callback| will be notified of changes in the state of the connection |
101 // and must outlive the ConnectionToHost. | 101 // and must outlive the ConnectionToHost. |
102 // Caller must set stubs (see below) before calling Connect. | 102 // Caller must set stubs (see below) before calling Connect. |
103 virtual void Connect(SignalStrategy* signal_strategy, | 103 virtual void Connect(SignalStrategy* signal_strategy, |
104 scoped_ptr<TransportFactory> transport_factory, | 104 scoped_ptr<TransportFactory> transport_factory, |
105 scoped_ptr<Authenticator> authenticator, | 105 scoped_ptr<Authenticator> authenticator, |
106 const std::string& host_jid, | 106 const std::string& host_jid, |
107 const std::string& host_public_key, | |
108 HostEventCallback* event_callback); | 107 HostEventCallback* event_callback); |
109 | 108 |
110 // Returns the session configuration that was negotiated with the host. | 109 // Returns the session configuration that was negotiated with the host. |
111 virtual const SessionConfig& config(); | 110 virtual const SessionConfig& config(); |
112 | 111 |
113 // Stubs for sending data to the host. | 112 // Stubs for sending data to the host. |
114 virtual ClipboardStub* clipboard_forwarder(); | 113 virtual ClipboardStub* clipboard_forwarder(); |
115 virtual HostStub* host_stub(); | 114 virtual HostStub* host_stub(); |
116 virtual InputStub* input_stub(); | 115 virtual InputStub* input_stub(); |
117 | 116 |
(...skipping 26 matching lines...) Expand all Loading... |
144 | 143 |
145 void NotifyIfChannelsReady(); | 144 void NotifyIfChannelsReady(); |
146 | 145 |
147 void CloseOnError(ErrorCode error); | 146 void CloseOnError(ErrorCode error); |
148 | 147 |
149 // Stops writing in the channels. | 148 // Stops writing in the channels. |
150 void CloseChannels(); | 149 void CloseChannels(); |
151 | 150 |
152 void SetState(State state, ErrorCode error); | 151 void SetState(State state, ErrorCode error); |
153 | 152 |
154 bool allow_nat_traversal_; | |
155 | |
156 std::string host_jid_; | 153 std::string host_jid_; |
157 std::string host_public_key_; | 154 std::string host_public_key_; |
158 scoped_ptr<Authenticator> authenticator_; | 155 scoped_ptr<Authenticator> authenticator_; |
159 | 156 |
160 HostEventCallback* event_callback_; | 157 HostEventCallback* event_callback_; |
161 | 158 |
162 // Stub for incoming messages. | 159 // Stub for incoming messages. |
163 ClientStub* client_stub_; | 160 ClientStub* client_stub_; |
164 ClipboardStub* clipboard_stub_; | 161 ClipboardStub* clipboard_stub_; |
165 AudioStub* audio_stub_; | 162 AudioStub* audio_stub_; |
(...skipping 15 matching lines...) Expand all Loading... |
181 ErrorCode error_; | 178 ErrorCode error_; |
182 | 179 |
183 private: | 180 private: |
184 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 181 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
185 }; | 182 }; |
186 | 183 |
187 } // namespace protocol | 184 } // namespace protocol |
188 } // namespace remoting | 185 } // namespace remoting |
189 | 186 |
190 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 187 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |