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 desc->AddOption(ICE_OPTION_TRICKLE); | |
pthatcher1
2017/04/21 01:09:54
And rename AddOption to AddIceOption
| |
40 if (options.enable_ice_renomination) { | 41 if (options.enable_ice_renomination) { |
41 desc->AddOption(ICE_RENOMINATION_STR); | 42 desc->AddOption(ICE_OPTION_RENOMINATION); |
42 } | 43 } |
43 | 44 |
44 // If we are trying to establish a secure transport, add a fingerprint. | 45 // If we are trying to establish a secure transport, add a fingerprint. |
45 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { | 46 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { |
46 // Fail if we can't create the fingerprint. | 47 // Fail if we can't create the fingerprint. |
47 // If we are the initiator set role to "actpass". | 48 // If we are the initiator set role to "actpass". |
48 if (!SetSecurityInfo(desc.get(), CONNECTIONROLE_ACTPASS)) { | 49 if (!SetSecurityInfo(desc.get(), CONNECTIONROLE_ACTPASS)) { |
49 return NULL; | 50 return NULL; |
50 } | 51 } |
51 } | 52 } |
(...skipping 16 matching lines...) Expand all Loading... | |
68 std::unique_ptr<TransportDescription> desc(new TransportDescription()); | 69 std::unique_ptr<TransportDescription> desc(new TransportDescription()); |
69 // Generate the ICE credentials if we don't already have them or ice is | 70 // Generate the ICE credentials if we don't already have them or ice is |
70 // being restarted. | 71 // being restarted. |
71 if (!current_description || options.ice_restart) { | 72 if (!current_description || options.ice_restart) { |
72 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); | 73 desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH); |
73 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); | 74 desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH); |
74 } else { | 75 } else { |
75 desc->ice_ufrag = current_description->ice_ufrag; | 76 desc->ice_ufrag = current_description->ice_ufrag; |
76 desc->ice_pwd = current_description->ice_pwd; | 77 desc->ice_pwd = current_description->ice_pwd; |
77 } | 78 } |
79 desc->AddOption(ICE_OPTION_TRICKLE); | |
78 if (options.enable_ice_renomination) { | 80 if (options.enable_ice_renomination) { |
79 desc->AddOption(ICE_RENOMINATION_STR); | 81 desc->AddOption(ICE_OPTION_RENOMINATION); |
80 } | 82 } |
81 | 83 |
82 // Negotiate security params. | 84 // Negotiate security params. |
83 if (offer && offer->identity_fingerprint.get()) { | 85 if (offer && offer->identity_fingerprint.get()) { |
84 // The offer supports DTLS, so answer with DTLS, as long as we support it. | 86 // The offer supports DTLS, so answer with DTLS, as long as we support it. |
85 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { | 87 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { |
86 // Fail if we can't create the fingerprint. | 88 // Fail if we can't create the fingerprint. |
87 // Setting DTLS role to active. | 89 // Setting DTLS role to active. |
88 ConnectionRole role = (options.prefer_passive_role) ? | 90 ConnectionRole role = (options.prefer_passive_role) ? |
89 CONNECTIONROLE_PASSIVE : CONNECTIONROLE_ACTIVE; | 91 CONNECTIONROLE_PASSIVE : CONNECTIONROLE_ACTIVE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 << digest_alg; | 133 << digest_alg; |
132 return false; | 134 return false; |
133 } | 135 } |
134 | 136 |
135 // Assign security role. | 137 // Assign security role. |
136 desc->connection_role = role; | 138 desc->connection_role = role; |
137 return true; | 139 return true; |
138 } | 140 } |
139 | 141 |
140 } // namespace cricket | 142 } // namespace cricket |
OLD | NEW |