| 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 17 matching lines...) Expand all Loading... |
| 28 // SEC_DISABLED: No crypto in outgoing offer, ignore any supplied crypto. | 28 // SEC_DISABLED: No crypto in outgoing offer, ignore any supplied crypto. |
| 29 // SEC_ENABLED: Crypto in outgoing offer and answer (if supplied in offer). | 29 // SEC_ENABLED: Crypto in outgoing offer and answer (if supplied in offer). |
| 30 // SEC_REQUIRED: Crypto in outgoing offer and answer. Fail any offer with absent | 30 // SEC_REQUIRED: Crypto in outgoing offer and answer. Fail any offer with absent |
| 31 // or unsupported crypto. | 31 // or unsupported crypto. |
| 32 enum SecurePolicy { | 32 enum SecurePolicy { |
| 33 SEC_DISABLED, | 33 SEC_DISABLED, |
| 34 SEC_ENABLED, | 34 SEC_ENABLED, |
| 35 SEC_REQUIRED | 35 SEC_REQUIRED |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // The transport protocol we've elected to use. | |
| 39 enum TransportProtocol { | |
| 40 ICEPROTO_GOOGLE, // Google version of ICE protocol. | |
| 41 ICEPROTO_HYBRID, // ICE, but can fall back to the Google version. | |
| 42 ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. | |
| 43 }; | |
| 44 // The old name for TransportProtocol. | |
| 45 // TODO(juberti): remove this. | |
| 46 typedef TransportProtocol IceProtocolType; | |
| 47 | |
| 48 // Whether our side of the call is driving the negotiation, or the other side. | 38 // Whether our side of the call is driving the negotiation, or the other side. |
| 49 enum IceRole { | 39 enum IceRole { |
| 50 ICEROLE_CONTROLLING = 0, | 40 ICEROLE_CONTROLLING = 0, |
| 51 ICEROLE_CONTROLLED, | 41 ICEROLE_CONTROLLED, |
| 52 ICEROLE_UNKNOWN | 42 ICEROLE_UNKNOWN |
| 53 }; | 43 }; |
| 54 | 44 |
| 55 // ICE RFC 5245 implementation type. | 45 // ICE RFC 5245 implementation type. |
| 56 enum IceMode { | 46 enum IceMode { |
| 57 ICEMODE_FULL, // As defined in http://tools.ietf.org/html/rfc5245#section-4.1 | 47 ICEMODE_FULL, // As defined in http://tools.ietf.org/html/rfc5245#section-4.1 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 79 bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); | 69 bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); |
| 80 bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); | 70 bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); |
| 81 | 71 |
| 82 typedef std::vector<Candidate> Candidates; | 72 typedef std::vector<Candidate> Candidates; |
| 83 | 73 |
| 84 struct TransportDescription { | 74 struct TransportDescription { |
| 85 TransportDescription() | 75 TransportDescription() |
| 86 : ice_mode(ICEMODE_FULL), | 76 : ice_mode(ICEMODE_FULL), |
| 87 connection_role(CONNECTIONROLE_NONE) {} | 77 connection_role(CONNECTIONROLE_NONE) {} |
| 88 | 78 |
| 89 TransportDescription(const std::string& transport_type, | 79 TransportDescription(const std::vector<std::string>& transport_options, |
| 90 const std::vector<std::string>& transport_options, | |
| 91 const std::string& ice_ufrag, | 80 const std::string& ice_ufrag, |
| 92 const std::string& ice_pwd, | 81 const std::string& ice_pwd, |
| 93 IceMode ice_mode, | 82 IceMode ice_mode, |
| 94 ConnectionRole role, | 83 ConnectionRole role, |
| 95 const rtc::SSLFingerprint* identity_fingerprint, | 84 const rtc::SSLFingerprint* identity_fingerprint, |
| 96 const Candidates& candidates) | 85 const Candidates& candidates) |
| 97 : transport_type(transport_type), | 86 : transport_options(transport_options), |
| 98 transport_options(transport_options), | |
| 99 ice_ufrag(ice_ufrag), | 87 ice_ufrag(ice_ufrag), |
| 100 ice_pwd(ice_pwd), | 88 ice_pwd(ice_pwd), |
| 101 ice_mode(ice_mode), | 89 ice_mode(ice_mode), |
| 102 connection_role(role), | 90 connection_role(role), |
| 103 identity_fingerprint(CopyFingerprint(identity_fingerprint)), | 91 identity_fingerprint(CopyFingerprint(identity_fingerprint)), |
| 104 candidates(candidates) {} | 92 candidates(candidates) {} |
| 105 TransportDescription(const std::string& transport_type, | 93 TransportDescription(const std::string& ice_ufrag, |
| 106 const std::string& ice_ufrag, | |
| 107 const std::string& ice_pwd) | 94 const std::string& ice_pwd) |
| 108 : transport_type(transport_type), | 95 : ice_ufrag(ice_ufrag), |
| 109 ice_ufrag(ice_ufrag), | |
| 110 ice_pwd(ice_pwd), | 96 ice_pwd(ice_pwd), |
| 111 ice_mode(ICEMODE_FULL), | 97 ice_mode(ICEMODE_FULL), |
| 112 connection_role(CONNECTIONROLE_NONE) {} | 98 connection_role(CONNECTIONROLE_NONE) {} |
| 113 TransportDescription(const TransportDescription& from) | 99 TransportDescription(const TransportDescription& from) |
| 114 : transport_type(from.transport_type), | 100 : transport_options(from.transport_options), |
| 115 transport_options(from.transport_options), | |
| 116 ice_ufrag(from.ice_ufrag), | 101 ice_ufrag(from.ice_ufrag), |
| 117 ice_pwd(from.ice_pwd), | 102 ice_pwd(from.ice_pwd), |
| 118 ice_mode(from.ice_mode), | 103 ice_mode(from.ice_mode), |
| 119 connection_role(from.connection_role), | 104 connection_role(from.connection_role), |
| 120 identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())), | 105 identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())), |
| 121 candidates(from.candidates) {} | 106 candidates(from.candidates) {} |
| 122 | 107 |
| 123 TransportDescription& operator=(const TransportDescription& from) { | 108 TransportDescription& operator=(const TransportDescription& from) { |
| 124 // Self-assignment | 109 // Self-assignment |
| 125 if (this == &from) | 110 if (this == &from) |
| 126 return *this; | 111 return *this; |
| 127 | 112 |
| 128 transport_type = from.transport_type; | |
| 129 transport_options = from.transport_options; | 113 transport_options = from.transport_options; |
| 130 ice_ufrag = from.ice_ufrag; | 114 ice_ufrag = from.ice_ufrag; |
| 131 ice_pwd = from.ice_pwd; | 115 ice_pwd = from.ice_pwd; |
| 132 ice_mode = from.ice_mode; | 116 ice_mode = from.ice_mode; |
| 133 connection_role = from.connection_role; | 117 connection_role = from.connection_role; |
| 134 | 118 |
| 135 identity_fingerprint.reset(CopyFingerprint( | 119 identity_fingerprint.reset(CopyFingerprint( |
| 136 from.identity_fingerprint.get())); | 120 from.identity_fingerprint.get())); |
| 137 candidates = from.candidates; | 121 candidates = from.candidates; |
| 138 return *this; | 122 return *this; |
| 139 } | 123 } |
| 140 | 124 |
| 141 bool HasOption(const std::string& option) const { | 125 bool HasOption(const std::string& option) const { |
| 142 return (std::find(transport_options.begin(), transport_options.end(), | 126 return (std::find(transport_options.begin(), transport_options.end(), |
| 143 option) != transport_options.end()); | 127 option) != transport_options.end()); |
| 144 } | 128 } |
| 145 void AddOption(const std::string& option) { | 129 void AddOption(const std::string& option) { |
| 146 transport_options.push_back(option); | 130 transport_options.push_back(option); |
| 147 } | 131 } |
| 148 bool secure() const { return identity_fingerprint != NULL; } | 132 bool secure() const { return identity_fingerprint != NULL; } |
| 149 | 133 |
| 150 static rtc::SSLFingerprint* CopyFingerprint( | 134 static rtc::SSLFingerprint* CopyFingerprint( |
| 151 const rtc::SSLFingerprint* from) { | 135 const rtc::SSLFingerprint* from) { |
| 152 if (!from) | 136 if (!from) |
| 153 return NULL; | 137 return NULL; |
| 154 | 138 |
| 155 return new rtc::SSLFingerprint(*from); | 139 return new rtc::SSLFingerprint(*from); |
| 156 } | 140 } |
| 157 | 141 |
| 158 std::string transport_type; // xmlns of <transport> | |
| 159 std::vector<std::string> transport_options; | 142 std::vector<std::string> transport_options; |
| 160 std::string ice_ufrag; | 143 std::string ice_ufrag; |
| 161 std::string ice_pwd; | 144 std::string ice_pwd; |
| 162 IceMode ice_mode; | 145 IceMode ice_mode; |
| 163 ConnectionRole connection_role; | 146 ConnectionRole connection_role; |
| 164 | 147 |
| 165 rtc::scoped_ptr<rtc::SSLFingerprint> identity_fingerprint; | 148 rtc::scoped_ptr<rtc::SSLFingerprint> identity_fingerprint; |
| 166 Candidates candidates; | 149 Candidates candidates; |
| 167 }; | 150 }; |
| 168 | 151 |
| 169 } // namespace cricket | 152 } // namespace cricket |
| 170 | 153 |
| 171 #endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ | 154 #endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ |
| OLD | NEW |