OLD | NEW |
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_TRANSPORT_H_ | 5 #ifndef REMOTING_PROTOCOL_TRANSPORT_H_ |
6 #define REMOTING_PROTOCOL_TRANSPORT_H_ | 6 #define REMOTING_PROTOCOL_TRANSPORT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
15 #include "remoting/protocol/errors.h" | 15 #include "remoting/protocol/errors.h" |
16 | 16 |
17 namespace cricket { | 17 namespace cricket { |
18 class Candidate; | 18 class Candidate; |
19 } // namespace cricket | 19 } // namespace cricket |
20 | 20 |
21 namespace buzz { | 21 namespace buzz { |
22 class XmlElement; | 22 class XmlElement; |
23 } // namespace buzz | 23 } // namespace buzz |
24 | 24 |
| 25 namespace webrtc { |
| 26 class PeerConnectionInterface; |
| 27 } // namespace webrtc |
| 28 |
25 namespace remoting { | 29 namespace remoting { |
26 namespace protocol { | 30 namespace protocol { |
27 | 31 |
28 class Authenticator; | 32 class Authenticator; |
29 class DatagramChannelFactory; | 33 class DatagramChannelFactory; |
30 class P2PDatagramSocket; | 34 class P2PDatagramSocket; |
31 class StreamChannelFactory; | 35 class StreamChannelFactory; |
| 36 class WebrtcTransport; |
32 | 37 |
33 enum class TransportRole { | 38 enum class TransportRole { |
34 SERVER, | 39 SERVER, |
35 CLIENT, | 40 CLIENT, |
36 }; | 41 }; |
37 | 42 |
38 struct TransportRoute { | 43 struct TransportRoute { |
39 enum RouteType { | 44 enum RouteType { |
40 DIRECT, | 45 DIRECT, |
41 STUN, | 46 STUN, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // |transport_info| is in invalid format. | 90 // |transport_info| is in invalid format. |
86 virtual bool ProcessTransportInfo(buzz::XmlElement* transport_info) = 0; | 91 virtual bool ProcessTransportInfo(buzz::XmlElement* transport_info) = 0; |
87 | 92 |
88 // Channel factory for the session that creates stream channels. | 93 // Channel factory for the session that creates stream channels. |
89 virtual StreamChannelFactory* GetStreamChannelFactory() = 0; | 94 virtual StreamChannelFactory* GetStreamChannelFactory() = 0; |
90 | 95 |
91 // Returns a factory that creates multiplexed channels over a single stream | 96 // Returns a factory that creates multiplexed channels over a single stream |
92 // channel. | 97 // channel. |
93 virtual StreamChannelFactory* GetMultiplexedChannelFactory() = 0; | 98 virtual StreamChannelFactory* GetMultiplexedChannelFactory() = 0; |
94 | 99 |
| 100 // Returns the transport as WebrtcTransport or nullptr if this is not a |
| 101 // WebrtcTransport. |
| 102 // |
| 103 // TODO(sergeyu): Move creation and ownership of Transport objects to the |
| 104 // Connection classes. That way the Connection classes will be able to ensure |
| 105 // that correct transport implementation is used for the connection and this |
| 106 // method will not be necessary. |
| 107 virtual WebrtcTransport* AsWebrtcTransport(); |
| 108 |
95 private: | 109 private: |
96 DISALLOW_COPY_AND_ASSIGN(Transport); | 110 DISALLOW_COPY_AND_ASSIGN(Transport); |
97 }; | 111 }; |
98 | 112 |
99 class TransportFactory { | 113 class TransportFactory { |
100 public: | 114 public: |
101 TransportFactory() { } | 115 TransportFactory() { } |
102 virtual ~TransportFactory() { } | 116 virtual ~TransportFactory() { } |
103 | 117 |
104 // Creates a new Transport. The factory must outlive the session. | 118 // Creates a new Transport. The factory must outlive the session. |
105 virtual scoped_ptr<Transport> CreateTransport() = 0; | 119 virtual scoped_ptr<Transport> CreateTransport() = 0; |
106 | 120 |
107 private: | 121 private: |
108 DISALLOW_COPY_AND_ASSIGN(TransportFactory); | 122 DISALLOW_COPY_AND_ASSIGN(TransportFactory); |
109 }; | 123 }; |
110 | 124 |
111 } // namespace protocol | 125 } // namespace protocol |
112 } // namespace remoting | 126 } // namespace remoting |
113 | 127 |
114 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ | 128 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ |
OLD | NEW |