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 RTC_CHECK(ret) << "Failed to write packet to queue."; | 82 RTC_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->transport_name(), channel->component()), | 92 : TransportChannelImpl(channel->content_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_->SignalWritableState.connect(this, | 100 channel_->SignalWritableState.connect(this, |
101 &DtlsTransportChannelWrapper::OnWritableState); | 101 &DtlsTransportChannelWrapper::OnWritableState); |
102 channel_->SignalReadPacket.connect(this, | 102 channel_->SignalReadPacket.connect(this, |
103 &DtlsTransportChannelWrapper::OnReadPacket); | 103 &DtlsTransportChannelWrapper::OnReadPacket); |
104 channel_->SignalReadyToSend.connect(this, | 104 channel_->SignalReadyToSend.connect(this, |
105 &DtlsTransportChannelWrapper::OnReadyToSend); | 105 &DtlsTransportChannelWrapper::OnReadyToSend); |
106 channel_->SignalGatheringState.connect( | 106 channel_->SignalRequestSignaling.connect(this, |
107 this, &DtlsTransportChannelWrapper::OnGatheringState); | 107 &DtlsTransportChannelWrapper::OnRequestSignaling); |
108 channel_->SignalCandidateGathered.connect( | 108 channel_->SignalCandidateReady.connect(this, |
109 this, &DtlsTransportChannelWrapper::OnCandidateGathered); | 109 &DtlsTransportChannelWrapper::OnCandidateReady); |
| 110 channel_->SignalCandidatesAllocationDone.connect(this, |
| 111 &DtlsTransportChannelWrapper::OnCandidatesAllocationDone); |
110 channel_->SignalRoleConflict.connect(this, | 112 channel_->SignalRoleConflict.connect(this, |
111 &DtlsTransportChannelWrapper::OnRoleConflict); | 113 &DtlsTransportChannelWrapper::OnRoleConflict); |
112 channel_->SignalRouteChange.connect(this, | 114 channel_->SignalRouteChange.connect(this, |
113 &DtlsTransportChannelWrapper::OnRouteChange); | 115 &DtlsTransportChannelWrapper::OnRouteChange); |
114 channel_->SignalConnectionRemoved.connect(this, | 116 channel_->SignalConnectionRemoved.connect(this, |
115 &DtlsTransportChannelWrapper::OnConnectionRemoved); | 117 &DtlsTransportChannelWrapper::OnConnectionRemoved); |
116 channel_->SignalReceivingState.connect(this, | 118 channel_->SignalReceivingState.connect(this, |
117 &DtlsTransportChannelWrapper::OnReceivingState); | 119 &DtlsTransportChannelWrapper::OnReceivingState); |
118 } | 120 } |
119 | 121 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 rtc::Buffer remote_fingerprint_value(digest, digest_len); | 204 rtc::Buffer remote_fingerprint_value(digest, digest_len); |
203 | 205 |
204 if (dtls_state_ != STATE_NONE && | 206 if (dtls_state_ != STATE_NONE && |
205 remote_fingerprint_value_ == remote_fingerprint_value && | 207 remote_fingerprint_value_ == remote_fingerprint_value && |
206 !digest_alg.empty()) { | 208 !digest_alg.empty()) { |
207 // This may happen during renegotiation. | 209 // This may happen during renegotiation. |
208 LOG_J(LS_INFO, this) << "Ignoring identical remote DTLS fingerprint"; | 210 LOG_J(LS_INFO, this) << "Ignoring identical remote DTLS fingerprint"; |
209 return true; | 211 return true; |
210 } | 212 } |
211 | 213 |
212 // Allow SetRemoteFingerprint with a NULL digest even if SetLocalCertificate | 214 // Allow SetRemoteFingerprint with a NULL digest even if SetLocalIdentity |
213 // hasn't been called. | 215 // hasn't been called. |
214 if (dtls_state_ > STATE_OFFERED || | 216 if (dtls_state_ > STATE_OFFERED || |
215 (dtls_state_ == STATE_NONE && !digest_alg.empty())) { | 217 (dtls_state_ == STATE_NONE && !digest_alg.empty())) { |
216 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."; |
217 return false; | 219 return false; |
218 } | 220 } |
219 | 221 |
220 if (digest_alg.empty()) { | 222 if (digest_alg.empty()) { |
221 LOG_J(LS_INFO, this) << "Other side didn't support DTLS."; | 223 LOG_J(LS_INFO, this) << "Other side didn't support DTLS."; |
222 dtls_state_ = STATE_NONE; | 224 dtls_state_ = STATE_NONE; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 584 |
583 tmp_data += record_len + kDtlsRecordHeaderLen; | 585 tmp_data += record_len + kDtlsRecordHeaderLen; |
584 tmp_size -= record_len + kDtlsRecordHeaderLen; | 586 tmp_size -= record_len + kDtlsRecordHeaderLen; |
585 } | 587 } |
586 | 588 |
587 // Looks good. Pass to the SIC which ends up being passed to | 589 // Looks good. Pass to the SIC which ends up being passed to |
588 // the DTLS stack. | 590 // the DTLS stack. |
589 return downward_->OnPacketReceived(data, size); | 591 return downward_->OnPacketReceived(data, size); |
590 } | 592 } |
591 | 593 |
592 void DtlsTransportChannelWrapper::OnGatheringState( | 594 void DtlsTransportChannelWrapper::OnRequestSignaling( |
593 TransportChannelImpl* channel) { | 595 TransportChannelImpl* channel) { |
594 ASSERT(channel == channel_); | 596 ASSERT(channel == channel_); |
595 SignalGatheringState(this); | 597 SignalRequestSignaling(this); |
596 } | 598 } |
597 | 599 |
598 void DtlsTransportChannelWrapper::OnCandidateGathered( | 600 void DtlsTransportChannelWrapper::OnCandidateReady( |
599 TransportChannelImpl* channel, | 601 TransportChannelImpl* channel, const Candidate& c) { |
600 const Candidate& c) { | |
601 ASSERT(channel == channel_); | 602 ASSERT(channel == channel_); |
602 SignalCandidateGathered(this, c); | 603 SignalCandidateReady(this, c); |
| 604 } |
| 605 |
| 606 void DtlsTransportChannelWrapper::OnCandidatesAllocationDone( |
| 607 TransportChannelImpl* channel) { |
| 608 ASSERT(channel == channel_); |
| 609 SignalCandidatesAllocationDone(this); |
603 } | 610 } |
604 | 611 |
605 void DtlsTransportChannelWrapper::OnRoleConflict( | 612 void DtlsTransportChannelWrapper::OnRoleConflict( |
606 TransportChannelImpl* channel) { | 613 TransportChannelImpl* channel) { |
607 ASSERT(channel == channel_); | 614 ASSERT(channel == channel_); |
608 SignalRoleConflict(this); | 615 SignalRoleConflict(this); |
609 } | 616 } |
610 | 617 |
611 void DtlsTransportChannelWrapper::OnRouteChange( | 618 void DtlsTransportChannelWrapper::OnRouteChange( |
612 TransportChannel* channel, const Candidate& candidate) { | 619 TransportChannel* channel, const Candidate& candidate) { |
613 ASSERT(channel == channel_); | 620 ASSERT(channel == channel_); |
614 SignalRouteChange(this, candidate); | 621 SignalRouteChange(this, candidate); |
615 } | 622 } |
616 | 623 |
617 void DtlsTransportChannelWrapper::OnConnectionRemoved( | 624 void DtlsTransportChannelWrapper::OnConnectionRemoved( |
618 TransportChannelImpl* channel) { | 625 TransportChannelImpl* channel) { |
619 ASSERT(channel == channel_); | 626 ASSERT(channel == channel_); |
620 SignalConnectionRemoved(this); | 627 SignalConnectionRemoved(this); |
621 } | 628 } |
622 | 629 |
623 } // namespace cricket | 630 } // namespace cricket |
OLD | NEW |