OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 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 #include "webrtc/p2p/quic/quictransport.h" | 11 #include "webrtc/p2p/quic/quictransport.h" |
12 | 12 |
| 13 #include "webrtc/base/checks.h" |
13 #include "webrtc/p2p/base/p2ptransportchannel.h" | 14 #include "webrtc/p2p/base/p2ptransportchannel.h" |
14 | 15 |
15 namespace cricket { | 16 namespace cricket { |
16 | 17 |
17 QuicTransport::QuicTransport( | 18 QuicTransport::QuicTransport( |
18 const std::string& name, | 19 const std::string& name, |
19 PortAllocator* allocator, | 20 PortAllocator* allocator, |
20 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) | 21 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) |
21 : Transport(name, allocator), local_certificate_(certificate) {} | 22 : Transport(name, allocator), local_certificate_(certificate) {} |
22 | 23 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 P2PTransportChannel* ice_channel = | 81 P2PTransportChannel* ice_channel = |
81 new P2PTransportChannel(name(), component, port_allocator()); | 82 new P2PTransportChannel(name(), component, port_allocator()); |
82 return new QuicTransportChannel(ice_channel); | 83 return new QuicTransportChannel(ice_channel); |
83 } | 84 } |
84 | 85 |
85 void QuicTransport::DestroyTransportChannel(TransportChannelImpl* channel) { | 86 void QuicTransport::DestroyTransportChannel(TransportChannelImpl* channel) { |
86 delete channel; | 87 delete channel; |
87 } | 88 } |
88 | 89 |
89 bool QuicTransport::GetSslRole(rtc::SSLRole* ssl_role) const { | 90 bool QuicTransport::GetSslRole(rtc::SSLRole* ssl_role) const { |
90 ASSERT(ssl_role != NULL); | 91 RTC_DCHECK(ssl_role != NULL); |
91 *ssl_role = local_role_; | 92 *ssl_role = local_role_; |
92 return true; | 93 return true; |
93 } | 94 } |
94 | 95 |
95 bool QuicTransport::ApplyNegotiatedTransportDescription( | 96 bool QuicTransport::ApplyNegotiatedTransportDescription( |
96 TransportChannelImpl* channel, | 97 TransportChannelImpl* channel, |
97 std::string* error_desc) { | 98 std::string* error_desc) { |
98 // Set ssl role and remote fingerprint. These are required for QUIC setup. | 99 // Set ssl role and remote fingerprint. These are required for QUIC setup. |
99 if (!channel->SetSslRole(local_role_)) { | 100 if (!channel->SetSslRole(local_role_)) { |
100 return BadTransportDescription("Failed to set ssl role for the channel.", | 101 return BadTransportDescription("Failed to set ssl role for the channel.", |
101 error_desc); | 102 error_desc); |
102 } | 103 } |
103 // Apply remote fingerprint. | 104 // Apply remote fingerprint. |
104 if (!channel->SetRemoteFingerprint( | 105 if (!channel->SetRemoteFingerprint( |
105 remote_fingerprint_->algorithm, | 106 remote_fingerprint_->algorithm, |
106 reinterpret_cast<const uint8_t*>(remote_fingerprint_->digest.data()), | 107 reinterpret_cast<const uint8_t*>(remote_fingerprint_->digest.data()), |
107 remote_fingerprint_->digest.size())) { | 108 remote_fingerprint_->digest.size())) { |
108 return BadTransportDescription("Failed to apply remote fingerprint.", | 109 return BadTransportDescription("Failed to apply remote fingerprint.", |
109 error_desc); | 110 error_desc); |
110 } | 111 } |
111 return Transport::ApplyNegotiatedTransportDescription(channel, error_desc); | 112 return Transport::ApplyNegotiatedTransportDescription(channel, error_desc); |
112 } | 113 } |
113 | 114 |
114 } // namespace cricket | 115 } // namespace cricket |
OLD | NEW |