| 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_JINGLE_SESSION_MANAGER_H_ | 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
| 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "remoting/protocol/content_description.h" | 12 #include "remoting/protocol/content_description.h" |
| 13 #include "remoting/protocol/jingle_session.h" | 13 #include "remoting/protocol/jingle_session.h" |
| 14 #include "remoting/protocol/session_manager.h" | 14 #include "remoting/protocol/session_manager.h" |
| 15 #include "third_party/libjingle/source/talk/p2p/base/session.h" | 15 #include "third_party/libjingle/source/talk/p2p/base/session.h" |
| 16 #include "third_party/libjingle/source/talk/p2p/base/sessionclient.h" | 16 #include "third_party/libjingle/source/talk/p2p/base/sessionclient.h" |
| 17 | 17 |
| 18 namespace cricket { | 18 namespace cricket { |
| 19 class PortAllocator; | 19 class PortAllocator; |
| 20 class SessionManager; | 20 class SessionManager; |
| 21 } // namespace cricket | 21 } // namespace cricket |
| 22 | 22 |
| 23 namespace remoting { | 23 namespace remoting { |
| 24 | 24 |
| 25 class HostAddressResolver; |
| 25 class HttpPortAllocator; | 26 class HttpPortAllocator; |
| 26 class JingleInfoRequest; | 27 class JingleInfoRequest; |
| 27 class JingleSignalingConnector; | 28 class JingleSignalingConnector; |
| 28 class PortAllocatorSessionFactory; | 29 class PortAllocatorSessionFactory; |
| 29 | 30 |
| 30 namespace protocol { | 31 namespace protocol { |
| 31 | 32 |
| 32 // This class implements SessionClient for Chromoting sessions. It acts as a | 33 // This class implements SessionClient for Chromoting sessions. It acts as a |
| 33 // server that accepts chromoting connections and can also make new connections | 34 // server that accepts chromoting connections and can also make new connections |
| 34 // to other hosts. | 35 // to other hosts. |
| 35 class JingleSessionManager | 36 class JingleSessionManager |
| 36 : public SessionManager, | 37 : public SessionManager, |
| 37 public cricket::SessionClient { | 38 public cricket::SessionClient { |
| 38 public: | 39 public: |
| 39 virtual ~JingleSessionManager(); | 40 virtual ~JingleSessionManager(); |
| 40 | 41 |
| 41 static JingleSessionManager* CreateNotSandboxed(); | 42 static JingleSessionManager* CreateNotSandboxed(); |
| 42 static JingleSessionManager* CreateSandboxed( | 43 static JingleSessionManager* CreateSandboxed( |
| 43 talk_base::NetworkManager* network_manager, | 44 talk_base::NetworkManager* network_manager, |
| 44 talk_base::PacketSocketFactory* socket_factory, | 45 talk_base::PacketSocketFactory* socket_factory, |
| 46 HostAddressResolver* host_address_resolver, |
| 45 PortAllocatorSessionFactory* port_allocator_session_factory); | 47 PortAllocatorSessionFactory* port_allocator_session_factory); |
| 46 | 48 |
| 47 // SessionManager interface. | 49 // SessionManager interface. |
| 48 virtual void Init(const std::string& local_jid, | 50 virtual void Init(const std::string& local_jid, |
| 49 SignalStrategy* signal_strategy, | 51 SignalStrategy* signal_strategy, |
| 50 Listener* listener, | 52 Listener* listener, |
| 51 crypto::RSAPrivateKey* private_key, | 53 crypto::RSAPrivateKey* private_key, |
| 52 const std::string& certificate, | 54 const std::string& certificate, |
| 53 bool allow_nat_traversal) OVERRIDE; | 55 bool allow_nat_traversal) OVERRIDE; |
| 54 virtual Session* Connect( | 56 virtual Session* Connect( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 const cricket::ContentDescription* content, | 76 const cricket::ContentDescription* content, |
| 75 buzz::XmlElement** elem, | 77 buzz::XmlElement** elem, |
| 76 cricket::WriteError* error) OVERRIDE; | 78 cricket::WriteError* error) OVERRIDE; |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 friend class JingleSession; | 81 friend class JingleSession; |
| 80 | 82 |
| 81 JingleSessionManager( | 83 JingleSessionManager( |
| 82 talk_base::NetworkManager* network_manager, | 84 talk_base::NetworkManager* network_manager, |
| 83 talk_base::PacketSocketFactory* socket_factory, | 85 talk_base::PacketSocketFactory* socket_factory, |
| 86 HostAddressResolver* host_address_resolver, |
| 84 PortAllocatorSessionFactory* port_allocator_session_factory); | 87 PortAllocatorSessionFactory* port_allocator_session_factory); |
| 85 | 88 |
| 86 // Called by JingleSession when a new connection is | 89 // Called by JingleSession when a new connection is |
| 87 // initiated. Returns true if session is accepted. | 90 // initiated. Returns true if session is accepted. |
| 88 bool AcceptConnection(JingleSession* jingle_session, | 91 bool AcceptConnection(JingleSession* jingle_session, |
| 89 cricket::Session* cricket_session); | 92 cricket::Session* cricket_session); |
| 90 | 93 |
| 91 // Called by JingleSession when it is being destroyed. | 94 // Called by JingleSession when it is being destroyed. |
| 92 void SessionDestroyed(JingleSession* jingle_session); | 95 void SessionDestroyed(JingleSession* jingle_session); |
| 93 | 96 |
| 94 // Callback for JingleInfoRequest. | 97 // Callback for JingleInfoRequest. |
| 95 void OnJingleInfo( | 98 void OnJingleInfo( |
| 96 const std::string& token, | 99 const std::string& token, |
| 97 const std::vector<std::string>& relay_hosts, | 100 const std::vector<std::string>& relay_hosts, |
| 98 const std::vector<talk_base::SocketAddress>& stun_hosts); | 101 const std::vector<talk_base::SocketAddress>& stun_hosts); |
| 99 | 102 |
| 100 // Creates session description for outgoing session. | 103 // Creates session description for outgoing session. |
| 101 static cricket::SessionDescription* CreateClientSessionDescription( | 104 static cricket::SessionDescription* CreateClientSessionDescription( |
| 102 const CandidateSessionConfig* candidate_config, | 105 const CandidateSessionConfig* candidate_config, |
| 103 const std::string& auth_token, | 106 const std::string& auth_token, |
| 104 const std::string& master_key); | 107 const std::string& master_key); |
| 105 // Creates session description for incoming session. | 108 // Creates session description for incoming session. |
| 106 static cricket::SessionDescription* CreateHostSessionDescription( | 109 static cricket::SessionDescription* CreateHostSessionDescription( |
| 107 const CandidateSessionConfig* candidate_config, | 110 const CandidateSessionConfig* candidate_config, |
| 108 const std::string& certificate); | 111 const std::string& certificate); |
| 109 | 112 |
| 110 scoped_ptr<talk_base::NetworkManager> network_manager_; | 113 scoped_ptr<talk_base::NetworkManager> network_manager_; |
| 111 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 114 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
| 115 scoped_ptr<HostAddressResolver> host_address_resolver_; |
| 112 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | 116 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; |
| 113 | 117 |
| 114 std::string local_jid_; // Full jid for the local side of the session. | 118 std::string local_jid_; // Full jid for the local side of the session. |
| 115 SignalStrategy* signal_strategy_; | 119 SignalStrategy* signal_strategy_; |
| 116 Listener* listener_; | 120 Listener* listener_; |
| 117 std::string certificate_; | 121 std::string certificate_; |
| 118 scoped_ptr<crypto::RSAPrivateKey> private_key_; | 122 scoped_ptr<crypto::RSAPrivateKey> private_key_; |
| 119 bool allow_nat_traversal_; | 123 bool allow_nat_traversal_; |
| 120 | 124 |
| 121 bool allow_local_ips_; | 125 bool allow_local_ips_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 | 136 |
| 133 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; | 137 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; |
| 134 | 138 |
| 135 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); | 139 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); |
| 136 }; | 140 }; |
| 137 | 141 |
| 138 } // namespace protocol | 142 } // namespace protocol |
| 139 } // namespace remoting | 143 } // namespace remoting |
| 140 | 144 |
| 141 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 145 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
| OLD | NEW |