Chromium Code Reviews| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 // Called when the transport is about to be deleted. | 84 // Called when the transport is about to be deleted. |
| 85 virtual void OnTransportDeleted(Transport* transport) = 0; | 85 virtual void OnTransportDeleted(Transport* transport) = 0; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 Transport() {} | 88 Transport() {} |
| 89 virtual ~Transport() {} | 89 virtual ~Transport() {} |
| 90 | 90 |
| 91 // Intialize the transport with the specified parameters. | 91 // Intialize the transport with the specified parameters. |
| 92 // |authenticator| is used to secure and authenticate the connection. | 92 // |authenticator| is used to secure and authenticate the connection. |
| 93 virtual void Initialize(const std::string& name, | 93 virtual void Initialize(const std::string& name, |
| 94 const TransportConfig& config, | |
| 95 Transport::EventHandler* event_handler, | 94 Transport::EventHandler* event_handler, |
| 96 scoped_ptr<ChannelAuthenticator> authenticator) = 0; | 95 scoped_ptr<ChannelAuthenticator> authenticator) = 0; |
| 97 | 96 |
| 98 // Adds |candidate| received from the peer. | 97 // Adds |candidate| received from the peer. |
| 99 virtual void AddRemoteCandidate(const cricket::Candidate& candidate) = 0; | 98 virtual void AddRemoteCandidate(const cricket::Candidate& candidate) = 0; |
| 100 | 99 |
| 101 // Name of the channel. It is used to identify the channel and | 100 // Name of the channel. It is used to identify the channel and |
| 102 // disambiguate candidates it generates from candidates generated by | 101 // disambiguate candidates it generates from candidates generated by |
| 103 // parallel connections. | 102 // parallel connections. |
| 104 virtual const std::string& name() const = 0; | 103 virtual const std::string& name() const = 0; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 134 | 133 |
| 135 private: | 134 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(DatagramTransport); | 135 DISALLOW_COPY_AND_ASSIGN(DatagramTransport); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 class TransportFactory { | 138 class TransportFactory { |
| 140 public: | 139 public: |
| 141 TransportFactory() { } | 140 TransportFactory() { } |
| 142 virtual ~TransportFactory() { } | 141 virtual ~TransportFactory() { } |
| 143 | 142 |
| 143 virtual void SetConfig(const TransportConfig& config) = 0; | |
|
Wez
2012/04/27 23:49:15
Add some comments to explain this interface, pleas
Wez
2012/04/27 23:49:15
SetConfig -> SetTransportConfig
Wez
2012/04/27 23:49:15
Why do you want the TransportConfig to apply per-T
Sergey Ulanov
2012/04/28 00:18:19
Done.
Sergey Ulanov
2012/04/28 00:18:19
Done.
Sergey Ulanov
2012/04/28 00:18:19
That's in order to be able to share PortAllocator
Wez
2012/04/30 19:33:13
We will want to be able to enable/disable NAT trav
Sergey Ulanov
2012/04/30 20:14:29
As we discussed we don't really need to be able to
| |
| 144 | |
| 144 virtual scoped_ptr<StreamTransport> CreateStreamTransport() = 0; | 145 virtual scoped_ptr<StreamTransport> CreateStreamTransport() = 0; |
| 145 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() = 0; | 146 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() = 0; |
| 146 | 147 |
| 147 private: | 148 private: |
| 148 DISALLOW_COPY_AND_ASSIGN(TransportFactory); | 149 DISALLOW_COPY_AND_ASSIGN(TransportFactory); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace protocol | 152 } // namespace protocol |
| 152 } // namespace remoting | 153 } // namespace remoting |
| 153 | 154 |
| 154 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ | 155 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ |
| OLD | NEW |