OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef REMOTING_PROTOCOL_SESSION_H_ |
6 #define REMOTING_PROTOCOL_SESSION_H_ | 6 #define REMOTING_PROTOCOL_SESSION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace remoting { | 22 namespace remoting { |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
25 // Generic interface for Chromotocol connection used by both client and host. | 25 // Generic interface for Chromotocol connection used by both client and host. |
26 // Provides access to the connection channels, but doesn't depend on the | 26 // Provides access to the connection channels, but doesn't depend on the |
27 // protocol used for each channel. | 27 // protocol used for each channel. |
28 class Session : public base::NonThreadSafe { | 28 class Session : public base::NonThreadSafe { |
29 public: | 29 public: |
30 enum State { | 30 enum State { |
| 31 // Created, but not connecting yet. |
31 INITIALIZING, | 32 INITIALIZING, |
| 33 |
| 34 // Sent or received session-initiate, but haven't sent or received |
| 35 // session-accept. |
32 CONNECTING, | 36 CONNECTING, |
| 37 |
| 38 // Session has been accepted, but channels are connected yet. |
33 CONNECTED, | 39 CONNECTED, |
| 40 |
| 41 // Video and control channels are connected. |
| 42 // TODO(sergeyu): Remove this state. |
| 43 CONNECTED_CHANNELS, |
| 44 |
| 45 // Session has been closed. |
34 CLOSED, | 46 CLOSED, |
| 47 |
| 48 // Connection has failed. |
35 FAILED, | 49 FAILED, |
36 }; | 50 }; |
37 | 51 |
38 typedef Callback1<State>::Type StateChangeCallback; | 52 typedef Callback1<State>::Type StateChangeCallback; |
39 typedef base::Callback<void(const std::string&, net::StreamSocket*)> | 53 typedef base::Callback<void(const std::string&, net::StreamSocket*)> |
40 StreamChannelCallback; | 54 StreamChannelCallback; |
41 typedef base::Callback<void(const std::string&, net::Socket*)> | 55 typedef base::Callback<void(const std::string&, net::Socket*)> |
42 DatagramChannelCallback; | 56 DatagramChannelCallback; |
43 | 57 |
44 Session() { } | 58 Session() { } |
(...skipping 12 matching lines...) Expand all Loading... |
57 // CONNECTED state. | 71 // CONNECTED state. |
58 virtual void CreateStreamChannel( | 72 virtual void CreateStreamChannel( |
59 const std::string& name, const StreamChannelCallback& callback) = 0; | 73 const std::string& name, const StreamChannelCallback& callback) = 0; |
60 virtual void CreateDatagramChannel( | 74 virtual void CreateDatagramChannel( |
61 const std::string& name, const DatagramChannelCallback& callback) = 0; | 75 const std::string& name, const DatagramChannelCallback& callback) = 0; |
62 | 76 |
63 // TODO(sergeyu): Remove these methods, and use CreateChannel() | 77 // TODO(sergeyu): Remove these methods, and use CreateChannel() |
64 // instead. | 78 // instead. |
65 virtual net::Socket* control_channel() = 0; | 79 virtual net::Socket* control_channel() = 0; |
66 virtual net::Socket* event_channel() = 0; | 80 virtual net::Socket* event_channel() = 0; |
67 virtual net::Socket* video_channel() = 0; | |
68 virtual net::Socket* video_rtp_channel() = 0; | |
69 virtual net::Socket* video_rtcp_channel() = 0; | |
70 | 81 |
71 // JID of the other side. | 82 // JID of the other side. |
72 virtual const std::string& jid() = 0; | 83 virtual const std::string& jid() = 0; |
73 | 84 |
74 // Configuration of the protocol that was sent or received in the | 85 // Configuration of the protocol that was sent or received in the |
75 // session-initiate jingle message. Returned pointer is valid until | 86 // session-initiate jingle message. Returned pointer is valid until |
76 // connection is closed. | 87 // connection is closed. |
77 virtual const CandidateSessionConfig* candidate_config() = 0; | 88 virtual const CandidateSessionConfig* candidate_config() = 0; |
78 | 89 |
79 // Protocol configuration. Can be called only after session has been accepted. | 90 // Protocol configuration. Can be called only after session has been accepted. |
(...skipping 22 matching lines...) Expand all Loading... |
102 virtual void Close() = 0; | 113 virtual void Close() = 0; |
103 | 114 |
104 private: | 115 private: |
105 DISALLOW_COPY_AND_ASSIGN(Session); | 116 DISALLOW_COPY_AND_ASSIGN(Session); |
106 }; | 117 }; |
107 | 118 |
108 } // namespace protocol | 119 } // namespace protocol |
109 } // namespace remoting | 120 } // namespace remoting |
110 | 121 |
111 #endif // REMOTING_PROTOCOL_SESSION_H_ | 122 #endif // REMOTING_PROTOCOL_SESSION_H_ |
OLD | NEW |