| 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 20 matching lines...) Expand all Loading... |
| 31 class Session : public base::NonThreadSafe { | 31 class Session : public base::NonThreadSafe { |
| 32 public: | 32 public: |
| 33 enum State { | 33 enum State { |
| 34 // Created, but not connecting yet. | 34 // Created, but not connecting yet. |
| 35 INITIALIZING, | 35 INITIALIZING, |
| 36 | 36 |
| 37 // Sent or received session-initiate, but haven't sent or received | 37 // Sent or received session-initiate, but haven't sent or received |
| 38 // session-accept. | 38 // session-accept. |
| 39 CONNECTING, | 39 CONNECTING, |
| 40 | 40 |
| 41 // Session has been accepted, but channels are connected yet. | 41 // Session has been accepted. |
| 42 CONNECTED, | 42 CONNECTED, |
| 43 | 43 |
| 44 // Session has been closed. | 44 // Session has been closed. |
| 45 CLOSED, | 45 CLOSED, |
| 46 | 46 |
| 47 // Connection has failed. | 47 // Connection has failed. |
| 48 FAILED, | 48 FAILED, |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // TODO(sergeyu): Move error codes to a separate file. | 51 // TODO(sergeyu): Move error codes to a separate file. |
| 52 enum Error { | 52 enum Error { |
| 53 OK = 0, | 53 OK = 0, |
| 54 PEER_IS_OFFLINE, | 54 PEER_IS_OFFLINE, |
| 55 SESSION_REJECTED, | 55 SESSION_REJECTED, |
| 56 INCOMPATIBLE_PROTOCOL, | 56 INCOMPATIBLE_PROTOCOL, |
| 57 AUTHENTICATION_FAILED, |
| 57 CHANNEL_CONNECTION_ERROR, | 58 CHANNEL_CONNECTION_ERROR, |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 typedef base::Callback<void(State)> StateChangeCallback; | 61 typedef base::Callback<void(State)> StateChangeCallback; |
| 61 | 62 |
| 62 // TODO(sergeyu): Specify connection error code when channel | 63 // TODO(sergeyu): Specify connection error code when channel |
| 63 // connection fails. | 64 // connection fails. |
| 64 typedef base::Callback<void(net::StreamSocket*)> StreamChannelCallback; | 65 typedef base::Callback<void(net::StreamSocket*)> StreamChannelCallback; |
| 65 typedef base::Callback<void(net::Socket*)> DatagramChannelCallback; | 66 typedef base::Callback<void(net::Socket*)> DatagramChannelCallback; |
| 66 | 67 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 virtual void Close() = 0; | 125 virtual void Close() = 0; |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 DISALLOW_COPY_AND_ASSIGN(Session); | 128 DISALLOW_COPY_AND_ASSIGN(Session); |
| 128 }; | 129 }; |
| 129 | 130 |
| 130 } // namespace protocol | 131 } // namespace protocol |
| 131 } // namespace remoting | 132 } // namespace remoting |
| 132 | 133 |
| 133 #endif // REMOTING_PROTOCOL_SESSION_H_ | 134 #endif // REMOTING_PROTOCOL_SESSION_H_ |
| OLD | NEW |