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

Unified Diff: webrtc/p2p/base/fakesession.h

Issue 1269843005: Added DtlsCertificate, a ref counted object owning an SSLIdentity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge with master Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/fakesession.h
diff --git a/webrtc/p2p/base/fakesession.h b/webrtc/p2p/base/fakesession.h
index 67b770ae5c1236b04e2869e01aaa27015f9769ec..366c41f2622f62a76d9cbf1cc58349b658aa0ecc 100644
--- a/webrtc/p2p/base/fakesession.h
+++ b/webrtc/p2p/base/fakesession.h
@@ -49,7 +49,7 @@ class FakeTransportChannel : public TransportChannelImpl,
dest_(NULL),
state_(STATE_INIT),
async_(false),
- identity_(NULL),
+ certificate_(nullptr),
do_dtls_(false),
role_(ICEROLE_UNKNOWN),
tiebreaker_(0),
@@ -153,7 +153,7 @@ class FakeTransportChannel : public TransportChannelImpl,
// This simulates the delivery of candidates.
dest_ = dest;
dest_->dest_ = this;
- if (identity_ && dest_->identity_) {
+ if (certificate_ && dest_->certificate_) {
do_dtls_ = true;
dest_->do_dtls_ = true;
NegotiateSrtpCiphers();
@@ -224,8 +224,9 @@ class FakeTransportChannel : public TransportChannelImpl,
delete data;
}
- bool SetLocalIdentity(rtc::SSLIdentity* identity) {
- identity_ = identity;
+ bool SetLocalCertificate(
+ const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate) override {
+ certificate_ = certificate;
return true;
}
@@ -255,15 +256,16 @@ class FakeTransportChannel : public TransportChannelImpl,
return false;
}
- virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const {
- if (!identity_)
+ bool GetLocalCertificate(
+ rtc::scoped_refptr<webrtc::DtlsCertificate>* certificate) const override {
+ if (!certificate_.get())
return false;
- *identity = identity_->GetReference();
+ *certificate = certificate_;
return true;
}
- virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const {
+ bool GetRemoteCertificate(rtc::SSLCertificate** cert) const override {
if (!remote_cert_)
return false;
@@ -313,7 +315,7 @@ class FakeTransportChannel : public TransportChannelImpl,
FakeTransportChannel* dest_;
State state_;
bool async_;
- rtc::SSLIdentity* identity_;
+ rtc::scoped_refptr<webrtc::DtlsCertificate> certificate_;
rtc::FakeSSLCertificate* remote_cert_;
bool do_dtls_;
std::vector<std::string> srtp_ciphers_;
@@ -340,12 +342,12 @@ class FakeTransport : public Transport {
FakeTransport(rtc::Thread* signaling_thread,
rtc::Thread* worker_thread,
const std::string& content_name,
- PortAllocator* alllocator = NULL)
+ PortAllocator* alllocator = nullptr)
: Transport(signaling_thread, worker_thread,
- content_name, "test_type", NULL),
- dest_(NULL),
+ content_name, "test_type", nullptr),
+ dest_(nullptr),
async_(false),
- identity_(NULL) {
+ certificate_(nullptr) {
}
~FakeTransport() {
DestroyAllChannels();
@@ -358,7 +360,7 @@ class FakeTransport : public Transport {
dest_ = dest;
for (ChannelMap::iterator it = channels_.begin(); it != channels_.end();
++it) {
- it->second->SetLocalIdentity(identity_);
+ it->second->SetLocalCertificate(certificate_);
SetChannelDestination(it->first, it->second);
}
}
@@ -370,8 +372,9 @@ class FakeTransport : public Transport {
}
}
- void set_identity(rtc::SSLIdentity* identity) {
- identity_ = identity;
+ void set_certificate(
+ const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate) {
+ certificate_ = certificate;
}
using Transport::local_description;
@@ -393,14 +396,16 @@ class FakeTransport : public Transport {
channels_.erase(channel->component());
delete channel;
}
- virtual void SetIdentity_w(rtc::SSLIdentity* identity) {
- identity_ = identity;
+ void SetCertificate_w(
+ const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate) override {
+ certificate_ = certificate;
}
- virtual bool GetIdentity_w(rtc::SSLIdentity** identity) {
- if (!identity_)
+ bool GetCertificate_w(
+ rtc::scoped_refptr<webrtc::DtlsCertificate>* certificate) override {
+ if (!certificate_.get())
return false;
- *identity = identity_->GetReference();
+ *certificate = certificate_;
return true;
}
@@ -415,7 +420,7 @@ class FakeTransport : public Transport {
if (dest_) {
dest_channel = dest_->GetFakeChannel(component);
if (dest_channel) {
- dest_channel->SetLocalIdentity(dest_->identity_);
+ dest_channel->SetLocalCertificate(dest_->certificate_);
}
}
channel->SetDestination(dest_channel);
@@ -426,7 +431,7 @@ class FakeTransport : public Transport {
ChannelMap channels_;
FakeTransport* dest_;
bool async_;
- rtc::SSLIdentity* identity_;
+ rtc::scoped_refptr<webrtc::DtlsCertificate> certificate_;
};
// Fake session class, which can be passed into a BaseChannel object for
@@ -482,13 +487,14 @@ class FakeSession : public BaseSession {
}
// TODO: Hoist this into Session when we re-work the Session code.
- void set_ssl_identity(rtc::SSLIdentity* identity) {
+ void set_ssl_certificate(
+ const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate) {
for (TransportMap::const_iterator it = transport_proxies().begin();
it != transport_proxies().end(); ++it) {
// We know that we have a FakeTransport*
- static_cast<FakeTransport*>(it->second->impl())->set_identity
- (identity);
+ static_cast<FakeTransport*>(it->second->impl())->set_certificate
+ (certificate);
}
}

Powered by Google App Engine
This is Rietveld 408576698