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