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: talk/app/webrtc/webrtcsession.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 13 matching lines...) Expand all
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_ 28 #ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_
29 #define TALK_APP_WEBRTC_WEBRTCSESSION_H_ 29 #define TALK_APP_WEBRTC_WEBRTCSESSION_H_
30 30
31 #include <string> 31 #include <string>
32 32
33 #include "talk/app/webrtc/datachannel.h" 33 #include "talk/app/webrtc/datachannel.h"
34 #include "talk/app/webrtc/dtlscertificate.h"
34 #include "talk/app/webrtc/dtmfsender.h" 35 #include "talk/app/webrtc/dtmfsender.h"
35 #include "talk/app/webrtc/mediastreamprovider.h" 36 #include "talk/app/webrtc/mediastreamprovider.h"
36 #include "talk/app/webrtc/peerconnectioninterface.h" 37 #include "talk/app/webrtc/peerconnectioninterface.h"
37 #include "talk/app/webrtc/statstypes.h" 38 #include "talk/app/webrtc/statstypes.h"
38 #include "talk/media/base/mediachannel.h" 39 #include "talk/media/base/mediachannel.h"
39 #include "webrtc/p2p/base/session.h" 40 #include "webrtc/p2p/base/session.h"
40 #include "talk/session/media/mediasession.h" 41 #include "talk/session/media/mediasession.h"
41 #include "webrtc/base/sigslot.h" 42 #include "webrtc/base/sigslot.h"
42 #include "webrtc/base/sslidentity.h" 43 #include "webrtc/base/sslidentity.h"
43 #include "webrtc/base/thread.h" 44 #include "webrtc/base/thread.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 rtc::Thread* worker_thread, 122 rtc::Thread* worker_thread,
122 cricket::PortAllocator* port_allocator, 123 cricket::PortAllocator* port_allocator,
123 MediaStreamSignaling* mediastream_signaling); 124 MediaStreamSignaling* mediastream_signaling);
124 virtual ~WebRtcSession(); 125 virtual ~WebRtcSession();
125 126
126 bool Initialize( 127 bool Initialize(
127 const PeerConnectionFactoryInterface::Options& options, 128 const PeerConnectionFactoryInterface::Options& options,
128 const MediaConstraintsInterface* constraints, 129 const MediaConstraintsInterface* constraints,
129 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 130 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
130 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); 131 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
132 bool Initialize(
133 const PeerConnectionFactoryInterface::Options& options,
134 const MediaConstraintsInterface* constraints,
135 const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate,
136 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
131 // Deletes the voice, video and data channel and changes the session state 137 // Deletes the voice, video and data channel and changes the session state
132 // to STATE_RECEIVEDTERMINATE. 138 // to STATE_RECEIVEDTERMINATE.
133 void Terminate(); 139 void Terminate();
134 140
135 void RegisterIceObserver(IceObserver* observer) { 141 void RegisterIceObserver(IceObserver* observer) {
136 ice_observer_ = observer; 142 ice_observer_ = observer;
137 } 143 }
138 144
139 virtual cricket::VoiceChannel* voice_channel() { 145 virtual cricket::VoiceChannel* voice_channel() {
140 return voice_channel_.get(); 146 return voice_channel_.get();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 rtc::scoped_refptr<DataChannel> CreateDataChannel( 245 rtc::scoped_refptr<DataChannel> CreateDataChannel(
240 const std::string& label, 246 const std::string& label,
241 const InternalDataChannelInit* config) override; 247 const InternalDataChannelInit* config) override;
242 248
243 cricket::DataChannelType data_channel_type() const; 249 cricket::DataChannelType data_channel_type() const;
244 250
245 bool IceRestartPending() const; 251 bool IceRestartPending() const;
246 252
247 void ResetIceRestartLatch(); 253 void ResetIceRestartLatch();
248 254
249 // Called when an SSLIdentity is generated or retrieved by 255 // Called when a DtlsCertificate is generated or retrieved by
250 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. 256 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription.
251 void OnIdentityReady(rtc::SSLIdentity* identity); 257 void OnCertificateReady(
258 const rtc::scoped_refptr<DtlsCertificate>& certificate);
252 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); 259 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp);
253 260
254 // For unit test. 261 // For unit test.
255 bool waiting_for_identity() const; 262 bool IsWaitingForCertificate() const;
263 rtc::scoped_refptr<DtlsCertificate> certificate() const {
tommi (sloooow) - chröme 2015/08/18 14:49:35 const scoped_refptr<>& Can this be called safely
264 return certificate_;
265 }
256 266
257 void set_metrics_observer( 267 void set_metrics_observer(
258 webrtc::MetricsObserverInterface* metrics_observer) { 268 webrtc::MetricsObserverInterface* metrics_observer) {
259 metrics_observer_ = metrics_observer; 269 metrics_observer_ = metrics_observer;
260 } 270 }
261 271
262 private: 272 private:
263 // Indicates the type of SessionDescription in a call to SetLocalDescription 273 // Indicates the type of SessionDescription in a call to SetLocalDescription
264 // and SetRemoteDescription. 274 // and SetRemoteDescription.
265 enum Action { 275 enum Action {
266 kOffer, 276 kOffer,
267 kPrAnswer, 277 kPrAnswer,
268 kAnswer, 278 kAnswer,
269 }; 279 };
270 280
281 bool InitializeInternal(
282 const PeerConnectionFactoryInterface::Options& options,
283 const MediaConstraintsInterface* constraints,
284 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
285 void InitializeFactoryAfterConstruction(
286 const PeerConnectionFactoryInterface::Options& options);
287
271 // Invokes ConnectChannels() on transport proxies, which initiates ice 288 // Invokes ConnectChannels() on transport proxies, which initiates ice
272 // candidates allocation. 289 // candidates allocation.
273 bool StartCandidatesAllocation(); 290 bool StartCandidatesAllocation();
274 bool UpdateSessionState(Action action, cricket::ContentSource source, 291 bool UpdateSessionState(Action action, cricket::ContentSource source,
275 std::string* err_desc); 292 std::string* err_desc);
276 static Action GetAction(const std::string& type); 293 static Action GetAction(const std::string& type);
277 // Push the media parts of the local or remote session description 294 // Push the media parts of the local or remote session description
278 // down to all of the channels. 295 // down to all of the channels.
279 bool PushdownMediaDescription(cricket::ContentAction action, 296 bool PushdownMediaDescription(cricket::ContentAction action,
280 cricket::ContentSource source, 297 cricket::ContentSource source,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 bool dtls_enabled_; 403 bool dtls_enabled_;
387 // Specifies which kind of data channel is allowed. This is controlled 404 // Specifies which kind of data channel is allowed. This is controlled
388 // by the chrome command-line flag and constraints: 405 // by the chrome command-line flag and constraints:
389 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, 406 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled,
390 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is 407 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is
391 // not set or false, SCTP is allowed (DCT_SCTP); 408 // not set or false, SCTP is allowed (DCT_SCTP);
392 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); 409 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP);
393 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). 410 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE).
394 cricket::DataChannelType data_channel_type_; 411 cricket::DataChannelType data_channel_type_;
395 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; 412 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_;
413 rtc::scoped_refptr<DtlsCertificate> certificate_;
396 414
397 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> 415 rtc::scoped_ptr<WebRtcSessionDescriptionFactory>
398 webrtc_session_desc_factory_; 416 webrtc_session_desc_factory_;
399 417
400 sigslot::signal0<> SignalVoiceChannelDestroyed; 418 sigslot::signal0<> SignalVoiceChannelDestroyed;
401 sigslot::signal0<> SignalVideoChannelDestroyed; 419 sigslot::signal0<> SignalVideoChannelDestroyed;
402 sigslot::signal0<> SignalDataChannelDestroyed; 420 sigslot::signal0<> SignalDataChannelDestroyed;
403 421
404 // Member variables for caching global options. 422 // Member variables for caching global options.
405 cricket::AudioOptions audio_options_; 423 cricket::AudioOptions audio_options_;
406 cricket::VideoOptions video_options_; 424 cricket::VideoOptions video_options_;
407 MetricsObserverInterface* metrics_observer_; 425 MetricsObserverInterface* metrics_observer_;
408 426
409 // Declares the bundle policy for the WebRTCSession. 427 // Declares the bundle policy for the WebRTCSession.
410 PeerConnectionInterface::BundlePolicy bundle_policy_; 428 PeerConnectionInterface::BundlePolicy bundle_policy_;
411 429
412 // Declares the RTCP mux policy for the WebRTCSession. 430 // Declares the RTCP mux policy for the WebRTCSession.
413 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; 431 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_;
414 432
415 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); 433 DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
416 }; 434 };
417 } // namespace webrtc 435 } // namespace webrtc
418 436
419 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ 437 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698