| Index: remoting/protocol/jingle_session.h
|
| diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
|
| index 9e595afec091aaa3235604d082a03135608650fa..68678687e47f1b5f8c46dd8ef49b83edba29de7d 100644
|
| --- a/remoting/protocol/jingle_session.h
|
| +++ b/remoting/protocol/jingle_session.h
|
| @@ -6,11 +6,11 @@
|
| #define REMOTING_PROTOCOL_JINGLE_SESSION_H_
|
|
|
| #include <list>
|
| +#include <map>
|
| #include <set>
|
| #include <string>
|
|
|
| #include "base/memory/ref_counted.h"
|
| -#include "base/threading/non_thread_safe.h"
|
| #include "base/timer/timer.h"
|
| #include "crypto/rsa_private_key.h"
|
| #include "net/base/completion_callback.h"
|
| @@ -25,15 +25,19 @@
|
| namespace remoting {
|
| namespace protocol {
|
|
|
| +class ChannelMultiplexer;
|
| class JingleSessionManager;
|
| +class PseudoTcpChannelFactory;
|
| class QuicChannelFactory;
|
| +class SecureChannelFactory;
|
|
|
| // JingleSessionManager and JingleSession implement the subset of the
|
| // Jingle protocol used in Chromoting. Instances of this class are
|
| // created by the JingleSessionManager.
|
| class JingleSession : public base::NonThreadSafe,
|
| public Session,
|
| - public TransportSession::EventHandler {
|
| + public DatagramChannelFactory,
|
| + public Transport::EventHandler {
|
| public:
|
| ~JingleSession() override;
|
|
|
| @@ -42,13 +46,31 @@
|
| ErrorCode error() override;
|
| const std::string& jid() override;
|
| const SessionConfig& config() override;
|
| - TransportSession* GetTransportSession() override;
|
| + StreamChannelFactory* GetTransportChannelFactory() override;
|
| + StreamChannelFactory* GetMultiplexedChannelFactory() override;
|
| StreamChannelFactory* GetQuicChannelFactory() override;
|
| void Close() override;
|
| +
|
| + // DatagramChannelFactory interface.
|
| + void CreateChannel(const std::string& name,
|
| + const ChannelCreatedCallback& callback) override;
|
| + void CancelChannelCreation(const std::string& name) override;
|
| +
|
| + // Transport::EventHandler interface.
|
| + void OnTransportIceCredentials(Transport* transport,
|
| + const std::string& ufrag,
|
| + const std::string& password) override;
|
| + void OnTransportCandidate(Transport* transport,
|
| + const cricket::Candidate& candidate) override;
|
| + void OnTransportRouteChange(Transport* transport,
|
| + const TransportRoute& route) override;
|
| + void OnTransportFailed(Transport* transport) override;
|
| + void OnTransportDeleted(Transport* transport) override;
|
|
|
| private:
|
| friend class JingleSessionManager;
|
|
|
| + typedef std::map<std::string, Transport*> ChannelsMap;
|
| typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback;
|
|
|
| explicit JingleSession(JingleSessionManager* session_manager);
|
| @@ -56,6 +78,10 @@
|
| // Start connection by sending session-initiate message.
|
| void StartConnection(const std::string& peer_jid,
|
| scoped_ptr<Authenticator> authenticator);
|
| +
|
| + // Passes transport info to a new |channel| in case it was received before the
|
| + // channel was created.
|
| + void AddPendingRemoteTransportInfo(Transport* channel);
|
|
|
| // Called by JingleSessionManager for incoming connections.
|
| void InitializeIncomingConnection(const JingleMessage& initiate_message,
|
| @@ -72,12 +98,12 @@
|
| IqRequest* request,
|
| const buzz::XmlElement* response);
|
|
|
| - // TransportSession::Delegate interface.
|
| - void OnOutgoingTransportInfo(
|
| - scoped_ptr<buzz::XmlElement> transport_info) override;
|
| - void OnTransportRouteChange(const std::string& component,
|
| - const TransportRoute& route) override;
|
| - void OnTransportError(ErrorCode error) override;
|
| + // Creates empty |pending_transport_info_message_| and schedules timer for
|
| + // SentTransportInfo() to sent the message later.
|
| + void EnsurePendingTransportInfoMessage();
|
| +
|
| + // Sends transport-info message with candidates from |pending_candidates_|.
|
| + void SendTransportInfo();
|
|
|
| // Response handler for transport-info responses. Transport-info timeouts are
|
| // ignored and don't terminate connection.
|
| @@ -97,6 +123,7 @@
|
| const ReplyCallback& reply_callback);
|
| void OnTerminate(const JingleMessage& message,
|
| const ReplyCallback& reply_callback);
|
| + void ProcessTransportInfo(const JingleMessage& message);
|
|
|
| // Called from OnAccept() to initialize session config.
|
| bool InitializeConfigFromDescription(const ContentDescription* description);
|
| @@ -136,15 +163,25 @@
|
|
|
| scoped_ptr<Authenticator> authenticator_;
|
|
|
| - scoped_ptr<TransportSession> transport_session_;
|
| -
|
| // Pending Iq requests. Used for all messages except transport-info.
|
| std::set<IqRequest*> pending_requests_;
|
|
|
| // Pending transport-info requests.
|
| std::list<IqRequest*> transport_info_requests_;
|
|
|
| + ChannelsMap channels_;
|
| + scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_;
|
| + scoped_ptr<SecureChannelFactory> secure_channel_factory_;
|
| + scoped_ptr<ChannelMultiplexer> channel_multiplexer_;
|
| scoped_ptr<QuicChannelFactory> quic_channel_factory_;
|
| +
|
| + scoped_ptr<JingleMessage> pending_transport_info_message_;
|
| + base::OneShotTimer transport_info_timer_;
|
| +
|
| + // Pending remote transport info received before the local channels were
|
| + // created.
|
| + std::list<JingleMessage::IceCredentials> pending_remote_ice_credentials_;
|
| + std::list<JingleMessage::NamedCandidate> pending_remote_candidates_;
|
|
|
| base::WeakPtrFactory<JingleSession> weak_factory_;
|
|
|
|
|