OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // A Transport manages a set of named channels of the same type. | 11 // A Transport manages a set of named channels of the same type. |
12 // | 12 // |
13 // Subclasses choose the appropriate class to instantiate for each channel; | 13 // Subclasses choose the appropriate class to instantiate for each channel; |
14 // however, this base class keeps track of the channels by name, watches their | 14 // however, this base class keeps track of the channels by name, watches their |
15 // state changes (in order to update the manager's state), and forwards | 15 // state changes (in order to update the manager's state), and forwards |
16 // requests to begin connecting or to reset to each of the channels. | 16 // requests to begin connecting or to reset to each of the channels. |
17 // | 17 // |
18 // On Threading: Transport performs work solely on the worker thread, and so | 18 // On Threading: Transport performs work solely on the worker thread, and so |
19 // its methods should only be called on the worker thread. | 19 // its methods should only be called on the worker thread. |
20 // | 20 // |
21 // Note: Subclasses must call DestroyChannels() in their own destructors. | 21 // Note: Subclasses must call DestroyChannels() in their own destructors. |
22 // It is not possible to do so here because the subclass destructor will | 22 // It is not possible to do so here because the subclass destructor will |
23 // already have run. | 23 // already have run. |
24 | 24 |
25 #ifndef WEBRTC_P2P_BASE_TRANSPORT_H_ | 25 #ifndef WEBRTC_P2P_BASE_TRANSPORT_H_ |
26 #define WEBRTC_P2P_BASE_TRANSPORT_H_ | 26 #define WEBRTC_P2P_BASE_TRANSPORT_H_ |
27 | 27 |
28 #include <map> | 28 #include <map> |
| 29 #include <memory> |
29 #include <string> | 30 #include <string> |
30 #include <vector> | 31 #include <vector> |
31 #include "webrtc/p2p/base/candidate.h" | 32 #include "webrtc/p2p/base/candidate.h" |
32 #include "webrtc/p2p/base/p2pconstants.h" | 33 #include "webrtc/p2p/base/p2pconstants.h" |
33 #include "webrtc/p2p/base/sessiondescription.h" | 34 #include "webrtc/p2p/base/sessiondescription.h" |
34 #include "webrtc/p2p/base/transportinfo.h" | 35 #include "webrtc/p2p/base/transportinfo.h" |
35 #include "webrtc/base/messagequeue.h" | 36 #include "webrtc/base/messagequeue.h" |
36 #include "webrtc/base/rtccertificate.h" | 37 #include "webrtc/base/rtccertificate.h" |
37 #include "webrtc/base/sigslot.h" | 38 #include "webrtc/base/sigslot.h" |
38 #include "webrtc/base/sslstreamadapter.h" | 39 #include "webrtc/base/sslstreamadapter.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 virtual void SetLocalCertificate( | 208 virtual void SetLocalCertificate( |
208 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {} | 209 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {} |
209 | 210 |
210 // Get a copy of the local certificate provided by SetLocalCertificate. | 211 // Get a copy of the local certificate provided by SetLocalCertificate. |
211 virtual bool GetLocalCertificate( | 212 virtual bool GetLocalCertificate( |
212 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { | 213 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { |
213 return false; | 214 return false; |
214 } | 215 } |
215 | 216 |
216 // Get a copy of the remote certificate in use by the specified channel. | 217 // Get a copy of the remote certificate in use by the specified channel. |
217 rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(); | 218 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(); |
218 | 219 |
219 // Create, destroy, and lookup the channels of this type by their components. | 220 // Create, destroy, and lookup the channels of this type by their components. |
220 TransportChannelImpl* CreateChannel(int component); | 221 TransportChannelImpl* CreateChannel(int component); |
221 | 222 |
222 TransportChannelImpl* GetChannel(int component); | 223 TransportChannelImpl* GetChannel(int component); |
223 | 224 |
224 bool HasChannel(int component) { | 225 bool HasChannel(int component) { |
225 return (NULL != GetChannel(component)); | 226 return (NULL != GetChannel(component)); |
226 } | 227 } |
227 bool HasChannels(); | 228 bool HasChannels(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void CallChannels(TransportChannelFunc func); | 327 void CallChannels(TransportChannelFunc func); |
327 | 328 |
328 const std::string name_; | 329 const std::string name_; |
329 PortAllocator* const allocator_; | 330 PortAllocator* const allocator_; |
330 bool channels_destroyed_ = false; | 331 bool channels_destroyed_ = false; |
331 bool connect_requested_ = false; | 332 bool connect_requested_ = false; |
332 IceRole ice_role_ = ICEROLE_UNKNOWN; | 333 IceRole ice_role_ = ICEROLE_UNKNOWN; |
333 uint64_t tiebreaker_ = 0; | 334 uint64_t tiebreaker_ = 0; |
334 IceMode remote_ice_mode_ = ICEMODE_FULL; | 335 IceMode remote_ice_mode_ = ICEMODE_FULL; |
335 IceConfig ice_config_; | 336 IceConfig ice_config_; |
336 rtc::scoped_ptr<TransportDescription> local_description_; | 337 std::unique_ptr<TransportDescription> local_description_; |
337 rtc::scoped_ptr<TransportDescription> remote_description_; | 338 std::unique_ptr<TransportDescription> remote_description_; |
338 bool local_description_set_ = false; | 339 bool local_description_set_ = false; |
339 bool remote_description_set_ = false; | 340 bool remote_description_set_ = false; |
340 | 341 |
341 ChannelMap channels_; | 342 ChannelMap channels_; |
342 | 343 |
343 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); | 344 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); |
344 }; | 345 }; |
345 | 346 |
346 | 347 |
347 } // namespace cricket | 348 } // namespace cricket |
348 | 349 |
349 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ | 350 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ |
OLD | NEW |