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 // This file defines the interface for peer-to-peer transport. There | 5 // This file defines the interface for peer-to-peer transport. There |
6 // are two types of transport: StreamTransport and DatagramTransport. | 6 // are two types of transport: StreamTransport and DatagramTransport. |
7 // They must both be created using TransportFactory instances and they | 7 // They must both be created using TransportFactory instances and they |
8 // provide the same interface, except that one should be used for | 8 // provide the same interface, except that one should be used for |
9 // reliable stream connection and the other one for unreliable | 9 // reliable stream connection and the other one for unreliable |
10 // datagram connection. The Transport interface itself doesn't provide | 10 // datagram connection. The Transport interface itself doesn't provide |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class ChannelAuthenticator; | 45 class ChannelAuthenticator; |
46 struct TransportConfig; | 46 struct TransportConfig; |
47 | 47 |
48 struct TransportRoute { | 48 struct TransportRoute { |
49 enum RouteType { | 49 enum RouteType { |
50 DIRECT, | 50 DIRECT, |
51 STUN, | 51 STUN, |
52 RELAY, | 52 RELAY, |
53 }; | 53 }; |
54 | 54 |
| 55 // Helper method to get string representation of the type. |
| 56 static std::string GetTypeString(RouteType type); |
| 57 |
| 58 TransportRoute(); |
| 59 ~TransportRoute(); |
| 60 |
55 RouteType type; | 61 RouteType type; |
56 net::IPEndPoint remote_address; | 62 net::IPEndPoint remote_address; |
57 net::IPEndPoint local_address; | 63 net::IPEndPoint local_address; |
58 }; | 64 }; |
59 | 65 |
60 class Transport : public base::NonThreadSafe { | 66 class Transport : public base::NonThreadSafe { |
61 public: | 67 public: |
62 class EventHandler { | 68 class EventHandler { |
63 public: | 69 public: |
64 EventHandler() {}; | 70 EventHandler() {}; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() = 0; | 145 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() = 0; |
140 | 146 |
141 private: | 147 private: |
142 DISALLOW_COPY_AND_ASSIGN(TransportFactory); | 148 DISALLOW_COPY_AND_ASSIGN(TransportFactory); |
143 }; | 149 }; |
144 | 150 |
145 } // namespace protocol | 151 } // namespace protocol |
146 } // namespace remoting | 152 } // namespace remoting |
147 | 153 |
148 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ | 154 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ |
OLD | NEW |