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

Side by Side Diff: talk/app/webrtc/webrtcsessiondescriptionfactory.h

Issue 1288033009: RTCCertificates added to RTCConfiguration, used by WebRtcSession/-DescriptionFactory (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed torbjorng's comment and merged with master 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
OLDNEW
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 15 matching lines...) Expand all
26 */ 26 */
27 27
28 #ifndef TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ 28 #ifndef TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
29 #define TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ 29 #define TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
30 30
31 #include "talk/app/webrtc/dtlsidentitystore.h" 31 #include "talk/app/webrtc/dtlsidentitystore.h"
32 #include "talk/app/webrtc/peerconnectioninterface.h" 32 #include "talk/app/webrtc/peerconnectioninterface.h"
33 #include "talk/session/media/mediasession.h" 33 #include "talk/session/media/mediasession.h"
34 #include "webrtc/p2p/base/transportdescriptionfactory.h" 34 #include "webrtc/p2p/base/transportdescriptionfactory.h"
35 #include "webrtc/base/messagehandler.h" 35 #include "webrtc/base/messagehandler.h"
36 #include "webrtc/base/rtccertificate.h"
36 37
37 namespace cricket { 38 namespace cricket {
38 class ChannelManager; 39 class ChannelManager;
39 class TransportDescriptionFactory; 40 class TransportDescriptionFactory;
40 } // namespace cricket 41 } // namespace cricket
41 42
42 namespace webrtc { 43 namespace webrtc {
43 class CreateSessionDescriptionObserver; 44 class CreateSessionDescriptionObserver;
44 class MediaConstraintsInterface; 45 class MediaConstraintsInterface;
45 class MediaStreamSignaling; 46 class MediaStreamSignaling;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }; 81 };
81 82
82 // This class is used to create offer/answer session description with regards to 83 // This class is used to create offer/answer session description with regards to
83 // the async DTLS identity generation for WebRtcSession. 84 // the async DTLS identity generation for WebRtcSession.
84 // It queues the create offer/answer request until the DTLS identity 85 // It queues the create offer/answer request until the DTLS identity
85 // request has completed, i.e. when OnIdentityRequestFailed or OnIdentityReady 86 // request has completed, i.e. when OnIdentityRequestFailed or OnIdentityReady
86 // is called. 87 // is called.
87 class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, 88 class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
88 public sigslot::has_slots<> { 89 public sigslot::has_slots<> {
89 public: 90 public:
91 // Construct with DTLS disabled.
92 WebRtcSessionDescriptionFactory(
93 rtc::Thread* signaling_thread,
94 cricket::ChannelManager* channel_manager,
95 MediaStreamSignaling* mediastream_signaling,
96 WebRtcSession* session,
97 const std::string& session_id,
98 cricket::DataChannelType dct);
99
100 // Construct with DTLS enabled using the specified |dtls_identity_store| to
101 // generate a certificate.
90 WebRtcSessionDescriptionFactory( 102 WebRtcSessionDescriptionFactory(
91 rtc::Thread* signaling_thread, 103 rtc::Thread* signaling_thread,
92 cricket::ChannelManager* channel_manager, 104 cricket::ChannelManager* channel_manager,
93 MediaStreamSignaling* mediastream_signaling, 105 MediaStreamSignaling* mediastream_signaling,
94 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 106 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
95 // TODO(jiayl): remove the dependency on session once bug 2264 is fixed.
96 WebRtcSession* session, 107 WebRtcSession* session,
97 const std::string& session_id, 108 const std::string& session_id,
98 cricket::DataChannelType dct, 109 cricket::DataChannelType dct);
99 bool dtls_enabled); 110
111 // Construct with DTLS enabled using the specified (already generated)
112 // |certificate|.
113 WebRtcSessionDescriptionFactory(
114 rtc::Thread* signaling_thread,
115 cricket::ChannelManager* channel_manager,
116 MediaStreamSignaling* mediastream_signaling,
117 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate,
118 WebRtcSession* session,
119 const std::string& session_id,
120 cricket::DataChannelType dct);
100 virtual ~WebRtcSessionDescriptionFactory(); 121 virtual ~WebRtcSessionDescriptionFactory();
101 122
102 static void CopyCandidatesFromSessionDescription( 123 static void CopyCandidatesFromSessionDescription(
103 const SessionDescriptionInterface* source_desc, 124 const SessionDescriptionInterface* source_desc,
104 SessionDescriptionInterface* dest_desc); 125 SessionDescriptionInterface* dest_desc);
105 126
106 void CreateOffer( 127 void CreateOffer(
107 CreateSessionDescriptionObserver* observer, 128 CreateSessionDescriptionObserver* observer,
108 const PeerConnectionInterface::RTCOfferAnswerOptions& options); 129 const PeerConnectionInterface::RTCOfferAnswerOptions& options);
109 void CreateAnswer( 130 void CreateAnswer(
110 CreateSessionDescriptionObserver* observer, 131 CreateSessionDescriptionObserver* observer,
111 const MediaConstraintsInterface* constraints); 132 const MediaConstraintsInterface* constraints);
112 133
113 void SetSdesPolicy(cricket::SecurePolicy secure_policy); 134 void SetSdesPolicy(cricket::SecurePolicy secure_policy);
114 cricket::SecurePolicy SdesPolicy() const; 135 cricket::SecurePolicy SdesPolicy() const;
115 136
116 sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady; 137 sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady;
117 138
118 // For testing. 139 // For testing.
119 bool waiting_for_identity() const { 140 bool waiting_for_certificate_for_testing() const {
120 return identity_request_state_ == IDENTITY_WAITING; 141 return certificate_request_state_ == CERTIFICATE_WAITING;
121 } 142 }
122 143
123 private: 144 private:
124 enum IdentityRequestState { 145 enum CertificateRequestState {
125 IDENTITY_NOT_NEEDED, 146 CERTIFICATE_NOT_NEEDED,
126 IDENTITY_WAITING, 147 CERTIFICATE_WAITING,
127 IDENTITY_SUCCEEDED, 148 CERTIFICATE_SUCCEEDED,
128 IDENTITY_FAILED, 149 CERTIFICATE_FAILED,
129 }; 150 };
130 151
152 WebRtcSessionDescriptionFactory(
153 rtc::Thread* signaling_thread,
154 cricket::ChannelManager* channel_manager,
155 MediaStreamSignaling* mediastream_signaling,
156 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
157 const rtc::scoped_refptr<WebRtcIdentityRequestObserver>&
158 identity_request_observer,
159 WebRtcSession* session,
160 const std::string& session_id,
161 cricket::DataChannelType dct,
162 bool dtls_enabled);
163
131 // MessageHandler implementation. 164 // MessageHandler implementation.
132 virtual void OnMessage(rtc::Message* msg); 165 virtual void OnMessage(rtc::Message* msg);
133 166
134 void InternalCreateOffer(CreateSessionDescriptionRequest request); 167 void InternalCreateOffer(CreateSessionDescriptionRequest request);
135 void InternalCreateAnswer(CreateSessionDescriptionRequest request); 168 void InternalCreateAnswer(CreateSessionDescriptionRequest request);
136 // Posts failure notifications for all pending session description requests. 169 // Posts failure notifications for all pending session description requests.
137 void FailPendingRequests(const std::string& reason); 170 void FailPendingRequests(const std::string& reason);
138 void PostCreateSessionDescriptionFailed( 171 void PostCreateSessionDescriptionFailed(
139 CreateSessionDescriptionObserver* observer, 172 CreateSessionDescriptionObserver* observer,
140 const std::string& error); 173 const std::string& error);
141 void PostCreateSessionDescriptionSucceeded( 174 void PostCreateSessionDescriptionSucceeded(
142 CreateSessionDescriptionObserver* observer, 175 CreateSessionDescriptionObserver* observer,
143 SessionDescriptionInterface* description); 176 SessionDescriptionInterface* description);
144 177
145 void OnIdentityRequestFailed(int error); 178 void OnIdentityRequestFailed(int error);
146 void SetIdentity(rtc::SSLIdentity* identity); 179 void SetIdentity(rtc::SSLIdentity* identity);
147 180
148 std::queue<CreateSessionDescriptionRequest> 181 std::queue<CreateSessionDescriptionRequest>
149 create_session_description_requests_; 182 create_session_description_requests_;
150 rtc::Thread* const signaling_thread_; 183 rtc::Thread* const signaling_thread_;
151 MediaStreamSignaling* const mediastream_signaling_; 184 MediaStreamSignaling* const mediastream_signaling_;
152 cricket::TransportDescriptionFactory transport_desc_factory_; 185 cricket::TransportDescriptionFactory transport_desc_factory_;
153 cricket::MediaSessionDescriptionFactory session_desc_factory_; 186 cricket::MediaSessionDescriptionFactory session_desc_factory_;
154 uint64 session_version_; 187 uint64 session_version_;
155 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_; 188 const rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_;
156 rtc::scoped_refptr<WebRtcIdentityRequestObserver> identity_request_observer_; 189 const rtc::scoped_refptr<WebRtcIdentityRequestObserver>
190 identity_request_observer_;
191 // TODO(jiayl): remove the dependency on session once bug 2264 is fixed.
157 WebRtcSession* const session_; 192 WebRtcSession* const session_;
158 const std::string session_id_; 193 const std::string session_id_;
159 const cricket::DataChannelType data_channel_type_; 194 const cricket::DataChannelType data_channel_type_;
160 IdentityRequestState identity_request_state_; 195 CertificateRequestState certificate_request_state_;
161 196
162 DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory); 197 DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory);
163 }; 198 };
164 } // namespace webrtc 199 } // namespace webrtc
165 200
166 #endif // TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ 201 #endif // TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | talk/app/webrtc/webrtcsessiondescriptionfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698