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" |
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/session_config.h" | 13 #include "remoting/protocol/session_config.h" |
14 | 14 |
15 class Task; | 15 class Task; |
16 | 16 |
17 namespace net { | 17 namespace net { |
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 // 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 // | |
29 // Because libjingle's sigslot class doesn't handle deletion properly | |
30 // while it is being invoked all Session instances must be deleted | |
31 // with clean stack, i.e. not from event handlers, when sigslot may be | |
Wez
2011/11/09 02:32:22
nit: with _a_ clean stack.
Sergey Ulanov
2011/11/09 21:24:00
Done.
| |
32 // present in the stack. | |
28 class Session : public base::NonThreadSafe { | 33 class Session : public base::NonThreadSafe { |
29 public: | 34 public: |
30 enum State { | 35 enum State { |
31 // Created, but not connecting yet. | 36 // Created, but not connecting yet. |
32 INITIALIZING, | 37 INITIALIZING, |
33 | 38 |
34 // Sent or received session-initiate, but haven't sent or received | 39 // Sent or received session-initiate, but haven't sent or received |
35 // session-accept. | 40 // session-accept. |
36 CONNECTING, | 41 CONNECTING, |
37 | 42 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 virtual const std::string& initiator_token() = 0; | 118 virtual const std::string& initiator_token() = 0; |
114 virtual void set_initiator_token(const std::string& initiator_token) = 0; | 119 virtual void set_initiator_token(const std::string& initiator_token) = 0; |
115 virtual const std::string& receiver_token() = 0; | 120 virtual const std::string& receiver_token() = 0; |
116 virtual void set_receiver_token(const std::string& receiver_token) = 0; | 121 virtual void set_receiver_token(const std::string& receiver_token) = 0; |
117 | 122 |
118 // A shared secret to use to mutually-authenticate the SSL channels. | 123 // A shared secret to use to mutually-authenticate the SSL channels. |
119 virtual void set_shared_secret(const std::string& secret) = 0; | 124 virtual void set_shared_secret(const std::string& secret) = 0; |
120 virtual const std::string& shared_secret() = 0; | 125 virtual const std::string& shared_secret() = 0; |
121 | 126 |
122 // Closes connection. Callbacks are guaranteed not to be called | 127 // Closes connection. Callbacks are guaranteed not to be called |
123 // after this method returns. Must be called before the object is | 128 // after this method is called. |
Wez
2011/11/09 02:32:22
nit: after this method returns?
Sergey Ulanov
2011/11/09 21:24:00
No - callback is not expected during this call. Pr
Wez
2011/11/09 23:18:45
OK, I think it's clearer to say "from the moment t
Sergey Ulanov
2011/11/10 21:06:14
Reverted behavior of this method and this comment.
| |
124 // destroyed, unless the state is set to FAILED or CLOSED. | |
125 virtual void Close() = 0; | 129 virtual void Close() = 0; |
126 | 130 |
127 private: | 131 private: |
128 DISALLOW_COPY_AND_ASSIGN(Session); | 132 DISALLOW_COPY_AND_ASSIGN(Session); |
129 }; | 133 }; |
130 | 134 |
131 } // namespace protocol | 135 } // namespace protocol |
132 } // namespace remoting | 136 } // namespace remoting |
133 | 137 |
134 #endif // REMOTING_PROTOCOL_SESSION_H_ | 138 #endif // REMOTING_PROTOCOL_SESSION_H_ |
OLD | NEW |