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

Side by Side Diff: webrtc/p2p/base/dtlstransport.h

Issue 1318983002: Using 'override' keyword in dtlstransport.h (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 bool GetCertificate_w( 50 bool GetCertificate_w(
51 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override { 51 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override {
52 DCHECK(Base::worker_thread()->IsCurrent()); 52 DCHECK(Base::worker_thread()->IsCurrent());
53 if (!certificate_) 53 if (!certificate_)
54 return false; 54 return false;
55 55
56 *certificate = certificate_; 56 *certificate = certificate_;
57 return true; 57 return true;
58 } 58 }
59 59
60 virtual bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version) { 60 bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version) override {
61 DCHECK(Base::worker_thread()->IsCurrent()); 61 DCHECK(Base::worker_thread()->IsCurrent());
62 ssl_max_version_ = version; 62 ssl_max_version_ = version;
63 return true; 63 return true;
64 } 64 }
65 65
66 virtual bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel, 66 bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel,
67 std::string* error_desc) { 67 std::string* error_desc) override {
68 DCHECK(Base::worker_thread()->IsCurrent()); 68 DCHECK(Base::worker_thread()->IsCurrent());
69 rtc::SSLFingerprint* local_fp = 69 rtc::SSLFingerprint* local_fp =
70 Base::local_description()->identity_fingerprint.get(); 70 Base::local_description()->identity_fingerprint.get();
71 71
72 if (local_fp) { 72 if (local_fp) {
73 // Sanity check local fingerprint. 73 // Sanity check local fingerprint.
74 if (certificate_) { 74 if (certificate_) {
75 rtc::scoped_ptr<rtc::SSLFingerprint> local_fp_tmp( 75 rtc::scoped_ptr<rtc::SSLFingerprint> local_fp_tmp(
76 rtc::SSLFingerprint::Create(local_fp->algorithm, 76 rtc::SSLFingerprint::Create(local_fp->algorithm,
77 certificate_->identity())); 77 certificate_->identity()));
(...skipping 18 matching lines...) Expand all
96 if (!channel->SetLocalIdentity( 96 if (!channel->SetLocalIdentity(
97 certificate_ ? certificate_->identity() : nullptr)) { 97 certificate_ ? certificate_->identity() : nullptr)) {
98 return BadTransportDescription("Failed to set local identity.", 98 return BadTransportDescription("Failed to set local identity.",
99 error_desc); 99 error_desc);
100 } 100 }
101 101
102 // Apply the description in the base class. 102 // Apply the description in the base class.
103 return Base::ApplyLocalTransportDescription_w(channel, error_desc); 103 return Base::ApplyLocalTransportDescription_w(channel, error_desc);
104 } 104 }
105 105
106 virtual bool NegotiateTransportDescription_w(ContentAction local_role, 106 bool NegotiateTransportDescription_w(ContentAction local_role,
107 std::string* error_desc) { 107 std::string* error_desc) override {
108 DCHECK(Base::worker_thread()->IsCurrent()); 108 DCHECK(Base::worker_thread()->IsCurrent());
109 if (!Base::local_description() || !Base::remote_description()) { 109 if (!Base::local_description() || !Base::remote_description()) {
110 const std::string msg = "Local and Remote description must be set before " 110 const std::string msg = "Local and Remote description must be set before "
111 "transport descriptions are negotiated"; 111 "transport descriptions are negotiated";
112 return BadTransportDescription(msg, error_desc); 112 return BadTransportDescription(msg, error_desc);
113 } 113 }
114 114
115 rtc::SSLFingerprint* local_fp = 115 rtc::SSLFingerprint* local_fp =
116 Base::local_description()->identity_fingerprint.get(); 116 Base::local_description()->identity_fingerprint.get();
117 rtc::SSLFingerprint* remote_fp = 117 rtc::SSLFingerprint* remote_fp =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } else { 198 } else {
199 // We are not doing DTLS 199 // We are not doing DTLS
200 remote_fingerprint_.reset(new rtc::SSLFingerprint( 200 remote_fingerprint_.reset(new rtc::SSLFingerprint(
201 "", NULL, 0)); 201 "", NULL, 0));
202 } 202 }
203 203
204 // Now run the negotiation for the base class. 204 // Now run the negotiation for the base class.
205 return Base::NegotiateTransportDescription_w(local_role, error_desc); 205 return Base::NegotiateTransportDescription_w(local_role, error_desc);
206 } 206 }
207 207
208 virtual DtlsTransportChannelWrapper* CreateTransportChannel(int component) { 208 DtlsTransportChannelWrapper* CreateTransportChannel(int component) override {
209 DtlsTransportChannelWrapper* channel = new DtlsTransportChannelWrapper( 209 DtlsTransportChannelWrapper* channel = new DtlsTransportChannelWrapper(
210 this, Base::CreateTransportChannel(component)); 210 this, Base::CreateTransportChannel(component));
211 channel->SetSslMaxProtocolVersion(ssl_max_version_); 211 channel->SetSslMaxProtocolVersion(ssl_max_version_);
212 return channel; 212 return channel;
213 } 213 }
214 214
215 virtual void DestroyTransportChannel(TransportChannelImpl* channel) { 215 void DestroyTransportChannel(TransportChannelImpl* channel) override {
216 // Kind of ugly, but this lets us do the exact inverse of the create. 216 // Kind of ugly, but this lets us do the exact inverse of the create.
217 DtlsTransportChannelWrapper* dtls_channel = 217 DtlsTransportChannelWrapper* dtls_channel =
218 static_cast<DtlsTransportChannelWrapper*>(channel); 218 static_cast<DtlsTransportChannelWrapper*>(channel);
219 TransportChannelImpl* base_channel = dtls_channel->channel(); 219 TransportChannelImpl* base_channel = dtls_channel->channel();
220 delete dtls_channel; 220 delete dtls_channel;
221 Base::DestroyTransportChannel(base_channel); 221 Base::DestroyTransportChannel(base_channel);
222 } 222 }
223 223
224 virtual bool GetSslRole_w(rtc::SSLRole* ssl_role) const { 224 bool GetSslRole_w(rtc::SSLRole* ssl_role) const override {
225 DCHECK(Base::worker_thread()->IsCurrent()); 225 DCHECK(Base::worker_thread()->IsCurrent());
226 ASSERT(ssl_role != NULL); 226 ASSERT(ssl_role != NULL);
227 *ssl_role = secure_role_; 227 *ssl_role = secure_role_;
228 return true; 228 return true;
229 } 229 }
230 230
231 private: 231 private:
232 virtual bool ApplyNegotiatedTransportDescription_w( 232 bool ApplyNegotiatedTransportDescription_w(
233 TransportChannelImpl* channel, 233 TransportChannelImpl* channel,
234 std::string* error_desc) { 234 std::string* error_desc) override {
235 DCHECK(Base::worker_thread()->IsCurrent()); 235 DCHECK(Base::worker_thread()->IsCurrent());
236 // Set ssl role. Role must be set before fingerprint is applied, which 236 // Set ssl role. Role must be set before fingerprint is applied, which
237 // initiates DTLS setup. 237 // initiates DTLS setup.
238 if (!channel->SetSslRole(secure_role_)) { 238 if (!channel->SetSslRole(secure_role_)) {
239 return BadTransportDescription("Failed to set ssl role for the channel.", 239 return BadTransportDescription("Failed to set ssl role for the channel.",
240 error_desc); 240 error_desc);
241 } 241 }
242 // Apply remote fingerprint. 242 // Apply remote fingerprint.
243 if (!channel->SetRemoteFingerprint( 243 if (!channel->SetRemoteFingerprint(
244 remote_fingerprint_->algorithm, 244 remote_fingerprint_->algorithm,
245 reinterpret_cast<const uint8*>(remote_fingerprint_->digest.data()), 245 reinterpret_cast<const uint8*>(remote_fingerprint_->digest.data()),
246 remote_fingerprint_->digest.size())) { 246 remote_fingerprint_->digest.size())) {
247 return BadTransportDescription("Failed to apply remote fingerprint.", 247 return BadTransportDescription("Failed to apply remote fingerprint.",
248 error_desc); 248 error_desc);
249 } 249 }
250 return Base::ApplyNegotiatedTransportDescription_w(channel, error_desc); 250 return Base::ApplyNegotiatedTransportDescription_w(channel, error_desc);
251 } 251 }
252 252
253 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; 253 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
254 rtc::SSLRole secure_role_; 254 rtc::SSLRole secure_role_;
255 rtc::SSLProtocolVersion ssl_max_version_; 255 rtc::SSLProtocolVersion ssl_max_version_;
256 rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint_; 256 rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint_;
257 }; 257 };
258 258
259 } // namespace cricket 259 } // namespace cricket
260 260
261 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORT_H_ 261 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698