| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 53 // 'actpass': The endpoint is willing to accept an incoming | 53 // 'actpass': The endpoint is willing to accept an incoming | 
| 54 //            connection or to initiate an outgoing connection. | 54 //            connection or to initiate an outgoing connection. | 
| 55 enum ConnectionRole { | 55 enum ConnectionRole { | 
| 56   CONNECTIONROLE_NONE = 0, | 56   CONNECTIONROLE_NONE = 0, | 
| 57   CONNECTIONROLE_ACTIVE, | 57   CONNECTIONROLE_ACTIVE, | 
| 58   CONNECTIONROLE_PASSIVE, | 58   CONNECTIONROLE_PASSIVE, | 
| 59   CONNECTIONROLE_ACTPASS, | 59   CONNECTIONROLE_ACTPASS, | 
| 60   CONNECTIONROLE_HOLDCONN, | 60   CONNECTIONROLE_HOLDCONN, | 
| 61 }; | 61 }; | 
| 62 | 62 | 
|  | 63 struct IceParameters { | 
|  | 64   // TODO(honghaiz): Include ICE mode in this structure to match the ORTC | 
|  | 65   // struct: | 
|  | 66   // http://ortc.org/wp-content/uploads/2016/03/ortc.html#idl-def-RTCIceParamete
     rs | 
|  | 67   std::string ufrag; | 
|  | 68   std::string pwd; | 
|  | 69   bool renomination = false; | 
|  | 70   IceParameters() = default; | 
|  | 71   IceParameters(const std::string& ice_ufrag, | 
|  | 72                 const std::string& ice_pwd, | 
|  | 73                 bool ice_renomination) | 
|  | 74       : ufrag(ice_ufrag), pwd(ice_pwd), renomination(ice_renomination) {} | 
|  | 75 | 
|  | 76   bool operator==(const IceParameters& other) { | 
|  | 77     return ufrag == other.ufrag && pwd == other.pwd && | 
|  | 78            renomination == other.renomination; | 
|  | 79   } | 
|  | 80   bool operator!=(const IceParameters& other) { return !(*this == other); } | 
|  | 81 }; | 
|  | 82 | 
| 63 extern const char CONNECTIONROLE_ACTIVE_STR[]; | 83 extern const char CONNECTIONROLE_ACTIVE_STR[]; | 
| 64 extern const char CONNECTIONROLE_PASSIVE_STR[]; | 84 extern const char CONNECTIONROLE_PASSIVE_STR[]; | 
| 65 extern const char CONNECTIONROLE_ACTPASS_STR[]; | 85 extern const char CONNECTIONROLE_ACTPASS_STR[]; | 
| 66 extern const char CONNECTIONROLE_HOLDCONN_STR[]; | 86 extern const char CONNECTIONROLE_HOLDCONN_STR[]; | 
| 67 | 87 | 
|  | 88 constexpr auto ICE_RENOMINATION_STR = "renomination"; | 
|  | 89 | 
| 68 bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); | 90 bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); | 
| 69 bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); | 91 bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); | 
| 70 | 92 | 
| 71 struct TransportDescription { | 93 struct TransportDescription { | 
| 72   TransportDescription() | 94   TransportDescription() | 
| 73       : ice_mode(ICEMODE_FULL), | 95       : ice_mode(ICEMODE_FULL), | 
| 74         connection_role(CONNECTIONROLE_NONE) {} | 96         connection_role(CONNECTIONROLE_NONE) {} | 
| 75 | 97 | 
| 76   TransportDescription(const std::vector<std::string>& transport_options, | 98   TransportDescription(const std::vector<std::string>& transport_options, | 
| 77                        const std::string& ice_ufrag, | 99                        const std::string& ice_ufrag, | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 118 | 140 | 
| 119   bool HasOption(const std::string& option) const { | 141   bool HasOption(const std::string& option) const { | 
| 120     return (std::find(transport_options.begin(), transport_options.end(), | 142     return (std::find(transport_options.begin(), transport_options.end(), | 
| 121                       option) != transport_options.end()); | 143                       option) != transport_options.end()); | 
| 122   } | 144   } | 
| 123   void AddOption(const std::string& option) { | 145   void AddOption(const std::string& option) { | 
| 124     transport_options.push_back(option); | 146     transport_options.push_back(option); | 
| 125   } | 147   } | 
| 126   bool secure() const { return identity_fingerprint != NULL; } | 148   bool secure() const { return identity_fingerprint != NULL; } | 
| 127 | 149 | 
|  | 150   IceParameters GetIceParameters() { | 
|  | 151     return IceParameters(ice_ufrag, ice_pwd, HasOption(ICE_RENOMINATION_STR)); | 
|  | 152   } | 
|  | 153 | 
| 128   static rtc::SSLFingerprint* CopyFingerprint( | 154   static rtc::SSLFingerprint* CopyFingerprint( | 
| 129       const rtc::SSLFingerprint* from) { | 155       const rtc::SSLFingerprint* from) { | 
| 130     if (!from) | 156     if (!from) | 
| 131       return NULL; | 157       return NULL; | 
| 132 | 158 | 
| 133     return new rtc::SSLFingerprint(*from); | 159     return new rtc::SSLFingerprint(*from); | 
| 134   } | 160   } | 
| 135 | 161 | 
| 136   std::vector<std::string> transport_options; | 162   std::vector<std::string> transport_options; | 
| 137   std::string ice_ufrag; | 163   std::string ice_ufrag; | 
| 138   std::string ice_pwd; | 164   std::string ice_pwd; | 
| 139   IceMode ice_mode; | 165   IceMode ice_mode; | 
| 140   ConnectionRole connection_role; | 166   ConnectionRole connection_role; | 
| 141 | 167 | 
| 142   std::unique_ptr<rtc::SSLFingerprint> identity_fingerprint; | 168   std::unique_ptr<rtc::SSLFingerprint> identity_fingerprint; | 
| 143 }; | 169 }; | 
| 144 | 170 | 
| 145 }  // namespace cricket | 171 }  // namespace cricket | 
| 146 | 172 | 
| 147 #endif  // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ | 173 #endif  // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ | 
| OLD | NEW | 
|---|