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

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

Issue 1420273002: Add TransportSession interface to prepare for WebRTC-based transport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « remoting/protocol/ice_transport_factory.cc ('k') | remoting/protocol/ice_transport_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
(Empty)
1 // Copyright 2015 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_ICE_TRANSPORT_SESSION_H_
6 #define REMOTING_PROTOCOL_ICE_TRANSPORT_SESSION_H_
7
8 #include <list>
9 #include <map>
10
11 #include "base/macros.h"
12 #include "base/timer/timer.h"
13 #include "remoting/protocol/datagram_channel_factory.h"
14 #include "remoting/protocol/jingle_messages.h"
15 #include "remoting/protocol/transport.h"
16
17 namespace remoting {
18 namespace protocol {
19
20 class ChannelMultiplexer;
21 class LibjingleTransportFactory;
22 class PseudoTcpChannelFactory;
23 class SecureChannelFactory;
24
25 class IceTransportSession : public TransportSession,
26 public Transport::EventHandler,
27 public DatagramChannelFactory {
28 public:
29 // |transport_factory| must outlive the session.
30 IceTransportSession(LibjingleTransportFactory* libjingle_transport_factory);
31 ~IceTransportSession() override;
32
33 // TransportSession interface.
34 void Start(TransportSession::EventHandler* event_handler,
35 Authenticator* authenticator) override;
36 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override;
37 DatagramChannelFactory* GetDatagramChannelFactory() override;
38 StreamChannelFactory* GetStreamChannelFactory() override;
39 StreamChannelFactory* GetMultiplexedChannelFactory() override;
40
41 private:
42 typedef std::map<std::string, Transport*> ChannelsMap;
43
44 // DatagramChannelFactory interface.
45 void CreateChannel(const std::string& name,
46 const ChannelCreatedCallback& callback) override;
47 void CancelChannelCreation(const std::string& name) override;
48
49 // Passes transport info to a new |channel| in case it was received before the
50 // channel was created.
51 void AddPendingRemoteTransportInfo(Transport* channel);
52
53 // Transport::EventHandler interface.
54 void OnTransportIceCredentials(Transport* transport,
55 const std::string& ufrag,
56 const std::string& password) override;
57 void OnTransportCandidate(Transport* transport,
58 const cricket::Candidate& candidate) override;
59 void OnTransportRouteChange(Transport* transport,
60 const TransportRoute& route) override;
61 void OnTransportFailed(Transport* transport) override;
62 void OnTransportDeleted(Transport* transport) override;
63
64 // Creates empty |pending_transport_info_message_| and schedules timer for
65 // SentTransportInfo() to sent the message later.
66 void EnsurePendingTransportInfoMessage();
67
68 // Sends transport-info message with candidates from |pending_candidates_|.
69 void SendTransportInfo();
70
71 LibjingleTransportFactory* libjingle_transport_factory_;
72
73 TransportSession::EventHandler* event_handler_ = nullptr;
74
75 ChannelsMap channels_;
76 scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_;
77 scoped_ptr<SecureChannelFactory> secure_channel_factory_;
78 scoped_ptr<ChannelMultiplexer> channel_multiplexer_;
79
80 // Pending remote transport info received before the local channels were
81 // created.
82 std::list<IceTransportInfo::IceCredentials> pending_remote_ice_credentials_;
83 std::list<IceTransportInfo::NamedCandidate> pending_remote_candidates_;
84
85 scoped_ptr<IceTransportInfo> pending_transport_info_message_;
86 base::OneShotTimer transport_info_timer_;
87
88 DISALLOW_COPY_AND_ASSIGN(IceTransportSession);
89 };
90
91 } // namespace protocol
92 } // namespace remoting
93
94 #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_SESSION_H_
95
OLDNEW
« no previous file with comments | « remoting/protocol/ice_transport_factory.cc ('k') | remoting/protocol/ice_transport_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698