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_JINGLE_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/timer.h" | 13 #include "base/timer.h" |
14 #include "crypto/rsa_private_key.h" | 14 #include "crypto/rsa_private_key.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "remoting/jingle_glue/iq_sender.h" | 16 #include "remoting/jingle_glue/iq_sender.h" |
17 #include "remoting/protocol/authenticator.h" | 17 #include "remoting/protocol/authenticator.h" |
| 18 #include "remoting/protocol/channel_factory.h" |
18 #include "remoting/protocol/jingle_messages.h" | 19 #include "remoting/protocol/jingle_messages.h" |
19 #include "remoting/protocol/session.h" | 20 #include "remoting/protocol/session.h" |
20 #include "remoting/protocol/session_config.h" | 21 #include "remoting/protocol/session_config.h" |
21 #include "remoting/protocol/transport.h" | 22 #include "remoting/protocol/transport.h" |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 class Socket; | 25 class Socket; |
25 class StreamSocket; | 26 class StreamSocket; |
26 } // namespace net | 27 } // namespace net |
27 | 28 |
28 namespace remoting { | 29 namespace remoting { |
29 namespace protocol { | 30 namespace protocol { |
30 | 31 |
| 32 class ChannelMultiplexer; |
31 class JingleSessionManager; | 33 class JingleSessionManager; |
32 | 34 |
33 // JingleSessionManager and JingleSession implement the subset of the | 35 // JingleSessionManager and JingleSession implement the subset of the |
34 // Jingle protocol used in Chromoting. Instances of this class are | 36 // Jingle protocol used in Chromoting. Instances of this class are |
35 // created by the JingleSessionManager. | 37 // created by the JingleSessionManager. |
36 class JingleSession : public Session, | 38 class JingleSession : public Session, |
| 39 public ChannelFactory, |
37 public Transport::EventHandler { | 40 public Transport::EventHandler { |
38 public: | 41 public: |
39 virtual ~JingleSession(); | 42 virtual ~JingleSession(); |
40 | 43 |
41 // Session interface. | 44 // Session interface. |
42 virtual void SetEventHandler(Session::EventHandler* event_handler) OVERRIDE; | 45 virtual void SetEventHandler(Session::EventHandler* event_handler) OVERRIDE; |
43 virtual ErrorCode error() OVERRIDE; | 46 virtual ErrorCode error() OVERRIDE; |
| 47 virtual const std::string& jid() OVERRIDE; |
| 48 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; |
| 49 virtual const SessionConfig& config() OVERRIDE; |
| 50 virtual void set_config(const SessionConfig& config) OVERRIDE; |
| 51 virtual ChannelFactory* GetTransportChannelFactory() OVERRIDE; |
| 52 virtual ChannelFactory* GetMultiplexedChannelFactory() OVERRIDE; |
| 53 virtual void Close() OVERRIDE; |
| 54 |
| 55 // ChannelFactory interface. |
44 virtual void CreateStreamChannel( | 56 virtual void CreateStreamChannel( |
45 const std::string& name, | 57 const std::string& name, |
46 const StreamChannelCallback& callback) OVERRIDE; | 58 const StreamChannelCallback& callback) OVERRIDE; |
47 virtual void CreateDatagramChannel( | 59 virtual void CreateDatagramChannel( |
48 const std::string& name, | 60 const std::string& name, |
49 const DatagramChannelCallback& callback) OVERRIDE; | 61 const DatagramChannelCallback& callback) OVERRIDE; |
50 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; | 62 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; |
51 virtual const std::string& jid() OVERRIDE; | |
52 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; | |
53 virtual const SessionConfig& config() OVERRIDE; | |
54 virtual void set_config(const SessionConfig& config) OVERRIDE; | |
55 virtual void Close() OVERRIDE; | |
56 | 63 |
57 // Transport::EventHandler interface. | 64 // Transport::EventHandler interface. |
58 virtual void OnTransportCandidate( | 65 virtual void OnTransportCandidate( |
59 Transport* transport, | 66 Transport* transport, |
60 const cricket::Candidate& candidate) OVERRIDE; | 67 const cricket::Candidate& candidate) OVERRIDE; |
61 virtual void OnTransportRouteChange(Transport* transport, | 68 virtual void OnTransportRouteChange(Transport* transport, |
62 const TransportRoute& route) OVERRIDE; | 69 const TransportRoute& route) OVERRIDE; |
63 virtual void OnTransportReady(Transport* transport, | 70 virtual void OnTransportReady(Transport* transport, |
64 bool ready) OVERRIDE; | 71 bool ready) OVERRIDE; |
65 virtual void OnTransportDeleted(Transport* transport) OVERRIDE; | 72 virtual void OnTransportDeleted(Transport* transport) OVERRIDE; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool config_is_set_; | 142 bool config_is_set_; |
136 | 143 |
137 scoped_ptr<Authenticator> authenticator_; | 144 scoped_ptr<Authenticator> authenticator_; |
138 | 145 |
139 // Container for pending Iq requests. Requests are removed in | 146 // Container for pending Iq requests. Requests are removed in |
140 // CleanupPendingRequests() which is called when a response is | 147 // CleanupPendingRequests() which is called when a response is |
141 // received or one of the requests times out. | 148 // received or one of the requests times out. |
142 std::list<IqRequest*> pending_requests_; | 149 std::list<IqRequest*> pending_requests_; |
143 | 150 |
144 ChannelsMap channels_; | 151 ChannelsMap channels_; |
| 152 scoped_ptr<ChannelMultiplexer> channel_multiplexer_; |
145 | 153 |
146 base::OneShotTimer<JingleSession> transport_infos_timer_; | 154 base::OneShotTimer<JingleSession> transport_infos_timer_; |
147 std::list<JingleMessage::NamedCandidate> pending_candidates_; | 155 std::list<JingleMessage::NamedCandidate> pending_candidates_; |
148 | 156 |
149 DISALLOW_COPY_AND_ASSIGN(JingleSession); | 157 DISALLOW_COPY_AND_ASSIGN(JingleSession); |
150 }; | 158 }; |
151 | 159 |
152 } // namespace protocol | 160 } // namespace protocol |
153 } // namespace remoting | 161 } // namespace remoting |
154 | 162 |
155 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 163 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
OLD | NEW |