| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return ret; | 97 return ret; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void StreamInterfaceChannel::Close() { | 100 void StreamInterfaceChannel::Close() { |
| 101 packets_.Clear(); | 101 packets_.Clear(); |
| 102 state_ = rtc::SS_CLOSED; | 102 state_ = rtc::SS_CLOSED; |
| 103 } | 103 } |
| 104 | 104 |
| 105 DtlsTransportChannelWrapper::DtlsTransportChannelWrapper( | 105 DtlsTransportChannelWrapper::DtlsTransportChannelWrapper( |
| 106 TransportChannelImpl* channel) | 106 TransportChannelImpl* channel) |
| 107 : TransportChannelImpl(channel->transport_name(), channel->component()), | 107 : transport_name_(channel->transport_name()), |
| 108 component_(channel->component()), |
| 108 network_thread_(rtc::Thread::Current()), | 109 network_thread_(rtc::Thread::Current()), |
| 109 channel_(channel), | 110 channel_(channel), |
| 110 downward_(NULL), | 111 downward_(NULL), |
| 111 ssl_role_(rtc::SSL_CLIENT), | 112 ssl_role_(rtc::SSL_CLIENT), |
| 112 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12) { | 113 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12) { |
| 113 channel_->SignalWritableState.connect(this, | 114 channel_->SignalWritableState.connect(this, |
| 114 &DtlsTransportChannelWrapper::OnWritableState); | 115 &DtlsTransportChannelWrapper::OnWritableState); |
| 115 channel_->SignalReadPacket.connect(this, | 116 channel_->SignalReadPacket.connect(this, |
| 116 &DtlsTransportChannelWrapper::OnReadPacket); | 117 &DtlsTransportChannelWrapper::OnReadPacket); |
| 117 channel_->SignalSentPacket.connect( | 118 channel_->SignalSentPacket.connect( |
| 118 this, &DtlsTransportChannelWrapper::OnSentPacket); | 119 this, &DtlsTransportChannelWrapper::OnSentPacket); |
| 119 channel_->SignalReadyToSend.connect(this, | 120 channel_->SignalReadyToSend.connect(this, |
| 120 &DtlsTransportChannelWrapper::OnReadyToSend); | 121 &DtlsTransportChannelWrapper::OnReadyToSend); |
| 121 channel_->SignalGatheringState.connect( | |
| 122 this, &DtlsTransportChannelWrapper::OnGatheringState); | |
| 123 channel_->SignalCandidateGathered.connect( | |
| 124 this, &DtlsTransportChannelWrapper::OnCandidateGathered); | |
| 125 channel_->SignalCandidatesRemoved.connect( | |
| 126 this, &DtlsTransportChannelWrapper::OnCandidatesRemoved); | |
| 127 channel_->SignalRoleConflict.connect(this, | |
| 128 &DtlsTransportChannelWrapper::OnRoleConflict); | |
| 129 channel_->SignalRouteChange.connect(this, | |
| 130 &DtlsTransportChannelWrapper::OnRouteChange); | |
| 131 channel_->SignalSelectedCandidatePairChanged.connect( | |
| 132 this, &DtlsTransportChannelWrapper::OnSelectedCandidatePairChanged); | |
| 133 channel_->SignalStateChanged.connect( | |
| 134 this, &DtlsTransportChannelWrapper::OnChannelStateChanged); | |
| 135 channel_->SignalReceivingState.connect(this, | 122 channel_->SignalReceivingState.connect(this, |
| 136 &DtlsTransportChannelWrapper::OnReceivingState); | 123 &DtlsTransportChannelWrapper::OnReceivingState); |
| 137 } | 124 } |
| 138 | 125 |
| 139 DtlsTransportChannelWrapper::~DtlsTransportChannelWrapper() { | 126 DtlsTransportChannelWrapper::~DtlsTransportChannelWrapper() { |
| 140 } | 127 } |
| 141 | 128 |
| 142 bool DtlsTransportChannelWrapper::SetLocalCertificate( | 129 bool DtlsTransportChannelWrapper::SetLocalCertificate( |
| 143 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { | 130 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { |
| 144 if (dtls_active_) { | 131 if (dtls_active_) { |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 663 |
| 677 tmp_data += record_len + kDtlsRecordHeaderLen; | 664 tmp_data += record_len + kDtlsRecordHeaderLen; |
| 678 tmp_size -= record_len + kDtlsRecordHeaderLen; | 665 tmp_size -= record_len + kDtlsRecordHeaderLen; |
| 679 } | 666 } |
| 680 | 667 |
| 681 // Looks good. Pass to the SIC which ends up being passed to | 668 // Looks good. Pass to the SIC which ends up being passed to |
| 682 // the DTLS stack. | 669 // the DTLS stack. |
| 683 return downward_->OnPacketReceived(data, size); | 670 return downward_->OnPacketReceived(data, size); |
| 684 } | 671 } |
| 685 | 672 |
| 686 void DtlsTransportChannelWrapper::OnGatheringState( | |
| 687 TransportChannelImpl* channel) { | |
| 688 ASSERT(channel == channel_); | |
| 689 SignalGatheringState(this); | |
| 690 } | |
| 691 | |
| 692 void DtlsTransportChannelWrapper::OnCandidateGathered( | |
| 693 TransportChannelImpl* channel, | |
| 694 const Candidate& c) { | |
| 695 ASSERT(channel == channel_); | |
| 696 SignalCandidateGathered(this, c); | |
| 697 } | |
| 698 | |
| 699 void DtlsTransportChannelWrapper::OnCandidatesRemoved( | |
| 700 TransportChannelImpl* channel, | |
| 701 const Candidates& candidates) { | |
| 702 ASSERT(channel == channel_); | |
| 703 SignalCandidatesRemoved(this, candidates); | |
| 704 } | |
| 705 | |
| 706 void DtlsTransportChannelWrapper::OnRoleConflict( | |
| 707 TransportChannelImpl* channel) { | |
| 708 ASSERT(channel == channel_); | |
| 709 SignalRoleConflict(this); | |
| 710 } | |
| 711 | |
| 712 void DtlsTransportChannelWrapper::OnRouteChange( | |
| 713 TransportChannel* channel, const Candidate& candidate) { | |
| 714 ASSERT(channel == channel_); | |
| 715 SignalRouteChange(this, candidate); | |
| 716 } | |
| 717 | |
| 718 void DtlsTransportChannelWrapper::OnSelectedCandidatePairChanged( | |
| 719 TransportChannel* channel, | |
| 720 CandidatePairInterface* selected_candidate_pair, | |
| 721 int last_sent_packet_id, | |
| 722 bool ready_to_send) { | |
| 723 ASSERT(channel == channel_); | |
| 724 SignalSelectedCandidatePairChanged(this, selected_candidate_pair, | |
| 725 last_sent_packet_id, ready_to_send); | |
| 726 } | |
| 727 | |
| 728 void DtlsTransportChannelWrapper::OnChannelStateChanged( | |
| 729 TransportChannelImpl* channel) { | |
| 730 ASSERT(channel == channel_); | |
| 731 SignalStateChanged(this); | |
| 732 } | |
| 733 | |
| 734 void DtlsTransportChannelWrapper::OnDtlsHandshakeError( | 673 void DtlsTransportChannelWrapper::OnDtlsHandshakeError( |
| 735 rtc::SSLHandshakeError error) { | 674 rtc::SSLHandshakeError error) { |
| 736 SignalDtlsHandshakeError(error); | 675 SignalDtlsHandshakeError(error); |
| 737 } | 676 } |
| 738 | 677 |
| 678 void DtlsTransportChannelWrapper::set_receiving(bool receiving) { |
| 679 if (receiving_ == receiving) { |
| 680 return; |
| 681 } |
| 682 receiving_ = receiving; |
| 683 SignalReceivingState(this); |
| 684 } |
| 685 |
| 686 void DtlsTransportChannelWrapper::set_writable(bool writable) { |
| 687 if (writable_ == writable) { |
| 688 return; |
| 689 } |
| 690 LOG_J(LS_VERBOSE, this) << "set_writable from:" << writable_ << " to " |
| 691 << writable; |
| 692 writable_ = writable; |
| 693 if (writable_) { |
| 694 SignalReadyToSend(this); |
| 695 } |
| 696 SignalWritableState(this); |
| 697 } |
| 698 |
| 699 void DtlsTransportChannelWrapper::set_dtls_state(DtlsTransportState state) { |
| 700 if (dtls_state_ == state) { |
| 701 return; |
| 702 } |
| 703 LOG_J(LS_VERBOSE, this) << "set_dtls_state from:" << dtls_state_ << " to " |
| 704 << state; |
| 705 dtls_state_ = state; |
| 706 SignalDtlsState(this, state); |
| 707 } |
| 708 |
| 739 } // namespace cricket | 709 } // namespace cricket |
| OLD | NEW |