Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: remoting/protocol/pepper_session_manager.h

Issue 7778022: Chromoting protocol implementation based on P2P Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
18 namespace pp {
19 class Instance;
20 } // namespace pp
21
22 namespace buzz {
23 class XmlElement;
24 } // namespace buzz
25
26 namespace talk_base {
27 class SocketAddress;
28 } // namespace talk_base
29
30 namespace remoting {
31
32 class JingleInfoRequest;
33
34 namespace protocol {
35
36 struct JingleMessage;
37 struct JingleMessageReply;
38 class PepperSession;
39
40 // This class implements SessionClient interface on top of the Pepper
41 // P2P Transport API.
42 class PepperSessionManager : public protocol::SessionManager,
43 public SignalStrategy::Listener {
44 public:
45 explicit PepperSessionManager(pp::Instance* pp_instance);
46 virtual ~PepperSessionManager();
47
48 pp::Instance* pp_instance() { return pp_instance_; }
49
50 // SessionManager interface.
51 virtual void Init(const std::string& local_jid,
52 SignalStrategy* signal_strategy,
53 SessionManager::Listener* listener,
54 crypto::RSAPrivateKey* private_key,
55 const std::string& certificate,
56 bool allow_nat_traversal) OVERRIDE;
57 virtual Session* Connect(
58 const std::string& host_jid,
59 const std::string& host_public_key,
60 const std::string& client_token,
61 CandidateSessionConfig* config,
62 Session::StateChangeCallback* state_change_callback) OVERRIDE;
63 virtual void Close() OVERRIDE;
64
65 // SignalStrategy::Listener interface.
66 virtual bool OnIncomingStanza(const buzz::XmlElement* stanza) OVERRIDE;
67
68 private:
69 friend class PepperSession;
70
71 typedef std::map<std::string, PepperSession*> SessionsMap;
72
73 void OnJingleInfo(
74 const std::string& relay_token,
75 const std::vector<std::string>& relay_hosts,
76 const std::vector<talk_base::SocketAddress>& stun_hosts);
77
78 IqRequest* CreateIqRequest();
79 void SendReply(const buzz::XmlElement* original_stanza,
Wez 2011/09/01 01:08:29 Should this be JingleMessage?
Sergey Ulanov 2011/09/08 00:48:36 No. Original XML is needed so that it can be added
80 const JingleMessageReply& reply);
81
82 // Called by PepperSession when it is being destroyed.
83 void SessionDestroyed(PepperSession* session);
84
85 pp::Instance* pp_instance_;
86
87 std::string local_jid_;
88 SignalStrategy* signal_strategy_;
89 SessionManager::Listener* listener_;
90 scoped_ptr<crypto::RSAPrivateKey> private_key_;
91 std::string certificate_;
92 bool allow_nat_traversal_;
93
94 PepperChannel::TransportConfig transport_config_;
95
96 scoped_ptr<JingleInfoRequest> jingle_info_request_;
97
98 SessionsMap sessions_;
99
100 DISALLOW_COPY_AND_ASSIGN(PepperSessionManager);
101 };
102
103 } // namespace protocol
104 } // namespace remoting
105
106 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698