Renamed dtlstransportchannel.h/.cc/_unittest.cc.

Renamed the dtlstransportchannel.h/.cc to dtlstransport.h/.cc which are
the right names for those files because the concept of DtlsTransportChannel
no longer exists.

BUG=None

Review-Url: https://codereview.webrtc.org/3004503002
Cr-Commit-Position: refs/heads/master@{#19478}
This commit is contained in:
zhihuang 2017-08-23 18:05:50 -07:00 committed by Commit Bot
parent 96de428fd1
commit ca6d3b60b5
7 changed files with 56 additions and 58 deletions

View File

@ -27,8 +27,8 @@ rtc_static_library("rtc_p2p") {
"base/basicpacketsocketfactory.h",
"base/candidate.h",
"base/common.h",
"base/dtlstransportchannel.cc",
"base/dtlstransportchannel.h",
"base/dtlstransport.cc",
"base/dtlstransport.h",
"base/dtlstransportinternal.h",
"base/icetransportinternal.h",
"base/jseptransport.cc",
@ -174,7 +174,7 @@ if (rtc_include_tests) {
}
sources = [
"base/asyncstuntcpsocket_unittest.cc",
"base/dtlstransportchannel_unittest.cc",
"base/dtlstransport_unittest.cc",
"base/jseptransport_unittest.cc",
"base/p2ptransportchannel_unittest.cc",
"base/packetlossestimator_unittest.cc",

View File

@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <algorithm>
#include <memory>
#include <utility>
#include "webrtc/p2p/base/dtlstransportchannel.h"
#include "webrtc/p2p/base/dtlstransport.h"
#include "webrtc/p2p/base/common.h"
#include "webrtc/p2p/base/packettransportinternal.h"
@ -62,9 +63,9 @@ StreamInterfaceChannel::StreamInterfaceChannel(
packets_(kMaxPendingPackets, kMaxDtlsPacketLen) {}
rtc::StreamResult StreamInterfaceChannel::Read(void* buffer,
size_t buffer_len,
size_t* read,
int* error) {
size_t buffer_len,
size_t* read,
int* error) {
if (state_ == rtc::SS_CLOSED)
return rtc::SR_EOS;
if (state_ == rtc::SS_OPENING)
@ -78,9 +79,9 @@ rtc::StreamResult StreamInterfaceChannel::Read(void* buffer,
}
rtc::StreamResult StreamInterfaceChannel::Write(const void* data,
size_t data_len,
size_t* written,
int* error) {
size_t data_len,
size_t* written,
int* error) {
// Always succeeds, since this is an unreliable transport anyway.
// TODO(zhihuang): Should this block if ice_transport_'s temporarily
// unwritable?
@ -329,7 +330,6 @@ bool DtlsTransport::GetSrtpCryptoSuite(int* cipher) {
return dtls_->GetDtlsSrtpCryptoSuite(cipher);
}
// Called from upper layers to send a media packet.
int DtlsTransport::SendPacket(const char* data,
size_t size,
@ -671,8 +671,7 @@ void DtlsTransport::ConfigureHandshakeTimeout() {
// Limit the timeout to a reasonable range in case the ICE RTT takes
// extreme values.
int initial_timeout = std::max(kMinHandshakeTimeout,
std::min(kMaxHandshakeTimeout,
2 * (*rtt)));
std::min(kMaxHandshakeTimeout, 2 * (*rtt)));
LOG_J(LS_INFO, this) << "configuring DTLS handshake timeout "
<< initial_timeout << " based on ICE RTT " << *rtt;
@ -683,5 +682,4 @@ void DtlsTransport::ConfigureHandshakeTimeout() {
}
}
} // namespace cricket

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
#define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
#define WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
#include <memory>
#include <string>
@ -58,7 +58,6 @@ class StreamInterfaceChannel : public rtc::StreamInterface {
RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterfaceChannel);
};
// This class provides a DTLS SSLStreamAdapter inside a TransportChannel-style
// packet-based interface, wrapping an existing TransportChannel instance
// (e.g a P2PTransportChannel)
@ -116,7 +115,6 @@ class DtlsTransport : public DtlsTransportInternal {
const uint8_t* digest,
size_t digest_len) override;
// Called to send a packet (via DTLS, if turned on).
int SendPacket(const char* data,
size_t size,
@ -152,11 +150,10 @@ class DtlsTransport : public DtlsTransportInternal {
bool use_context,
uint8_t* result,
size_t result_len) override {
return (dtls_.get()) ? dtls_->ExportKeyingMaterial(label, context,
context_len,
use_context,
result, result_len)
: false;
return (dtls_.get())
? dtls_->ExportKeyingMaterial(label, context, context_len,
use_context, result, result_len)
: false;
}
IceTransportInternal* ice_transport() override { return ice_transport_; }
@ -217,7 +214,7 @@ class DtlsTransport : public DtlsTransportInternal {
std::unique_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream
StreamInterfaceChannel*
downward_; // Wrapper for ice_transport_, owned by dtls_.
std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS.
std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS.
bool dtls_active_ = false;
rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
rtc::SSLRole ssl_role_;
@ -239,4 +236,4 @@ class DtlsTransport : public DtlsTransportInternal {
} // namespace cricket
#endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
#endif // WEBRTC_P2P_BASE_DTLSTRANSPORT_H_

View File

@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <algorithm>
#include <memory>
#include <set>
#include "webrtc/p2p/base/dtlstransportchannel.h"
#include "webrtc/p2p/base/dtlstransport.h"
#include "webrtc/p2p/base/fakeicetransport.h"
#include "webrtc/p2p/base/packettransportinternal.h"
#include "webrtc/rtc_base/checks.h"
@ -68,7 +69,7 @@ enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 };
// configuration directly instead of negotiating TransportDescriptions.
class DtlsTestClient : public sigslot::has_slots<> {
public:
DtlsTestClient(const std::string& name) : name_(name) {}
explicit DtlsTestClient(const std::string& name) : name_(name) {}
void CreateCertificate(rtc::KeyType key_type) {
certificate_ =
rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
@ -134,8 +135,10 @@ class DtlsTestClient : public sigslot::has_slots<> {
// Offer DTLS if we have an identity; pass in a remote fingerprint only if
// both sides support DTLS.
void Negotiate(DtlsTestClient* peer, cricket::ContentAction action,
ConnectionRole local_role, ConnectionRole remote_role,
void Negotiate(DtlsTestClient* peer,
cricket::ContentAction action,
ConnectionRole local_role,
ConnectionRole remote_role,
int flags) {
Negotiate(certificate_, certificate_ ? peer->certificate_ : nullptr, action,
local_role, remote_role, flags);
@ -319,9 +322,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
received_.clear();
}
size_t NumPacketsReceived() {
return received_.size();
}
size_t NumPacketsReceived() { return received_.size(); }
bool VerifyPacket(const char* data, size_t size, uint32_t* out_num) {
if (size != packet_size_ ||
@ -501,14 +502,16 @@ class DtlsTransportChannelTestBase {
rtc::SSLRole client1_ssl_role =
(client1_role == cricket::CONNECTIONROLE_ACTIVE ||
(client2_role == cricket::CONNECTIONROLE_PASSIVE &&
client1_role == cricket::CONNECTIONROLE_ACTPASS)) ?
rtc::SSL_CLIENT : rtc::SSL_SERVER;
client1_role == cricket::CONNECTIONROLE_ACTPASS))
? rtc::SSL_CLIENT
: rtc::SSL_SERVER;
rtc::SSLRole client2_ssl_role =
(client2_role == cricket::CONNECTIONROLE_ACTIVE ||
(client1_role == cricket::CONNECTIONROLE_PASSIVE &&
client2_role == cricket::CONNECTIONROLE_ACTPASS)) ?
rtc::SSL_CLIENT : rtc::SSL_SERVER;
client2_role == cricket::CONNECTIONROLE_ACTPASS))
? rtc::SSL_CLIENT
: rtc::SSL_SERVER;
client1_.CheckRole(client1_ssl_role);
client2_.CheckRole(client2_ssl_role);
@ -546,10 +549,10 @@ class DtlsTransportChannelTestBase {
client1_.SetupChannels(channel_ct_, cricket::ICEROLE_CONTROLLING);
client2_.SetupChannels(channel_ct_, cricket::ICEROLE_CONTROLLED);
// Expect success from SLTD and SRTD.
client1_.Negotiate(&client2_, cricket::CA_OFFER,
client1_role, client2_role, 0);
client2_.Negotiate(&client1_, cricket::CA_ANSWER,
client2_role, client1_role, 0);
client1_.Negotiate(&client2_, cricket::CA_OFFER, client1_role, client2_role,
0);
client2_.Negotiate(&client1_, cricket::CA_ANSWER, client2_role,
client1_role, 0);
}
// Negotiate with legacy client |client2|. Legacy client doesn't use setup
@ -567,18 +570,19 @@ class DtlsTransportChannelTestBase {
}
void Renegotiate(DtlsTestClient* reoffer_initiator,
ConnectionRole client1_role, ConnectionRole client2_role,
ConnectionRole client1_role,
ConnectionRole client2_role,
int flags) {
if (reoffer_initiator == &client1_) {
client1_.Negotiate(&client2_, cricket::CA_OFFER,
client1_role, client2_role, flags);
client2_.Negotiate(&client1_, cricket::CA_ANSWER,
client2_role, client1_role, flags);
client1_.Negotiate(&client2_, cricket::CA_OFFER, client1_role,
client2_role, flags);
client2_.Negotiate(&client1_, cricket::CA_ANSWER, client2_role,
client1_role, flags);
} else {
client2_.Negotiate(&client1_, cricket::CA_OFFER,
client2_role, client1_role, flags);
client1_.Negotiate(&client2_, cricket::CA_ANSWER,
client1_role, client2_role, flags);
client2_.Negotiate(&client1_, cricket::CA_OFFER, client2_role,
client1_role, flags);
client1_.Negotiate(&client2_, cricket::CA_ANSWER, client1_role,
client2_role, flags);
}
}
@ -802,8 +806,8 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) {
SetChannelCount(2);
PrepareDtls(true, true, rtc::KT_DEFAULT);
// Initial role for client1 is ACTPASS and client2 is ACTIVE.
ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS,
cricket::CONNECTIONROLE_ACTIVE));
ASSERT_TRUE(
Connect(cricket::CONNECTIONROLE_ACTPASS, cricket::CONNECTIONROLE_ACTIVE));
TestTransfer(0, 1000, 100, true);
TestTransfer(1, 1000, 100, true);
// Using input roles for the re-offer.
@ -817,8 +821,8 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromAnswerer) {
SetChannelCount(2);
PrepareDtls(true, true, rtc::KT_DEFAULT);
// Initial role for client1 is ACTPASS and client2 is ACTIVE.
ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS,
cricket::CONNECTIONROLE_ACTIVE));
ASSERT_TRUE(
Connect(cricket::CONNECTIONROLE_ACTPASS, cricket::CONNECTIONROLE_ACTIVE));
TestTransfer(0, 1000, 100, true);
TestTransfer(1, 1000, 100, true);
// Using input roles for the re-offer.
@ -837,8 +841,7 @@ TEST_F(DtlsTransportChannelTest, TestDtlsRoleReversal) {
// Renegotiate from client2 with actpass and client1 as active.
Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTPASS,
cricket::CONNECTIONROLE_ACTIVE,
NF_REOFFER | NF_EXPECT_FAILURE);
cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER | NF_EXPECT_FAILURE);
}
// Test that using different setup attributes which results in similar ssl

View File

@ -14,7 +14,7 @@
#include <utility> // for std::pair
#include "webrtc/p2p/base/candidate.h"
#include "webrtc/p2p/base/dtlstransportchannel.h"
#include "webrtc/p2p/base/dtlstransport.h"
#include "webrtc/p2p/base/p2pconstants.h"
#include "webrtc/p2p/base/p2ptransportchannel.h"
#include "webrtc/p2p/base/port.h"

View File

@ -17,7 +17,7 @@
#include <vector>
#include "webrtc/p2p/base/candidate.h"
#include "webrtc/p2p/base/dtlstransportchannel.h"
#include "webrtc/p2p/base/dtlstransport.h"
#include "webrtc/p2p/base/jseptransport.h"
#include "webrtc/p2p/base/p2ptransportchannel.h"
#include "webrtc/rtc_base/asyncinvoker.h"

View File

@ -11,7 +11,7 @@
#include <map>
#include <memory>
#include "webrtc/p2p/base/dtlstransportchannel.h"
#include "webrtc/p2p/base/dtlstransport.h"
#include "webrtc/p2p/base/fakeportallocator.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/p2p/base/p2ptransportchannel.h"