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 // Sets configuration for the transports created by this factory. |
| 144 virtual void SetTransportConfig(const TransportConfig& config) = 0; |
| 145 |
144 virtual scoped_ptr<StreamTransport> CreateStreamTransport() = 0; | 146 virtual scoped_ptr<StreamTransport> CreateStreamTransport() = 0; |
145 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() = 0; | 147 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() = 0; |
146 | 148 |
147 private: | 149 private: |
148 DISALLOW_COPY_AND_ASSIGN(TransportFactory); | 150 DISALLOW_COPY_AND_ASSIGN(TransportFactory); |
149 }; | 151 }; |
150 | 152 |
151 } // namespace protocol | 153 } // namespace protocol |
152 } // namespace remoting | 154 } // namespace remoting |
153 | 155 |
154 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ | 156 #endif // REMOTING_PROTOCOL_TRANSPORT_H_ |
OLD | NEW |