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