| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * libjingle | 2  * libjingle | 
| 3  * Copyright 2013 Google Inc. | 3  * Copyright 2013 Google Inc. | 
| 4  * | 4  * | 
| 5  * Redistribution and use in source and binary forms, with or without | 5  * Redistribution and use in source and binary forms, with or without | 
| 6  * modification, are permitted provided that the following conditions are met: | 6  * modification, are permitted provided that the following conditions are met: | 
| 7  * | 7  * | 
| 8  *  1. Redistributions of source code must retain the above copyright notice, | 8  *  1. Redistributions of source code must retain the above copyright notice, | 
| 9  *     this list of conditions and the following disclaimer. | 9  *     this list of conditions and the following disclaimer. | 
| 10  *  2. Redistributions in binary form must reproduce the above copyright notice, | 10  *  2. Redistributions in binary form must reproduce the above copyright notice, | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 183     : WebRtcSessionDescriptionFactory( | 183     : WebRtcSessionDescriptionFactory( | 
| 184         signaling_thread, | 184         signaling_thread, | 
| 185         channel_manager, | 185         channel_manager, | 
| 186         mediastream_signaling, | 186         mediastream_signaling, | 
| 187         dtls_identity_store.Pass(), | 187         dtls_identity_store.Pass(), | 
| 188         new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(), | 188         new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(), | 
| 189         session, | 189         session, | 
| 190         session_id, | 190         session_id, | 
| 191         dct, | 191         dct, | 
| 192         true) { | 192         true) { | 
| 193   DCHECK(dtls_identity_store_); | 193   RTC_DCHECK(dtls_identity_store_); | 
| 194 | 194 | 
| 195   certificate_request_state_ = CERTIFICATE_WAITING; | 195   certificate_request_state_ = CERTIFICATE_WAITING; | 
| 196 | 196 | 
| 197   identity_request_observer_->SignalRequestFailed.connect( | 197   identity_request_observer_->SignalRequestFailed.connect( | 
| 198       this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed); | 198       this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed); | 
| 199   identity_request_observer_->SignalCertificateReady.connect( | 199   identity_request_observer_->SignalCertificateReady.connect( | 
| 200       this, &WebRtcSessionDescriptionFactory::SetCertificate); | 200       this, &WebRtcSessionDescriptionFactory::SetCertificate); | 
| 201 | 201 | 
| 202   rtc::KeyType key_type = rtc::KT_DEFAULT; | 202   rtc::KeyType key_type = rtc::KT_DEFAULT; | 
| 203   LOG(LS_VERBOSE) << "DTLS-SRTP enabled; sending DTLS identity request (key " | 203   LOG(LS_VERBOSE) << "DTLS-SRTP enabled; sending DTLS identity request (key " | 
| 204                   << "type: " << key_type << ")."; | 204                   << "type: " << key_type << ")."; | 
| 205 | 205 | 
| 206   // Request identity. This happens asynchronously, so the caller will have a | 206   // Request identity. This happens asynchronously, so the caller will have a | 
| 207   // chance to connect to SignalIdentityReady. | 207   // chance to connect to SignalIdentityReady. | 
| 208   dtls_identity_store_->RequestIdentity(key_type, identity_request_observer_); | 208   dtls_identity_store_->RequestIdentity(key_type, identity_request_observer_); | 
| 209 } | 209 } | 
| 210 | 210 | 
| 211 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( | 211 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( | 
| 212     rtc::Thread* signaling_thread, | 212     rtc::Thread* signaling_thread, | 
| 213     cricket::ChannelManager* channel_manager, | 213     cricket::ChannelManager* channel_manager, | 
| 214     MediaStreamSignaling* mediastream_signaling, | 214     MediaStreamSignaling* mediastream_signaling, | 
| 215     const rtc::scoped_refptr<rtc::RTCCertificate>& certificate, | 215     const rtc::scoped_refptr<rtc::RTCCertificate>& certificate, | 
| 216     WebRtcSession* session, | 216     WebRtcSession* session, | 
| 217     const std::string& session_id, | 217     const std::string& session_id, | 
| 218     cricket::DataChannelType dct) | 218     cricket::DataChannelType dct) | 
| 219     : WebRtcSessionDescriptionFactory( | 219     : WebRtcSessionDescriptionFactory( | 
| 220         signaling_thread, channel_manager, mediastream_signaling, nullptr, | 220         signaling_thread, channel_manager, mediastream_signaling, nullptr, | 
| 221         nullptr, session, session_id, dct, true) { | 221         nullptr, session, session_id, dct, true) { | 
| 222   DCHECK(certificate); | 222   RTC_DCHECK(certificate); | 
| 223 | 223 | 
| 224   certificate_request_state_ = CERTIFICATE_WAITING; | 224   certificate_request_state_ = CERTIFICATE_WAITING; | 
| 225 | 225 | 
| 226   LOG(LS_VERBOSE) << "DTLS-SRTP enabled; has certificate parameter."; | 226   LOG(LS_VERBOSE) << "DTLS-SRTP enabled; has certificate parameter."; | 
| 227   // We already have a certificate but we wait to do SetIdentity; if we do | 227   // We already have a certificate but we wait to do SetIdentity; if we do | 
| 228   // it in the constructor then the caller has not had a chance to connect to | 228   // it in the constructor then the caller has not had a chance to connect to | 
| 229   // SignalIdentityReady. | 229   // SignalIdentityReady. | 
| 230   signaling_thread_->Post(this, MSG_USE_CONSTRUCTOR_CERTIFICATE, | 230   signaling_thread_->Post(this, MSG_USE_CONSTRUCTOR_CERTIFICATE, | 
| 231                           new rtc::ScopedRefMessageData<rtc::RTCCertificate>( | 231                           new rtc::ScopedRefMessageData<rtc::RTCCertificate>( | 
| 232                               certificate)); | 232                               certificate)); | 
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 510   ASSERT(signaling_thread_->IsCurrent()); | 510   ASSERT(signaling_thread_->IsCurrent()); | 
| 511 | 511 | 
| 512   LOG(LS_ERROR) << "Async identity request failed: error = " << error; | 512   LOG(LS_ERROR) << "Async identity request failed: error = " << error; | 
| 513   certificate_request_state_ = CERTIFICATE_FAILED; | 513   certificate_request_state_ = CERTIFICATE_FAILED; | 
| 514 | 514 | 
| 515   FailPendingRequests(kFailedDueToIdentityFailed); | 515   FailPendingRequests(kFailedDueToIdentityFailed); | 
| 516 } | 516 } | 
| 517 | 517 | 
| 518 void WebRtcSessionDescriptionFactory::SetCertificate( | 518 void WebRtcSessionDescriptionFactory::SetCertificate( | 
| 519     const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { | 519     const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { | 
| 520   DCHECK(certificate); | 520   RTC_DCHECK(certificate); | 
| 521   LOG(LS_VERBOSE) << "Setting new certificate"; | 521   LOG(LS_VERBOSE) << "Setting new certificate"; | 
| 522 | 522 | 
| 523   certificate_request_state_ = CERTIFICATE_SUCCEEDED; | 523   certificate_request_state_ = CERTIFICATE_SUCCEEDED; | 
| 524   SignalCertificateReady(certificate); | 524   SignalCertificateReady(certificate); | 
| 525 | 525 | 
| 526   transport_desc_factory_.set_certificate(certificate); | 526   transport_desc_factory_.set_certificate(certificate); | 
| 527   transport_desc_factory_.set_secure(cricket::SEC_ENABLED); | 527   transport_desc_factory_.set_secure(cricket::SEC_ENABLED); | 
| 528 | 528 | 
| 529   while (!create_session_description_requests_.empty()) { | 529   while (!create_session_description_requests_.empty()) { | 
| 530     if (create_session_description_requests_.front().type == | 530     if (create_session_description_requests_.front().type == | 
| 531         CreateSessionDescriptionRequest::kOffer) { | 531         CreateSessionDescriptionRequest::kOffer) { | 
| 532       InternalCreateOffer(create_session_description_requests_.front()); | 532       InternalCreateOffer(create_session_description_requests_.front()); | 
| 533     } else { | 533     } else { | 
| 534       InternalCreateAnswer(create_session_description_requests_.front()); | 534       InternalCreateAnswer(create_session_description_requests_.front()); | 
| 535     } | 535     } | 
| 536     create_session_description_requests_.pop(); | 536     create_session_description_requests_.pop(); | 
| 537   } | 537   } | 
| 538 } | 538 } | 
| 539 }  // namespace webrtc | 539 }  // namespace webrtc | 
| OLD | NEW | 
|---|