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 local_identity_(NULL), | 98 local_identity_(NULL), |
99 ssl_role_(rtc::SSL_CLIENT), | 99 ssl_role_(rtc::SSL_CLIENT), |
100 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) { | 100 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) { |
101 channel_->SignalReadableState.connect(this, | 101 channel_->SignalReadableState.connect(this, |
102 &DtlsTransportChannelWrapper::OnReadableState); | 102 &DtlsTransportChannelWrapper::OnReadableState); |
103 channel_->SignalWritableState.connect(this, | 103 channel_->SignalWritableState.connect(this, |
104 &DtlsTransportChannelWrapper::OnWritableState); | 104 &DtlsTransportChannelWrapper::OnWritableState); |
105 channel_->SignalReadPacket.connect(this, | 105 channel_->SignalReadPacket.connect(this, |
106 &DtlsTransportChannelWrapper::OnReadPacket); | 106 &DtlsTransportChannelWrapper::OnReadPacket); |
107 channel_->SignalReadyToSend.connect(this, | 107 channel_->SignalReadyToSend.connect(this, |
108 &DtlsTransportChannelWrapper::OnReadyToSend); | 108 &DtlsTransportChannelWrapper::OnReadyToSend); |
109 channel_->SignalRequestSignaling.connect(this, | 109 channel_->SignalGatheringState.connect( |
110 &DtlsTransportChannelWrapper::OnRequestSignaling); | 110 this, &DtlsTransportChannelWrapper::OnGatheringState); |
111 channel_->SignalCandidateReady.connect(this, | 111 channel_->SignalCandidateGathered.connect( |
112 &DtlsTransportChannelWrapper::OnCandidateReady); | 112 this, &DtlsTransportChannelWrapper::OnCandidateGathered); |
113 channel_->SignalCandidatesAllocationDone.connect(this, | |
114 &DtlsTransportChannelWrapper::OnCandidatesAllocationDone); | |
115 channel_->SignalRoleConflict.connect(this, | 113 channel_->SignalRoleConflict.connect(this, |
116 &DtlsTransportChannelWrapper::OnRoleConflict); | 114 &DtlsTransportChannelWrapper::OnRoleConflict); |
117 channel_->SignalRouteChange.connect(this, | 115 channel_->SignalRouteChange.connect(this, |
118 &DtlsTransportChannelWrapper::OnRouteChange); | 116 &DtlsTransportChannelWrapper::OnRouteChange); |
119 channel_->SignalConnectionRemoved.connect(this, | 117 channel_->SignalConnectionRemoved.connect(this, |
120 &DtlsTransportChannelWrapper::OnConnectionRemoved); | 118 &DtlsTransportChannelWrapper::OnConnectionRemoved); |
121 channel_->SignalReceivingState.connect(this, | 119 channel_->SignalReceivingState.connect(this, |
122 &DtlsTransportChannelWrapper::OnReceivingState); | 120 &DtlsTransportChannelWrapper::OnReceivingState); |
123 } | 121 } |
124 | 122 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 606 |
609 tmp_data += record_len + kDtlsRecordHeaderLen; | 607 tmp_data += record_len + kDtlsRecordHeaderLen; |
610 tmp_size -= record_len + kDtlsRecordHeaderLen; | 608 tmp_size -= record_len + kDtlsRecordHeaderLen; |
611 } | 609 } |
612 | 610 |
613 // Looks good. Pass to the SIC which ends up being passed to | 611 // Looks good. Pass to the SIC which ends up being passed to |
614 // the DTLS stack. | 612 // the DTLS stack. |
615 return downward_->OnPacketReceived(data, size); | 613 return downward_->OnPacketReceived(data, size); |
616 } | 614 } |
617 | 615 |
618 void DtlsTransportChannelWrapper::OnRequestSignaling( | 616 void DtlsTransportChannelWrapper::OnGatheringState( |
619 TransportChannelImpl* channel) { | 617 TransportChannelImpl* channel) { |
620 ASSERT(channel == channel_); | 618 ASSERT(channel == channel_); |
621 SignalRequestSignaling(this); | 619 SignalGatheringState(this); |
622 } | 620 } |
623 | 621 |
624 void DtlsTransportChannelWrapper::OnCandidateReady( | 622 void DtlsTransportChannelWrapper::OnCandidateGathered( |
625 TransportChannelImpl* channel, const Candidate& c) { | 623 TransportChannelImpl* channel, |
| 624 const Candidate& c) { |
626 ASSERT(channel == channel_); | 625 ASSERT(channel == channel_); |
627 SignalCandidateReady(this, c); | 626 SignalCandidateGathered(this, c); |
628 } | |
629 | |
630 void DtlsTransportChannelWrapper::OnCandidatesAllocationDone( | |
631 TransportChannelImpl* channel) { | |
632 ASSERT(channel == channel_); | |
633 SignalCandidatesAllocationDone(this); | |
634 } | 627 } |
635 | 628 |
636 void DtlsTransportChannelWrapper::OnRoleConflict( | 629 void DtlsTransportChannelWrapper::OnRoleConflict( |
637 TransportChannelImpl* channel) { | 630 TransportChannelImpl* channel) { |
638 ASSERT(channel == channel_); | 631 ASSERT(channel == channel_); |
639 SignalRoleConflict(this); | 632 SignalRoleConflict(this); |
640 } | 633 } |
641 | 634 |
642 void DtlsTransportChannelWrapper::OnRouteChange( | 635 void DtlsTransportChannelWrapper::OnRouteChange( |
643 TransportChannel* channel, const Candidate& candidate) { | 636 TransportChannel* channel, const Candidate& candidate) { |
644 ASSERT(channel == channel_); | 637 ASSERT(channel == channel_); |
645 SignalRouteChange(this, candidate); | 638 SignalRouteChange(this, candidate); |
646 } | 639 } |
647 | 640 |
648 void DtlsTransportChannelWrapper::OnConnectionRemoved( | 641 void DtlsTransportChannelWrapper::OnConnectionRemoved( |
649 TransportChannelImpl* channel) { | 642 TransportChannelImpl* channel) { |
650 ASSERT(channel == channel_); | 643 ASSERT(channel == channel_); |
651 SignalConnectionRemoved(this); | 644 SignalConnectionRemoved(this); |
652 } | 645 } |
653 | 646 |
654 } // namespace cricket | 647 } // namespace cricket |
OLD | NEW |