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

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

Issue 8619011: Use Authenticator interface in Session and SessionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittests Created 9 years 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
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 25 matching lines...) Expand all
36 public cricket::SessionClient { 36 public cricket::SessionClient {
37 public: 37 public:
38 virtual ~JingleSessionManager(); 38 virtual ~JingleSessionManager();
39 39
40 JingleSessionManager(base::MessageLoopProxy* message_loop); 40 JingleSessionManager(base::MessageLoopProxy* message_loop);
41 41
42 // SessionManager interface. 42 // SessionManager interface.
43 virtual void Init(const std::string& local_jid, 43 virtual void Init(const std::string& local_jid,
44 SignalStrategy* signal_strategy, 44 SignalStrategy* signal_strategy,
45 Listener* listener, 45 Listener* listener,
46 crypto::RSAPrivateKey* private_key,
47 const std::string& certificate,
48 bool allow_nat_traversal) OVERRIDE; 46 bool allow_nat_traversal) OVERRIDE;
49 virtual Session* Connect( 47 virtual Session* Connect(
50 const std::string& host_jid, 48 const std::string& host_jid,
51 const std::string& host_public_key, 49 Authenticator* authenticator,
52 const std::string& client_token,
53 CandidateSessionConfig* config, 50 CandidateSessionConfig* config,
54 const Session::StateChangeCallback& state_change_callback) OVERRIDE; 51 const Session::StateChangeCallback& state_change_callback) OVERRIDE;
55 virtual void Close() OVERRIDE; 52 virtual void Close() OVERRIDE;
53 virtual void set_authenticator_factory(
54 AuthenticatorFactory* authenticator_factory) OVERRIDE;
56 55
57 // cricket::SessionClient interface. 56 // cricket::SessionClient interface.
58 virtual void OnSessionCreate(cricket::Session* cricket_session, 57 virtual void OnSessionCreate(cricket::Session* cricket_session,
59 bool received_initiate) OVERRIDE; 58 bool received_initiate) OVERRIDE;
60 virtual void OnSessionDestroy(cricket::Session* cricket_session) OVERRIDE; 59 virtual void OnSessionDestroy(cricket::Session* cricket_session) OVERRIDE;
61 60
62 virtual bool ParseContent(cricket::SignalingProtocol protocol, 61 virtual bool ParseContent(cricket::SignalingProtocol protocol,
63 const buzz::XmlElement* elem, 62 const buzz::XmlElement* elem,
64 const cricket::ContentDescription** content, 63 const cricket::ContentDescription** content,
65 cricket::ParseError* error) OVERRIDE; 64 cricket::ParseError* error) OVERRIDE;
66 virtual bool WriteContent(cricket::SignalingProtocol protocol, 65 virtual bool WriteContent(cricket::SignalingProtocol protocol,
67 const cricket::ContentDescription* content, 66 const cricket::ContentDescription* content,
68 buzz::XmlElement** elem, 67 buzz::XmlElement** elem,
69 cricket::WriteError* error) OVERRIDE; 68 cricket::WriteError* error) OVERRIDE;
70 69
71 private: 70 private:
72 friend class JingleSession; 71 friend class JingleSession;
73 72
74 // Called by JingleSession when a new connection is 73 // Called by JingleSession when a new connection is initiated.
75 // initiated. Returns true if session is accepted. 74 SessionManager::IncomingSessionResponse AcceptConnection(
76 bool AcceptConnection(JingleSession* jingle_session, 75 JingleSession* jingle_session);
77 cricket::Session* cricket_session); 76
77 // Creates authenticator for incoming session. Returns NULL if
78 // authenticator cannot be created, e.g. if |auth_message| is
79 // invalid. Caller reatins ownership of |auth_message| and must
80 // accept ownership of the result.
81 Authenticator* CreateAuthenticator(const std::string& jid,
82 const buzz::XmlElement* auth_message);
78 83
79 // Called by JingleSession when it is being destroyed. 84 // Called by JingleSession when it is being destroyed.
80 void SessionDestroyed(JingleSession* jingle_session); 85 void SessionDestroyed(JingleSession* jingle_session);
81 86
82 // Callback for JingleInfoRequest. 87 // Callback for JingleInfoRequest.
83 void OnJingleInfo( 88 void OnJingleInfo(
84 const std::string& token, 89 const std::string& token,
85 const std::vector<std::string>& relay_hosts, 90 const std::vector<std::string>& relay_hosts,
86 const std::vector<talk_base::SocketAddress>& stun_hosts); 91 const std::vector<talk_base::SocketAddress>& stun_hosts);
87 92
88 // Creates session description for outgoing session.
89 static cricket::SessionDescription* CreateClientSessionDescription(
90 const CandidateSessionConfig* candidate_config,
91 const std::string& auth_token);
92 // Creates session description for incoming session.
93 static cricket::SessionDescription* CreateHostSessionDescription(
94 const CandidateSessionConfig* candidate_config,
95 const std::string& certificate);
96
97 scoped_refptr<base::MessageLoopProxy> message_loop_; 93 scoped_refptr<base::MessageLoopProxy> message_loop_;
98 94
99 scoped_ptr<talk_base::NetworkManager> network_manager_; 95 scoped_ptr<talk_base::NetworkManager> network_manager_;
100 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; 96 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
101 97
102 std::string local_jid_; // Full jid for the local side of the session. 98 std::string local_jid_; // Full jid for the local side of the session.
103 SignalStrategy* signal_strategy_; 99 SignalStrategy* signal_strategy_;
100 scoped_ptr<AuthenticatorFactory> authenticator_factory_;
104 Listener* listener_; 101 Listener* listener_;
105 std::string certificate_;
106 scoped_ptr<crypto::RSAPrivateKey> private_key_;
107 bool allow_nat_traversal_; 102 bool allow_nat_traversal_;
108 103
109 scoped_ptr<cricket::PortAllocator> port_allocator_; 104 scoped_ptr<cricket::PortAllocator> port_allocator_;
110 cricket::HttpPortAllocator* http_port_allocator_; 105 cricket::HttpPortAllocator* http_port_allocator_;
111 scoped_ptr<cricket::SessionManager> cricket_session_manager_; 106 scoped_ptr<cricket::SessionManager> cricket_session_manager_;
112 scoped_ptr<JingleInfoRequest> jingle_info_request_; 107 scoped_ptr<JingleInfoRequest> jingle_info_request_;
113 scoped_ptr<JingleSignalingConnector> jingle_signaling_connector_; 108 scoped_ptr<JingleSignalingConnector> jingle_signaling_connector_;
114 109
115 bool closed_; 110 bool closed_;
116 111
117 std::list<JingleSession*> sessions_; 112 std::list<JingleSession*> sessions_;
118 113
119 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; 114 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_;
120 115
121 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); 116 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager);
122 }; 117 };
123 118
124 } // namespace protocol 119 } // namespace protocol
125 } // namespace remoting 120 } // namespace remoting
126 121
127 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ 122 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698