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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 std::unique_ptr<TransportDescription> desc(new TransportDescription()); | 30 std::unique_ptr<TransportDescription> desc(new TransportDescription()); |
31 | 31 |
32 // Generate the ICE credentials if we don't already have them. | 32 // Generate the ICE credentials if we don't already have them. |
33 if (!current_description || options.ice_restart) { | 33 if (!current_description || options.ice_restart) { |
34 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); | 34 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); |
35 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); | 35 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); |
36 } else { | 36 } else { |
37 desc->ice_ufrag = current_description->ice_ufrag; | 37 desc->ice_ufrag = current_description->ice_ufrag; |
38 desc->ice_pwd = current_description->ice_pwd; | 38 desc->ice_pwd = current_description->ice_pwd; |
39 } | 39 } |
| 40 if (options.enable_ice_renomination) { |
| 41 desc->AddOption(ICE_RENOMINATION_STR); |
| 42 } |
40 | 43 |
41 // If we are trying to establish a secure transport, add a fingerprint. | 44 // If we are trying to establish a secure transport, add a fingerprint. |
42 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { | 45 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { |
43 // Fail if we can't create the fingerprint. | 46 // Fail if we can't create the fingerprint. |
44 // If we are the initiator set role to "actpass". | 47 // If we are the initiator set role to "actpass". |
45 if (!SetSecurityInfo(desc.get(), CONNECTIONROLE_ACTPASS)) { | 48 if (!SetSecurityInfo(desc.get(), CONNECTIONROLE_ACTPASS)) { |
46 return NULL; | 49 return NULL; |
47 } | 50 } |
48 } | 51 } |
49 | 52 |
(...skipping 14 matching lines...) Expand all Loading... |
64 std::unique_ptr<TransportDescription> desc(new TransportDescription()); | 67 std::unique_ptr<TransportDescription> desc(new TransportDescription()); |
65 // Generate the ICE credentials if we don't already have them or ice is | 68 // Generate the ICE credentials if we don't already have them or ice is |
66 // being restarted. | 69 // being restarted. |
67 if (!current_description || options.ice_restart) { | 70 if (!current_description || options.ice_restart) { |
68 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); | 71 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); |
69 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); | 72 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); |
70 } else { | 73 } else { |
71 desc->ice_ufrag = current_description->ice_ufrag; | 74 desc->ice_ufrag = current_description->ice_ufrag; |
72 desc->ice_pwd = current_description->ice_pwd; | 75 desc->ice_pwd = current_description->ice_pwd; |
73 } | 76 } |
| 77 if (options.enable_ice_renomination) { |
| 78 desc->AddOption(ICE_RENOMINATION_STR); |
| 79 } |
74 | 80 |
75 // Negotiate security params. | 81 // Negotiate security params. |
76 if (offer && offer->identity_fingerprint.get()) { | 82 if (offer && offer->identity_fingerprint.get()) { |
77 // The offer supports DTLS, so answer with DTLS, as long as we support it. | 83 // The offer supports DTLS, so answer with DTLS, as long as we support it. |
78 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { | 84 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { |
79 // Fail if we can't create the fingerprint. | 85 // Fail if we can't create the fingerprint. |
80 // Setting DTLS role to active. | 86 // Setting DTLS role to active. |
81 ConnectionRole role = (options.prefer_passive_role) ? | 87 ConnectionRole role = (options.prefer_passive_role) ? |
82 CONNECTIONROLE_PASSIVE : CONNECTIONROLE_ACTIVE; | 88 CONNECTIONROLE_PASSIVE : CONNECTIONROLE_ACTIVE; |
83 | 89 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 << digest_alg; | 125 << digest_alg; |
120 return false; | 126 return false; |
121 } | 127 } |
122 | 128 |
123 // Assign security role. | 129 // Assign security role. |
124 desc->connection_role = role; | 130 desc->connection_role = role; |
125 return true; | 131 return true; |
126 } | 132 } |
127 | 133 |
128 } // namespace cricket | 134 } // namespace cricket |
OLD | NEW |