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