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_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" |
11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
12 #include "remoting/protocol/buffered_socket_writer.h" | 12 #include "remoting/protocol/buffered_socket_writer.h" |
13 #include "remoting/protocol/errors.h" | 13 #include "remoting/protocol/errors.h" |
14 #include "remoting/protocol/session_config.h" | 14 #include "remoting/protocol/session_config.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class IPEndPoint; | 17 class IPEndPoint; |
18 class Socket; | 18 class Socket; |
19 class StreamSocket; | 19 class StreamSocket; |
20 } // namespace net | 20 } // namespace net |
21 | 21 |
22 namespace remoting { | 22 namespace remoting { |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
| 25 struct TransportRoute; |
| 26 |
25 // Generic interface for Chromotocol connection used by both client and host. | 27 // Generic interface for Chromotocol connection used by both client and host. |
26 // Provides access to the connection channels, but doesn't depend on the | 28 // Provides access to the connection channels, but doesn't depend on the |
27 // protocol used for each channel. | 29 // protocol used for each channel. |
28 // | 30 // |
29 // Because libjingle's sigslot class doesn't handle deletion properly | 31 // Because libjingle's sigslot class doesn't handle deletion properly |
30 // while it is being invoked all Session instances must be deleted | 32 // while it is being invoked all Session instances must be deleted |
31 // with a clean stack, i.e. not from event handlers, when sigslot may | 33 // with a clean stack, i.e. not from event handlers, when sigslot may |
32 // be present in the stack. | 34 // be present in the stack. |
33 class Session : public base::NonThreadSafe { | 35 class Session : public base::NonThreadSafe { |
34 public: | 36 public: |
(...skipping 21 matching lines...) Expand all Loading... |
56 | 58 |
57 // State change callbacks are called after session state has | 59 // State change callbacks are called after session state has |
58 // changed. It is not safe to destroy the session from within the | 60 // changed. It is not safe to destroy the session from within the |
59 // handler unless |state| is CLOSED or FAILED. | 61 // handler unless |state| is CLOSED or FAILED. |
60 typedef base::Callback<void(State state)> StateChangeCallback; | 62 typedef base::Callback<void(State state)> StateChangeCallback; |
61 | 63 |
62 // TODO(lambroslambrou): Merge this together with StateChangeCallback into a | 64 // TODO(lambroslambrou): Merge this together with StateChangeCallback into a |
63 // single interface. | 65 // single interface. |
64 typedef base::Callback<void( | 66 typedef base::Callback<void( |
65 const std::string& channel_name, | 67 const std::string& channel_name, |
66 const net::IPEndPoint& remote_end_point, | 68 const TransportRoute& route)> RouteChangeCallback; |
67 const net::IPEndPoint& local_end_point)> RouteChangeCallback; | |
68 | 69 |
69 // TODO(sergeyu): Specify connection error code when channel | 70 // TODO(sergeyu): Specify connection error code when channel |
70 // connection fails. | 71 // connection fails. |
71 typedef base::Callback<void(scoped_ptr<net::StreamSocket>)> | 72 typedef base::Callback<void(scoped_ptr<net::StreamSocket>)> |
72 StreamChannelCallback; | 73 StreamChannelCallback; |
73 typedef base::Callback<void(scoped_ptr<net::Socket>)> | 74 typedef base::Callback<void(scoped_ptr<net::Socket>)> |
74 DatagramChannelCallback; | 75 DatagramChannelCallback; |
75 | 76 |
76 Session() { } | 77 Session() { } |
77 virtual ~Session() { } | 78 virtual ~Session() { } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 virtual void Close() = 0; | 128 virtual void Close() = 0; |
128 | 129 |
129 private: | 130 private: |
130 DISALLOW_COPY_AND_ASSIGN(Session); | 131 DISALLOW_COPY_AND_ASSIGN(Session); |
131 }; | 132 }; |
132 | 133 |
133 } // namespace protocol | 134 } // namespace protocol |
134 } // namespace remoting | 135 } // namespace remoting |
135 | 136 |
136 #endif // REMOTING_PROTOCOL_SESSION_H_ | 137 #endif // REMOTING_PROTOCOL_SESSION_H_ |
OLD | NEW |