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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return NULL; | 49 return NULL; |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 return desc.release(); | 53 return desc.release(); |
54 } | 54 } |
55 | 55 |
56 TransportDescription* TransportDescriptionFactory::CreateAnswer( | 56 TransportDescription* TransportDescriptionFactory::CreateAnswer( |
57 const TransportDescription* offer, | 57 const TransportDescription* offer, |
58 const TransportOptions& options, | 58 const TransportOptions& options, |
| 59 bool require_transport_attributes, |
59 const TransportDescription* current_description) const { | 60 const TransportDescription* current_description) const { |
60 // TODO(juberti): Figure out why we get NULL offers, and fix this upstream. | 61 // TODO(juberti): Figure out why we get NULL offers, and fix this upstream. |
61 if (!offer) { | 62 if (!offer) { |
62 LOG(LS_WARNING) << "Failed to create TransportDescription answer " << | 63 LOG(LS_WARNING) << "Failed to create TransportDescription answer " << |
63 "because offer is NULL"; | 64 "because offer is NULL"; |
64 return NULL; | 65 return NULL; |
65 } | 66 } |
66 | 67 |
67 std::unique_ptr<TransportDescription> desc(new TransportDescription()); | 68 std::unique_ptr<TransportDescription> desc(new TransportDescription()); |
68 // Generate the ICE credentials if we don't already have them or ice is | 69 // Generate the ICE credentials if we don't already have them or ice is |
(...skipping 15 matching lines...) Expand all Loading... |
84 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { | 85 if (secure_ == SEC_ENABLED || secure_ == SEC_REQUIRED) { |
85 // Fail if we can't create the fingerprint. | 86 // Fail if we can't create the fingerprint. |
86 // Setting DTLS role to active. | 87 // Setting DTLS role to active. |
87 ConnectionRole role = (options.prefer_passive_role) ? | 88 ConnectionRole role = (options.prefer_passive_role) ? |
88 CONNECTIONROLE_PASSIVE : CONNECTIONROLE_ACTIVE; | 89 CONNECTIONROLE_PASSIVE : CONNECTIONROLE_ACTIVE; |
89 | 90 |
90 if (!SetSecurityInfo(desc.get(), role)) { | 91 if (!SetSecurityInfo(desc.get(), role)) { |
91 return NULL; | 92 return NULL; |
92 } | 93 } |
93 } | 94 } |
94 } else if (secure_ == SEC_REQUIRED) { | 95 } else if (require_transport_attributes && secure_ == SEC_REQUIRED) { |
95 // We require DTLS, but the other side didn't offer it. Fail. | 96 // We require DTLS, but the other side didn't offer it. Fail. |
96 LOG(LS_WARNING) << "Failed to create TransportDescription answer " | 97 LOG(LS_WARNING) << "Failed to create TransportDescription answer " |
97 "because of incompatible security settings"; | 98 "because of incompatible security settings"; |
98 return NULL; | 99 return NULL; |
99 } | 100 } |
100 | 101 |
101 return desc.release(); | 102 return desc.release(); |
102 } | 103 } |
103 | 104 |
104 bool TransportDescriptionFactory::SetSecurityInfo( | 105 bool TransportDescriptionFactory::SetSecurityInfo( |
(...skipping 25 matching lines...) Expand all Loading... |
130 << digest_alg; | 131 << digest_alg; |
131 return false; | 132 return false; |
132 } | 133 } |
133 | 134 |
134 // Assign security role. | 135 // Assign security role. |
135 desc->connection_role = role; | 136 desc->connection_role = role; |
136 return true; | 137 return true; |
137 } | 138 } |
138 | 139 |
139 } // namespace cricket | 140 } // namespace cricket |
OLD | NEW |