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

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

Issue 8619011: Use Authenticator interface in Session and SessionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month 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
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_PEPPER_SESSION_H_ 5 #ifndef REMOTING_PROTOCOL_PEPPER_SESSION_H_
6 #define REMOTING_PROTOCOL_PEPPER_SESSION_H_ 6 #define REMOTING_PROTOCOL_PEPPER_SESSION_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 class Socket; 21 class Socket;
22 class StreamSocket; 22 class StreamSocket;
23 } // namespace net 23 } // namespace net
24 24
25 namespace remoting { 25 namespace remoting {
26 26
27 class IqRequest; 27 class IqRequest;
28 28
29 namespace protocol { 29 namespace protocol {
30 30
31 class Authenticator;
31 class PepperChannel; 32 class PepperChannel;
32 class PepperSessionManager; 33 class PepperSessionManager;
33 34
34 // Implements the protocol::Session interface using the Pepper P2P 35 // Implements the protocol::Session interface using the Pepper P2P
35 // Transport API. Created by PepperSessionManager for incoming and 36 // Transport API. Created by PepperSessionManager for incoming and
36 // outgoing connections. 37 // outgoing connections.
37 class PepperSession : public Session { 38 class PepperSession : public Session {
38 public: 39 public:
39 virtual ~PepperSession(); 40 virtual ~PepperSession();
40 41
41 // Session interface. 42 // Session interface.
42 virtual void SetStateChangeCallback( 43 virtual void SetStateChangeCallback(
43 const StateChangeCallback& callback) OVERRIDE; 44 const StateChangeCallback& callback) OVERRIDE;
44 virtual Error error() OVERRIDE; 45 virtual Error error() OVERRIDE;
45 virtual void CreateStreamChannel( 46 virtual void CreateStreamChannel(
46 const std::string& name, 47 const std::string& name,
47 const StreamChannelCallback& callback) OVERRIDE; 48 const StreamChannelCallback& callback) OVERRIDE;
48 virtual void CreateDatagramChannel( 49 virtual void CreateDatagramChannel(
49 const std::string& name, 50 const std::string& name,
50 const DatagramChannelCallback& callback) OVERRIDE; 51 const DatagramChannelCallback& callback) OVERRIDE;
51 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; 52 virtual void CancelChannelCreation(const std::string& name) OVERRIDE;
52 virtual const std::string& jid() OVERRIDE; 53 virtual const std::string& jid() OVERRIDE;
53 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; 54 virtual const CandidateSessionConfig* candidate_config() OVERRIDE;
54 virtual const SessionConfig& config() OVERRIDE; 55 virtual const SessionConfig& config() OVERRIDE;
55 virtual void set_config(const SessionConfig& config) OVERRIDE; 56 virtual void set_config(const SessionConfig& config) OVERRIDE;
56 virtual const std::string& initiator_token() OVERRIDE;
57 virtual void set_initiator_token(const std::string& initiator_token) OVERRIDE;
58 virtual const std::string& receiver_token() OVERRIDE;
59 virtual void set_receiver_token(const std::string& receiver_token) OVERRIDE;
60 virtual void set_shared_secret(const std::string& secret) OVERRIDE;
61 virtual const std::string& shared_secret() OVERRIDE;
62 virtual void Close() OVERRIDE; 57 virtual void Close() OVERRIDE;
63 58
64 private: 59 private:
65 friend class PepperSessionManager; 60 friend class PepperSessionManager;
66 friend class PepperStreamChannel; 61 friend class PepperStreamChannel;
67 62
68 typedef std::map<std::string, PepperChannel*> ChannelsMap; 63 typedef std::map<std::string, PepperChannel*> ChannelsMap;
69 64
70 explicit PepperSession(PepperSessionManager* session_manager); 65 explicit PepperSession(PepperSessionManager* session_manager);
71 66
72 // Start cs connection by sending session-initiate message. 67 // Start cs connection by sending session-initiate message.
73 void StartConnection(const std::string& peer_jid, 68 void StartConnection(const std::string& peer_jid,
74 const std::string& peer_public_key, 69 Authenticator* authenticator,
75 const std::string& client_token,
76 CandidateSessionConfig* config, 70 CandidateSessionConfig* config,
77 const StateChangeCallback& state_change_callback); 71 const StateChangeCallback& state_change_callback);
78 72
79 // Handler for session-initiate response. 73 // Handler for session-initiate response.
80 void OnSessionInitiateResponse(const buzz::XmlElement* response); 74 void OnSessionInitiateResponse(const buzz::XmlElement* response);
81 75
82 // Called when an error occurs. Sets |error_| and closes the session. 76 // Called when an error occurs. Sets |error_| and closes the session.
83 void OnError(Error error); 77 void OnError(Error error);
84 78
85 // Called by PepperSessionManager on incoming |message|. Must fill 79 // Called by PepperSessionManager on incoming |message|. Must fill
(...skipping 17 matching lines...) Expand all
103 void OnTransportInfoResponse(const buzz::XmlElement* response); 97 void OnTransportInfoResponse(const buzz::XmlElement* response);
104 98
105 // Close all the channels and terminate the session. 99 // Close all the channels and terminate the session.
106 void CloseInternal(bool failed); 100 void CloseInternal(bool failed);
107 101
108 // Sets |state_| to |new_state| and calls state change callback. 102 // Sets |state_| to |new_state| and calls state change callback.
109 void SetState(State new_state); 103 void SetState(State new_state);
110 104
111 PepperSessionManager* session_manager_; 105 PepperSessionManager* session_manager_;
112 std::string peer_jid_; 106 std::string peer_jid_;
113 std::string peer_public_key_;
114 scoped_ptr<CandidateSessionConfig> candidate_config_; 107 scoped_ptr<CandidateSessionConfig> candidate_config_;
115 StateChangeCallback state_change_callback_; 108 StateChangeCallback state_change_callback_;
116 109
117 std::string session_id_; 110 std::string session_id_;
118 State state_; 111 State state_;
119 Error error_; 112 Error error_;
120 113
121 std::string remote_cert_;
122 SessionConfig config_; 114 SessionConfig config_;
123 115
124 std::string shared_secret_; 116 scoped_ptr<Authenticator> authenticator_;
125 std::string initiator_token_;
126 std::string receiver_token_;
127 117
128 scoped_ptr<IqRequest> initiate_request_; 118 scoped_ptr<IqRequest> initiate_request_;
129 scoped_ptr<IqRequest> transport_info_request_; 119 scoped_ptr<IqRequest> transport_info_request_;
130 120
131 ChannelsMap channels_; 121 ChannelsMap channels_;
132 122
133 base::OneShotTimer<PepperSession> transport_infos_timer_; 123 base::OneShotTimer<PepperSession> transport_infos_timer_;
134 std::list<cricket::Candidate> pending_candidates_; 124 std::list<cricket::Candidate> pending_candidates_;
135 125
136 DISALLOW_COPY_AND_ASSIGN(PepperSession); 126 DISALLOW_COPY_AND_ASSIGN(PepperSession);
137 }; 127 };
138 128
139 } // namespace protocol 129 } // namespace protocol
140 } // namespace remoting 130 } // namespace remoting
141 131
142 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_H_ 132 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698