| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 renomination == other.renomination; | 80 renomination == other.renomination; |
| 81 } | 81 } |
| 82 bool operator!=(const IceParameters& other) { return !(*this == other); } | 82 bool operator!=(const IceParameters& other) { return !(*this == other); } |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 extern const char CONNECTIONROLE_ACTIVE_STR[]; | 85 extern const char CONNECTIONROLE_ACTIVE_STR[]; |
| 86 extern const char CONNECTIONROLE_PASSIVE_STR[]; | 86 extern const char CONNECTIONROLE_PASSIVE_STR[]; |
| 87 extern const char CONNECTIONROLE_ACTPASS_STR[]; | 87 extern const char CONNECTIONROLE_ACTPASS_STR[]; |
| 88 extern const char CONNECTIONROLE_HOLDCONN_STR[]; | 88 extern const char CONNECTIONROLE_HOLDCONN_STR[]; |
| 89 | 89 |
| 90 constexpr auto ICE_RENOMINATION_STR = "renomination"; | 90 constexpr auto ICE_OPTION_TRICKLE = "trickle"; |
| 91 constexpr auto ICE_OPTION_RENOMINATION = "renomination"; |
| 91 | 92 |
| 92 bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); | 93 bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); |
| 93 bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); | 94 bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); |
| 94 | 95 |
| 95 struct TransportDescription { | 96 struct TransportDescription { |
| 96 TransportDescription() | 97 TransportDescription() |
| 97 : ice_mode(ICEMODE_FULL), | 98 : ice_mode(ICEMODE_FULL), |
| 98 connection_role(CONNECTIONROLE_NONE) {} | 99 connection_role(CONNECTIONROLE_NONE) {} |
| 99 | 100 |
| 100 TransportDescription(const std::vector<std::string>& transport_options, | 101 TransportDescription(const std::vector<std::string>& transport_options, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 ice_ufrag = from.ice_ufrag; | 134 ice_ufrag = from.ice_ufrag; |
| 134 ice_pwd = from.ice_pwd; | 135 ice_pwd = from.ice_pwd; |
| 135 ice_mode = from.ice_mode; | 136 ice_mode = from.ice_mode; |
| 136 connection_role = from.connection_role; | 137 connection_role = from.connection_role; |
| 137 | 138 |
| 138 identity_fingerprint.reset(CopyFingerprint( | 139 identity_fingerprint.reset(CopyFingerprint( |
| 139 from.identity_fingerprint.get())); | 140 from.identity_fingerprint.get())); |
| 140 return *this; | 141 return *this; |
| 141 } | 142 } |
| 142 | 143 |
| 144 // TODO(deadbeef): Rename to HasIceOption, etc. |
| 143 bool HasOption(const std::string& option) const { | 145 bool HasOption(const std::string& option) const { |
| 144 return (std::find(transport_options.begin(), transport_options.end(), | 146 return (std::find(transport_options.begin(), transport_options.end(), |
| 145 option) != transport_options.end()); | 147 option) != transport_options.end()); |
| 146 } | 148 } |
| 147 void AddOption(const std::string& option) { | 149 void AddOption(const std::string& option) { |
| 148 transport_options.push_back(option); | 150 transport_options.push_back(option); |
| 149 } | 151 } |
| 150 bool secure() const { return identity_fingerprint != nullptr; } | 152 bool secure() const { return identity_fingerprint != nullptr; } |
| 151 | 153 |
| 152 IceParameters GetIceParameters() { | 154 IceParameters GetIceParameters() { |
| 153 return IceParameters(ice_ufrag, ice_pwd, HasOption(ICE_RENOMINATION_STR)); | 155 return IceParameters(ice_ufrag, ice_pwd, |
| 156 HasOption(ICE_OPTION_RENOMINATION)); |
| 154 } | 157 } |
| 155 | 158 |
| 156 static rtc::SSLFingerprint* CopyFingerprint( | 159 static rtc::SSLFingerprint* CopyFingerprint( |
| 157 const rtc::SSLFingerprint* from) { | 160 const rtc::SSLFingerprint* from) { |
| 158 if (!from) | 161 if (!from) |
| 159 return NULL; | 162 return NULL; |
| 160 | 163 |
| 161 return new rtc::SSLFingerprint(*from); | 164 return new rtc::SSLFingerprint(*from); |
| 162 } | 165 } |
| 163 | 166 |
| 167 // These are actually ICE options (appearing in the ice-options attribute in |
| 168 // SDP). |
| 169 // TODO(deadbeef): Rename to ice_options. |
| 164 std::vector<std::string> transport_options; | 170 std::vector<std::string> transport_options; |
| 165 std::string ice_ufrag; | 171 std::string ice_ufrag; |
| 166 std::string ice_pwd; | 172 std::string ice_pwd; |
| 167 IceMode ice_mode; | 173 IceMode ice_mode; |
| 168 ConnectionRole connection_role; | 174 ConnectionRole connection_role; |
| 169 | 175 |
| 170 std::unique_ptr<rtc::SSLFingerprint> identity_fingerprint; | 176 std::unique_ptr<rtc::SSLFingerprint> identity_fingerprint; |
| 171 }; | 177 }; |
| 172 | 178 |
| 173 } // namespace cricket | 179 } // namespace cricket |
| 174 | 180 |
| 175 #endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ | 181 #endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ |
| OLD | NEW |