| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
| 6 #define REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <list> |
| 10 #include <string> |
| 11 |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "net/base/x509_certificate.h" |
| 14 #include "remoting/jingle_glue/signal_strategy.h" |
| 15 #include "remoting/protocol/pepper_channel.h" |
| 16 #include "remoting/protocol/session_manager.h" |
| 17 #include "remoting/protocol/transport_config.h" |
| 18 |
| 19 namespace pp { |
| 20 class Instance; |
| 21 } // namespace pp |
| 22 |
| 23 namespace buzz { |
| 24 class XmlElement; |
| 25 } // namespace buzz |
| 26 |
| 27 namespace talk_base { |
| 28 class SocketAddress; |
| 29 } // namespace talk_base |
| 30 |
| 31 namespace remoting { |
| 32 |
| 33 class JingleInfoRequest; |
| 34 |
| 35 namespace protocol { |
| 36 |
| 37 struct JingleMessage; |
| 38 struct JingleMessageReply; |
| 39 class PepperSession; |
| 40 |
| 41 // This class implements SessionManager interface on top of the Pepper |
| 42 // P2P Transport API. |
| 43 class PepperSessionManager : public SessionManager, |
| 44 public SignalStrategy::Listener { |
| 45 public: |
| 46 explicit PepperSessionManager(pp::Instance* pp_instance); |
| 47 virtual ~PepperSessionManager(); |
| 48 |
| 49 // SessionManager interface. |
| 50 virtual void Init(const std::string& local_jid, |
| 51 SignalStrategy* signal_strategy, |
| 52 SessionManager::Listener* listener, |
| 53 crypto::RSAPrivateKey* private_key, |
| 54 const std::string& certificate, |
| 55 bool allow_nat_traversal) OVERRIDE; |
| 56 virtual Session* Connect( |
| 57 const std::string& host_jid, |
| 58 const std::string& host_public_key, |
| 59 const std::string& client_token, |
| 60 CandidateSessionConfig* config, |
| 61 Session::StateChangeCallback* state_change_callback) OVERRIDE; |
| 62 virtual void Close() OVERRIDE; |
| 63 |
| 64 // SignalStrategy::Listener interface. |
| 65 virtual bool OnIncomingStanza(const buzz::XmlElement* stanza) OVERRIDE; |
| 66 |
| 67 private: |
| 68 friend class PepperSession; |
| 69 |
| 70 typedef std::map<std::string, PepperSession*> SessionsMap; |
| 71 |
| 72 void OnJingleInfo( |
| 73 const std::string& relay_token, |
| 74 const std::vector<std::string>& relay_hosts, |
| 75 const std::vector<talk_base::SocketAddress>& stun_hosts); |
| 76 |
| 77 IqRequest* CreateIqRequest(); |
| 78 void SendReply(const buzz::XmlElement* original_stanza, |
| 79 const JingleMessageReply& reply); |
| 80 |
| 81 // Called by PepperSession when it is being destroyed. |
| 82 void SessionDestroyed(PepperSession* session); |
| 83 |
| 84 pp::Instance* pp_instance_; |
| 85 |
| 86 std::string local_jid_; |
| 87 SignalStrategy* signal_strategy_; |
| 88 SessionManager::Listener* listener_; |
| 89 scoped_ptr<crypto::RSAPrivateKey> private_key_; |
| 90 std::string certificate_; |
| 91 bool allow_nat_traversal_; |
| 92 |
| 93 TransportConfig transport_config_; |
| 94 |
| 95 scoped_ptr<JingleInfoRequest> jingle_info_request_; |
| 96 |
| 97 SessionsMap sessions_; |
| 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(PepperSessionManager); |
| 100 }; |
| 101 |
| 102 } // namespace protocol |
| 103 } // namespace remoting |
| 104 |
| 105 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
| OLD | NEW |