Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1170)

Side by Side Diff: webrtc/p2p/base/dtlstransportchannel.cc

Issue 2590063002: Make P2PTransportChannel inherit from IceTransportInternal. (Closed)
Patch Set: Modified the debug_name(). Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return false; 43 return false;
44 } 44 }
45 const uint8_t* u = reinterpret_cast<const uint8_t*>(data); 45 const uint8_t* u = reinterpret_cast<const uint8_t*>(data);
46 return len > 17 && u[0] == 22 && u[13] == 1; 46 return len > 17 && u[0] == 22 && u[13] == 1;
47 } 47 }
48 static bool IsRtpPacket(const char* data, size_t len) { 48 static bool IsRtpPacket(const char* data, size_t len) {
49 const uint8_t* u = reinterpret_cast<const uint8_t*>(data); 49 const uint8_t* u = reinterpret_cast<const uint8_t*>(data);
50 return (len >= kMinRtpPacketLen && (u[0] & 0xC0) == 0x80); 50 return (len >= kMinRtpPacketLen && (u[0] & 0xC0) == 0x80);
51 } 51 }
52 52
53 StreamInterfaceChannel::StreamInterfaceChannel(TransportChannel* channel) 53 StreamInterfaceChannel::StreamInterfaceChannel(IceTransportInternal* channel)
54 : channel_(channel), 54 : channel_(channel),
55 state_(rtc::SS_OPEN), 55 state_(rtc::SS_OPEN),
56 packets_(kMaxPendingPackets, kMaxDtlsPacketLen) { 56 packets_(kMaxPendingPackets, kMaxDtlsPacketLen) {}
57 }
58 57
59 rtc::StreamResult StreamInterfaceChannel::Read(void* buffer, 58 rtc::StreamResult StreamInterfaceChannel::Read(void* buffer,
60 size_t buffer_len, 59 size_t buffer_len,
61 size_t* read, 60 size_t* read,
62 int* error) { 61 int* error) {
63 if (state_ == rtc::SS_CLOSED) 62 if (state_ == rtc::SS_CLOSED)
64 return rtc::SR_EOS; 63 return rtc::SR_EOS;
65 if (state_ == rtc::SS_OPENING) 64 if (state_ == rtc::SS_OPENING)
66 return rtc::SR_BLOCK; 65 return rtc::SR_BLOCK;
67 66
(...skipping 28 matching lines...) Expand all
96 } 95 }
97 return ret; 96 return ret;
98 } 97 }
99 98
100 void StreamInterfaceChannel::Close() { 99 void StreamInterfaceChannel::Close() {
101 packets_.Clear(); 100 packets_.Clear();
102 state_ = rtc::SS_CLOSED; 101 state_ = rtc::SS_CLOSED;
103 } 102 }
104 103
105 DtlsTransportChannelWrapper::DtlsTransportChannelWrapper( 104 DtlsTransportChannelWrapper::DtlsTransportChannelWrapper(
106 TransportChannelImpl* channel) 105 IceTransportInternal* channel)
107 : TransportChannelImpl(channel->transport_name(), channel->component()), 106 : TransportChannelImpl(channel->transport_name(), channel->component()),
108 network_thread_(rtc::Thread::Current()), 107 network_thread_(rtc::Thread::Current()),
109 channel_(channel), 108 channel_(channel),
110 downward_(NULL), 109 downward_(NULL),
111 ssl_role_(rtc::SSL_CLIENT), 110 ssl_role_(rtc::SSL_CLIENT),
112 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12) { 111 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12) {
113 channel_->SignalWritableState.connect(this, 112 channel_->SignalWritableState.connect(this,
114 &DtlsTransportChannelWrapper::OnWritableState); 113 &DtlsTransportChannelWrapper::OnWritableState);
115 channel_->SignalReadPacket.connect(this, 114 channel_->SignalReadPacket.connect(this,
116 &DtlsTransportChannelWrapper::OnReadPacket); 115 &DtlsTransportChannelWrapper::OnReadPacket);
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 tmp_data += record_len + kDtlsRecordHeaderLen; 676 tmp_data += record_len + kDtlsRecordHeaderLen;
678 tmp_size -= record_len + kDtlsRecordHeaderLen; 677 tmp_size -= record_len + kDtlsRecordHeaderLen;
679 } 678 }
680 679
681 // Looks good. Pass to the SIC which ends up being passed to 680 // Looks good. Pass to the SIC which ends up being passed to
682 // the DTLS stack. 681 // the DTLS stack.
683 return downward_->OnPacketReceived(data, size); 682 return downward_->OnPacketReceived(data, size);
684 } 683 }
685 684
686 void DtlsTransportChannelWrapper::OnGatheringState( 685 void DtlsTransportChannelWrapper::OnGatheringState(
687 TransportChannelImpl* channel) { 686 IceTransportInternal* channel) {
688 ASSERT(channel == channel_); 687 ASSERT(channel == channel_);
689 SignalGatheringState(this); 688 SignalGatheringState(this);
690 } 689 }
691 690
692 void DtlsTransportChannelWrapper::OnCandidateGathered( 691 void DtlsTransportChannelWrapper::OnCandidateGathered(
693 TransportChannelImpl* channel, 692 IceTransportInternal* channel,
694 const Candidate& c) { 693 const Candidate& c) {
695 ASSERT(channel == channel_); 694 ASSERT(channel == channel_);
696 SignalCandidateGathered(this, c); 695 SignalCandidateGathered(this, c);
697 } 696 }
698 697
699 void DtlsTransportChannelWrapper::OnCandidatesRemoved( 698 void DtlsTransportChannelWrapper::OnCandidatesRemoved(
700 TransportChannelImpl* channel, 699 IceTransportInternal* channel,
701 const Candidates& candidates) { 700 const Candidates& candidates) {
702 ASSERT(channel == channel_); 701 ASSERT(channel == channel_);
703 SignalCandidatesRemoved(this, candidates); 702 SignalCandidatesRemoved(this, candidates);
704 } 703 }
705 704
706 void DtlsTransportChannelWrapper::OnRoleConflict( 705 void DtlsTransportChannelWrapper::OnRoleConflict(
707 TransportChannelImpl* channel) { 706 IceTransportInternal* channel) {
708 ASSERT(channel == channel_); 707 ASSERT(channel == channel_);
709 SignalRoleConflict(this); 708 SignalRoleConflict(this);
710 } 709 }
711 710
712 void DtlsTransportChannelWrapper::OnRouteChange( 711 void DtlsTransportChannelWrapper::OnRouteChange(IceTransportInternal* channel,
713 TransportChannel* channel, const Candidate& candidate) { 712 const Candidate& candidate) {
714 ASSERT(channel == channel_); 713 ASSERT(channel == channel_);
715 SignalRouteChange(this, candidate); 714 SignalRouteChange(this, candidate);
716 } 715 }
717 716
718 void DtlsTransportChannelWrapper::OnSelectedCandidatePairChanged( 717 void DtlsTransportChannelWrapper::OnSelectedCandidatePairChanged(
719 TransportChannel* channel, 718 IceTransportInternal* channel,
720 CandidatePairInterface* selected_candidate_pair, 719 CandidatePairInterface* selected_candidate_pair,
721 int last_sent_packet_id, 720 int last_sent_packet_id,
722 bool ready_to_send) { 721 bool ready_to_send) {
723 ASSERT(channel == channel_); 722 ASSERT(channel == channel_);
724 SignalSelectedCandidatePairChanged(this, selected_candidate_pair, 723 SignalSelectedCandidatePairChanged(this, selected_candidate_pair,
725 last_sent_packet_id, ready_to_send); 724 last_sent_packet_id, ready_to_send);
726 } 725 }
727 726
728 void DtlsTransportChannelWrapper::OnChannelStateChanged( 727 void DtlsTransportChannelWrapper::OnChannelStateChanged(
729 TransportChannelImpl* channel) { 728 IceTransportInternal* channel) {
730 ASSERT(channel == channel_); 729 ASSERT(channel == channel_);
731 SignalStateChanged(this); 730 SignalStateChanged(this);
732 } 731 }
733 732
734 void DtlsTransportChannelWrapper::OnDtlsHandshakeError( 733 void DtlsTransportChannelWrapper::OnDtlsHandshakeError(
735 rtc::SSLHandshakeError error) { 734 rtc::SSLHandshakeError error) {
736 SignalDtlsHandshakeError(error); 735 SignalDtlsHandshakeError(error);
737 } 736 }
738 737
739 } // namespace cricket 738 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/dtlstransportchannel.h ('k') | webrtc/p2p/base/dtlstransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698