| 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 #include "webrtc/p2p/base/transportdescriptionfactory.h" | 11 #include "webrtc/p2p/base/transportdescriptionfactory.h" |
| 12 | 12 |
| 13 #include <memory> |
| 14 |
| 13 #include "webrtc/p2p/base/transportdescription.h" | 15 #include "webrtc/p2p/base/transportdescription.h" |
| 14 #include "webrtc/base/helpers.h" | 16 #include "webrtc/base/helpers.h" |
| 15 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/base/messagedigest.h" | 18 #include "webrtc/base/messagedigest.h" |
| 17 #include "webrtc/base/sslfingerprint.h" | 19 #include "webrtc/base/sslfingerprint.h" |
| 18 | 20 |
| 19 namespace cricket { | 21 namespace cricket { |
| 20 | 22 |
| 21 TransportDescriptionFactory::TransportDescriptionFactory() | 23 TransportDescriptionFactory::TransportDescriptionFactory() |
| 22 : secure_(SEC_DISABLED) { | 24 : secure_(SEC_DISABLED) { |
| 23 } | 25 } |
| 24 | 26 |
| 25 TransportDescription* TransportDescriptionFactory::CreateOffer( | 27 TransportDescription* TransportDescriptionFactory::CreateOffer( |
| 26 const TransportOptions& options, | 28 const TransportOptions& options, |
| 27 const TransportDescription* current_description) const { | 29 const TransportDescription* current_description) const { |
| 28 rtc::scoped_ptr<TransportDescription> desc(new TransportDescription()); | 30 std::unique_ptr<TransportDescription> desc(new TransportDescription()); |
| 29 | 31 |
| 30 // Generate the ICE credentials if we don't already have them. | 32 // Generate the ICE credentials if we don't already have them. |
| 31 if (!current_description || options.ice_restart) { | 33 if (!current_description || options.ice_restart) { |
| 32 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); | 34 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); |
| 33 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); | 35 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); |
| 34 } else { | 36 } else { |
| 35 desc->ice_ufrag = current_description->ice_ufrag; | 37 desc->ice_ufrag = current_description->ice_ufrag; |
| 36 desc->ice_pwd = current_description->ice_pwd; | 38 desc->ice_pwd = current_description->ice_pwd; |
| 37 } | 39 } |
| 38 | 40 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 const TransportDescription* offer, | 54 const TransportDescription* offer, |
| 53 const TransportOptions& options, | 55 const TransportOptions& options, |
| 54 const TransportDescription* current_description) const { | 56 const TransportDescription* current_description) const { |
| 55 // TODO(juberti): Figure out why we get NULL offers, and fix this upstream. | 57 // TODO(juberti): Figure out why we get NULL offers, and fix this upstream. |
| 56 if (!offer) { | 58 if (!offer) { |
| 57 LOG(LS_WARNING) << "Failed to create TransportDescription answer " << | 59 LOG(LS_WARNING) << "Failed to create TransportDescription answer " << |
| 58 "because offer is NULL"; | 60 "because offer is NULL"; |
| 59 return NULL; | 61 return NULL; |
| 60 } | 62 } |
| 61 | 63 |
| 62 rtc::scoped_ptr<TransportDescription> desc(new TransportDescription()); | 64 std::unique_ptr<TransportDescription> desc(new TransportDescription()); |
| 63 // Generate the ICE credentials if we don't already have them or ice is | 65 // Generate the ICE credentials if we don't already have them or ice is |
| 64 // being restarted. | 66 // being restarted. |
| 65 if (!current_description || options.ice_restart) { | 67 if (!current_description || options.ice_restart) { |
| 66 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); | 68 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); |
| 67 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); | 69 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); |
| 68 } else { | 70 } else { |
| 69 desc->ice_ufrag = current_description->ice_ufrag; | 71 desc->ice_ufrag = current_description->ice_ufrag; |
| 70 desc->ice_pwd = current_description->ice_pwd; | 72 desc->ice_pwd = current_description->ice_pwd; |
| 71 } | 73 } |
| 72 | 74 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 << digest_alg; | 119 << digest_alg; |
| 118 return false; | 120 return false; |
| 119 } | 121 } |
| 120 | 122 |
| 121 // Assign security role. | 123 // Assign security role. |
| 122 desc->connection_role = role; | 124 desc->connection_role = role; |
| 123 return true; | 125 return true; |
| 124 } | 126 } |
| 125 | 127 |
| 126 } // namespace cricket | 128 } // namespace cricket |
| OLD | NEW |