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

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

Issue 1246913005: TransportController refactoring (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
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
11 #ifndef WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_ 11 #ifndef WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_
12 #define WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_ 12 #define WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_
13 13
14 #include "webrtc/base/scoped_ptr.h"
14 #include "webrtc/p2p/base/transportdescription.h" 15 #include "webrtc/p2p/base/transportdescription.h"
15 16
16 namespace rtc { 17 namespace rtc {
17 class SSLIdentity; 18 class SSLIdentity;
18 } 19 }
19 20
20 namespace cricket { 21 namespace cricket {
21 22
22 struct TransportOptions { 23 struct TransportOptions {
23 TransportOptions() : ice_restart(false), prefer_passive_role(false) {} 24 TransportOptions() : ice_restart(false), prefer_passive_role(false) {}
24 bool ice_restart; 25 bool ice_restart;
25 bool prefer_passive_role; 26 bool prefer_passive_role;
26 }; 27 };
27 28
28 // Creates transport descriptions according to the supplied configuration. 29 // Creates transport descriptions according to the supplied configuration.
29 // When creating answers, performs the appropriate negotiation 30 // When creating answers, performs the appropriate negotiation
30 // of the various fields to determine the proper result. 31 // of the various fields to determine the proper result.
31 class TransportDescriptionFactory { 32 class TransportDescriptionFactory {
32 public: 33 public:
33 // Default ctor; use methods below to set configuration. 34 // Default ctor; use methods below to set configuration.
34 TransportDescriptionFactory(); 35 TransportDescriptionFactory();
35 SecurePolicy secure() const { return secure_; } 36 SecurePolicy secure() const { return secure_; }
36 // The identity to use when setting up DTLS. 37 // The identity to use when setting up DTLS.
37 rtc::SSLIdentity* identity() const { return identity_; } 38 rtc::SSLIdentity* identity() const { return identity_.get(); }
38 39
39 // Specifies the transport security policy to use. 40 // Specifies the transport security policy to use.
40 void set_secure(SecurePolicy s) { secure_ = s; } 41 void set_secure(SecurePolicy s) { secure_ = s; }
41 // Specifies the identity to use (only used when secure is not SEC_DISABLED). 42 // Specifies the identity to use (only used when secure is not SEC_DISABLED).
42 void set_identity(rtc::SSLIdentity* identity) { identity_ = identity; } 43 void set_identity(rtc::SSLIdentity* identity) {
44 identity_.reset(identity->GetReference());
45 }
43 46
44 // Creates a transport description suitable for use in an offer. 47 // Creates a transport description suitable for use in an offer.
45 TransportDescription* CreateOffer(const TransportOptions& options, 48 TransportDescription* CreateOffer(const TransportOptions& options,
46 const TransportDescription* current_description) const; 49 const TransportDescription* current_description) const;
47 // Create a transport description that is a response to an offer. 50 // Create a transport description that is a response to an offer.
48 TransportDescription* CreateAnswer( 51 TransportDescription* CreateAnswer(
49 const TransportDescription* offer, 52 const TransportDescription* offer,
50 const TransportOptions& options, 53 const TransportOptions& options,
51 const TransportDescription* current_description) const; 54 const TransportDescription* current_description) const;
52 55
53 private: 56 private:
54 bool SetSecurityInfo(TransportDescription* description, 57 bool SetSecurityInfo(TransportDescription* description,
55 ConnectionRole role) const; 58 ConnectionRole role) const;
56 59
57 SecurePolicy secure_; 60 SecurePolicy secure_;
58 rtc::SSLIdentity* identity_; 61 ::rtc::scoped_ptr<rtc::SSLIdentity> identity_;
59 }; 62 };
60 63
61 } // namespace cricket 64 } // namespace cricket
62 65
63 #endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_ 66 #endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698