OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // We force a read event here to ensure that we don't overflow our queue. | 80 // We force a read event here to ensure that we don't overflow our queue. |
81 bool ret = packets_.WriteBack(data, size, NULL); | 81 bool ret = packets_.WriteBack(data, size, NULL); |
82 CHECK(ret) << "Failed to write packet to queue."; | 82 CHECK(ret) << "Failed to write packet to queue."; |
83 if (ret) { | 83 if (ret) { |
84 SignalEvent(this, rtc::SE_READ, 0); | 84 SignalEvent(this, rtc::SE_READ, 0); |
85 } | 85 } |
86 return ret; | 86 return ret; |
87 } | 87 } |
88 | 88 |
89 DtlsTransportChannelWrapper::DtlsTransportChannelWrapper( | 89 DtlsTransportChannelWrapper::DtlsTransportChannelWrapper( |
90 Transport* transport, | 90 Transport* transport, |
91 TransportChannelImpl* channel) | 91 TransportChannelImpl* channel) |
92 : TransportChannelImpl(channel->content_name(), channel->component()), | 92 : TransportChannelImpl(channel->transport_name(), channel->component()), |
93 transport_(transport), | 93 transport_(transport), |
94 worker_thread_(rtc::Thread::Current()), | 94 worker_thread_(rtc::Thread::Current()), |
95 channel_(channel), | 95 channel_(channel), |
96 downward_(NULL), | 96 downward_(NULL), |
97 dtls_state_(STATE_NONE), | 97 dtls_state_(STATE_NONE), |
98 ssl_role_(rtc::SSL_CLIENT), | 98 ssl_role_(rtc::SSL_CLIENT), |
99 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) { | 99 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) { |
100 channel_->SignalReadableState.connect(this, | 100 channel_->SignalReadableState.connect(this, |
101 &DtlsTransportChannelWrapper::OnReadableState); | 101 &DtlsTransportChannelWrapper::OnReadableState); |
102 channel_->SignalWritableState.connect(this, | 102 channel_->SignalWritableState.connect(this, |
103 &DtlsTransportChannelWrapper::OnWritableState); | 103 &DtlsTransportChannelWrapper::OnWritableState); |
104 channel_->SignalReadPacket.connect(this, | 104 channel_->SignalReadPacket.connect(this, |
105 &DtlsTransportChannelWrapper::OnReadPacket); | 105 &DtlsTransportChannelWrapper::OnReadPacket); |
106 channel_->SignalReadyToSend.connect(this, | 106 channel_->SignalReadyToSend.connect(this, |
107 &DtlsTransportChannelWrapper::OnReadyToSend); | 107 &DtlsTransportChannelWrapper::OnReadyToSend); |
108 channel_->SignalRequestSignaling.connect(this, | 108 channel_->SignalGatheringState.connect( |
109 &DtlsTransportChannelWrapper::OnRequestSignaling); | 109 this, &DtlsTransportChannelWrapper::OnGatheringState); |
110 channel_->SignalCandidateReady.connect(this, | 110 channel_->SignalCandidateGathered.connect( |
111 &DtlsTransportChannelWrapper::OnCandidateReady); | 111 this, &DtlsTransportChannelWrapper::OnCandidateGathered); |
112 channel_->SignalCandidatesAllocationDone.connect(this, | |
113 &DtlsTransportChannelWrapper::OnCandidatesAllocationDone); | |
114 channel_->SignalRoleConflict.connect(this, | 112 channel_->SignalRoleConflict.connect(this, |
115 &DtlsTransportChannelWrapper::OnRoleConflict); | 113 &DtlsTransportChannelWrapper::OnRoleConflict); |
116 channel_->SignalRouteChange.connect(this, | 114 channel_->SignalRouteChange.connect(this, |
117 &DtlsTransportChannelWrapper::OnRouteChange); | 115 &DtlsTransportChannelWrapper::OnRouteChange); |
118 channel_->SignalConnectionRemoved.connect(this, | 116 channel_->SignalConnectionRemoved.connect(this, |
119 &DtlsTransportChannelWrapper::OnConnectionRemoved); | 117 &DtlsTransportChannelWrapper::OnConnectionRemoved); |
120 channel_->SignalReceivingState.connect(this, | 118 channel_->SignalReceivingState.connect(this, |
121 &DtlsTransportChannelWrapper::OnReceivingState); | 119 &DtlsTransportChannelWrapper::OnReceivingState); |
122 } | 120 } |
123 | 121 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 rtc::Buffer remote_fingerprint_value(digest, digest_len); | 204 rtc::Buffer remote_fingerprint_value(digest, digest_len); |
207 | 205 |
208 if (dtls_state_ != STATE_NONE && | 206 if (dtls_state_ != STATE_NONE && |
209 remote_fingerprint_value_ == remote_fingerprint_value && | 207 remote_fingerprint_value_ == remote_fingerprint_value && |
210 !digest_alg.empty()) { | 208 !digest_alg.empty()) { |
211 // This may happen during renegotiation. | 209 // This may happen during renegotiation. |
212 LOG_J(LS_INFO, this) << "Ignoring identical remote DTLS fingerprint"; | 210 LOG_J(LS_INFO, this) << "Ignoring identical remote DTLS fingerprint"; |
213 return true; | 211 return true; |
214 } | 212 } |
215 | 213 |
216 // Allow SetRemoteFingerprint with a NULL digest even if SetLocalIdentity | 214 // Allow SetRemoteFingerprint with a NULL digest even if SetLocalCertificate |
217 // hasn't been called. | 215 // hasn't been called. |
218 if (dtls_state_ > STATE_OFFERED || | 216 if (dtls_state_ > STATE_OFFERED || |
219 (dtls_state_ == STATE_NONE && !digest_alg.empty())) { | 217 (dtls_state_ == STATE_NONE && !digest_alg.empty())) { |
220 LOG_J(LS_ERROR, this) << "Can't set DTLS remote settings in this state."; | 218 LOG_J(LS_ERROR, this) << "Can't set DTLS remote settings in this state."; |
221 return false; | 219 return false; |
222 } | 220 } |
223 | 221 |
224 if (digest_alg.empty()) { | 222 if (digest_alg.empty()) { |
225 LOG_J(LS_INFO, this) << "Other side didn't support DTLS."; | 223 LOG_J(LS_INFO, this) << "Other side didn't support DTLS."; |
226 dtls_state_ = STATE_NONE; | 224 dtls_state_ = STATE_NONE; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 601 |
604 tmp_data += record_len + kDtlsRecordHeaderLen; | 602 tmp_data += record_len + kDtlsRecordHeaderLen; |
605 tmp_size -= record_len + kDtlsRecordHeaderLen; | 603 tmp_size -= record_len + kDtlsRecordHeaderLen; |
606 } | 604 } |
607 | 605 |
608 // Looks good. Pass to the SIC which ends up being passed to | 606 // Looks good. Pass to the SIC which ends up being passed to |
609 // the DTLS stack. | 607 // the DTLS stack. |
610 return downward_->OnPacketReceived(data, size); | 608 return downward_->OnPacketReceived(data, size); |
611 } | 609 } |
612 | 610 |
613 void DtlsTransportChannelWrapper::OnRequestSignaling( | 611 void DtlsTransportChannelWrapper::OnGatheringState( |
614 TransportChannelImpl* channel) { | 612 TransportChannelImpl* channel) { |
615 ASSERT(channel == channel_); | 613 ASSERT(channel == channel_); |
616 SignalRequestSignaling(this); | 614 SignalGatheringState(this); |
617 } | 615 } |
618 | 616 |
619 void DtlsTransportChannelWrapper::OnCandidateReady( | 617 void DtlsTransportChannelWrapper::OnCandidateGathered( |
620 TransportChannelImpl* channel, const Candidate& c) { | 618 TransportChannelImpl* channel, |
| 619 const Candidate& c) { |
621 ASSERT(channel == channel_); | 620 ASSERT(channel == channel_); |
622 SignalCandidateReady(this, c); | 621 SignalCandidateGathered(this, c); |
623 } | |
624 | |
625 void DtlsTransportChannelWrapper::OnCandidatesAllocationDone( | |
626 TransportChannelImpl* channel) { | |
627 ASSERT(channel == channel_); | |
628 SignalCandidatesAllocationDone(this); | |
629 } | 622 } |
630 | 623 |
631 void DtlsTransportChannelWrapper::OnRoleConflict( | 624 void DtlsTransportChannelWrapper::OnRoleConflict( |
632 TransportChannelImpl* channel) { | 625 TransportChannelImpl* channel) { |
633 ASSERT(channel == channel_); | 626 ASSERT(channel == channel_); |
634 SignalRoleConflict(this); | 627 SignalRoleConflict(this); |
635 } | 628 } |
636 | 629 |
637 void DtlsTransportChannelWrapper::OnRouteChange( | 630 void DtlsTransportChannelWrapper::OnRouteChange( |
638 TransportChannel* channel, const Candidate& candidate) { | 631 TransportChannel* channel, const Candidate& candidate) { |
639 ASSERT(channel == channel_); | 632 ASSERT(channel == channel_); |
640 SignalRouteChange(this, candidate); | 633 SignalRouteChange(this, candidate); |
641 } | 634 } |
642 | 635 |
643 void DtlsTransportChannelWrapper::OnConnectionRemoved( | 636 void DtlsTransportChannelWrapper::OnConnectionRemoved( |
644 TransportChannelImpl* channel) { | 637 TransportChannelImpl* channel) { |
645 ASSERT(channel == channel_); | 638 ASSERT(channel == channel_); |
646 SignalConnectionRemoved(this); | 639 SignalConnectionRemoved(this); |
647 } | 640 } |
648 | 641 |
649 } // namespace cricket | 642 } // namespace cricket |
OLD | NEW |