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/jingle_session.h

Issue 1099203005: Revert of Use standard ICE in Chromoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « remoting/protocol/jingle_messages_unittest.cc ('k') | remoting/protocol/jingle_session.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_H_ 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_
6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public Transport::EventHandler { 44 public Transport::EventHandler {
45 public: 45 public:
46 ~JingleSession() override; 46 ~JingleSession() override;
47 47
48 // Session interface. 48 // Session interface.
49 void SetEventHandler(Session::EventHandler* event_handler) override; 49 void SetEventHandler(Session::EventHandler* event_handler) override;
50 ErrorCode error() override; 50 ErrorCode error() override;
51 const std::string& jid() override; 51 const std::string& jid() override;
52 const CandidateSessionConfig* candidate_config() override; 52 const CandidateSessionConfig* candidate_config() override;
53 const SessionConfig& config() override; 53 const SessionConfig& config() override;
54 void set_config(scoped_ptr<SessionConfig> config) override; 54 void set_config(const SessionConfig& config) override;
55 StreamChannelFactory* GetTransportChannelFactory() override; 55 StreamChannelFactory* GetTransportChannelFactory() override;
56 StreamChannelFactory* GetMultiplexedChannelFactory() override; 56 StreamChannelFactory* GetMultiplexedChannelFactory() override;
57 void Close() override; 57 void Close() override;
58 58
59 // DatagramChannelFactory interface. 59 // DatagramChannelFactory interface.
60 void CreateChannel(const std::string& name, 60 void CreateChannel(const std::string& name,
61 const ChannelCreatedCallback& callback) override; 61 const ChannelCreatedCallback& callback) override;
62 void CancelChannelCreation(const std::string& name) override; 62 void CancelChannelCreation(const std::string& name) override;
63 63
64 // Transport::EventHandler interface. 64 // Transport::EventHandler interface.
65 void OnTransportIceCredentials(Transport* transport,
66 const std::string& ufrag,
67 const std::string& password) override;
68 void OnTransportCandidate(Transport* transport, 65 void OnTransportCandidate(Transport* transport,
69 const cricket::Candidate& candidate) override; 66 const cricket::Candidate& candidate) override;
70 void OnTransportRouteChange(Transport* transport, 67 void OnTransportRouteChange(Transport* transport,
71 const TransportRoute& route) override; 68 const TransportRoute& route) override;
72 void OnTransportFailed(Transport* transport) override; 69 void OnTransportFailed(Transport* transport) override;
73 void OnTransportDeleted(Transport* transport) override; 70 void OnTransportDeleted(Transport* transport) override;
74 71
75 private: 72 private:
76 friend class JingleSessionManager; 73 friend class JingleSessionManager;
77 74
78 typedef std::map<std::string, Transport*> ChannelsMap; 75 typedef std::map<std::string, Transport*> ChannelsMap;
79 typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback; 76 typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback;
80 77
81 explicit JingleSession(JingleSessionManager* session_manager); 78 explicit JingleSession(JingleSessionManager* session_manager);
82 79
83 // Start connection by sending session-initiate message. 80 // Start connection by sending session-initiate message.
84 void StartConnection(const std::string& peer_jid, 81 void StartConnection(const std::string& peer_jid,
85 scoped_ptr<Authenticator> authenticator, 82 scoped_ptr<Authenticator> authenticator,
86 scoped_ptr<CandidateSessionConfig> config); 83 scoped_ptr<CandidateSessionConfig> config);
87 84
88 // Passes transport info to a new |channel| in case it was received before the 85 // Adds to a new channel the remote candidates received before it was created.
89 // channel was created. 86 void AddPendingRemoteCandidates(Transport* channel, const std::string& name);
90 void AddPendingRemoteTransportInfo(Transport* channel);
91 87
92 // Called by JingleSessionManager for incoming connections. 88 // Called by JingleSessionManager for incoming connections.
93 void InitializeIncomingConnection(const JingleMessage& initiate_message, 89 void InitializeIncomingConnection(const JingleMessage& initiate_message,
94 scoped_ptr<Authenticator> authenticator); 90 scoped_ptr<Authenticator> authenticator);
95 void AcceptIncomingConnection(const JingleMessage& initiate_message); 91 void AcceptIncomingConnection(const JingleMessage& initiate_message);
96 92
97 // Sends |message| to the peer. The session is closed if the send fails or no 93 // Sends |message| to the peer. The session is closed if the send fails or no
98 // response is received within a reasonable time. All other responses are 94 // response is received within a reasonable time. All other responses are
99 // ignored. 95 // ignored.
100 void SendMessage(const JingleMessage& message); 96 void SendMessage(const JingleMessage& message);
101 97
102 // Iq response handler. 98 // Iq response handler.
103 void OnMessageResponse(JingleMessage::ActionType request_type, 99 void OnMessageResponse(JingleMessage::ActionType request_type,
104 IqRequest* request, 100 IqRequest* request,
105 const buzz::XmlElement* response); 101 const buzz::XmlElement* response);
106 102
107 // Creates empty |pending_transport_info_message_| and schedules timer for
108 // SentTransportInfo() to sent the message later.
109 void EnsurePendingTransportInfoMessage();
110
111 // Sends transport-info message with candidates from |pending_candidates_|. 103 // Sends transport-info message with candidates from |pending_candidates_|.
112 void SendTransportInfo(); 104 void SendTransportInfo();
113 105
114 // Response handler for transport-info responses. Transport-info timeouts are 106 // Response handler for transport-info responses. Transport-info timeouts are
115 // ignored and don't terminate connection. 107 // ignored and don't terminate connection.
116 void OnTransportInfoResponse(IqRequest* request, 108 void OnTransportInfoResponse(IqRequest* request,
117 const buzz::XmlElement* response); 109 const buzz::XmlElement* response);
118 110
119 // Called by JingleSessionManager on incoming |message|. Must call 111 // Called by JingleSessionManager on incoming |message|. Must call
120 // |reply_callback| to send reply message before sending any other 112 // |reply_callback| to send reply message before sending any other
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 151
160 JingleSessionManager* session_manager_; 152 JingleSessionManager* session_manager_;
161 std::string peer_jid_; 153 std::string peer_jid_;
162 scoped_ptr<CandidateSessionConfig> candidate_config_; 154 scoped_ptr<CandidateSessionConfig> candidate_config_;
163 Session::EventHandler* event_handler_; 155 Session::EventHandler* event_handler_;
164 156
165 std::string session_id_; 157 std::string session_id_;
166 State state_; 158 State state_;
167 ErrorCode error_; 159 ErrorCode error_;
168 160
169 scoped_ptr<SessionConfig> config_; 161 SessionConfig config_;
162 bool config_is_set_;
170 163
171 scoped_ptr<Authenticator> authenticator_; 164 scoped_ptr<Authenticator> authenticator_;
172 165
173 // Pending Iq requests. Used for all messages except transport-info. 166 // Pending Iq requests. Used for all messages except transport-info.
174 std::set<IqRequest*> pending_requests_; 167 std::set<IqRequest*> pending_requests_;
175 168
176 // Pending transport-info requests. 169 // Pending transport-info requests.
177 std::list<IqRequest*> transport_info_requests_; 170 std::list<IqRequest*> transport_info_requests_;
178 171
179 ChannelsMap channels_; 172 ChannelsMap channels_;
180 scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_; 173 scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_;
181 scoped_ptr<SecureChannelFactory> secure_channel_factory_; 174 scoped_ptr<SecureChannelFactory> secure_channel_factory_;
182 scoped_ptr<ChannelMultiplexer> channel_multiplexer_; 175 scoped_ptr<ChannelMultiplexer> channel_multiplexer_;
183 176
184 scoped_ptr<JingleMessage> pending_transport_info_message_; 177 base::OneShotTimer<JingleSession> transport_infos_timer_;
185 base::OneShotTimer<JingleSession> transport_info_timer_; 178 std::list<JingleMessage::NamedCandidate> pending_candidates_;
186 179
187 // Pending remote transport info received before the local channels were 180 // Pending remote candidates, received before the local channels were created.
188 // created.
189 std::list<JingleMessage::IceCredentials> pending_remote_ice_credentials_;
190 std::list<JingleMessage::NamedCandidate> pending_remote_candidates_; 181 std::list<JingleMessage::NamedCandidate> pending_remote_candidates_;
191 182
192 base::WeakPtrFactory<JingleSession> weak_factory_; 183 base::WeakPtrFactory<JingleSession> weak_factory_;
193 184
194 DISALLOW_COPY_AND_ASSIGN(JingleSession); 185 DISALLOW_COPY_AND_ASSIGN(JingleSession);
195 }; 186 };
196 187
197 } // namespace protocol 188 } // namespace protocol
198 } // namespace remoting 189 } // namespace remoting
199 190
200 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ 191 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_messages_unittest.cc ('k') | remoting/protocol/jingle_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698