OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const rtc::IPAddress& ip, | 120 const rtc::IPAddress& ip, |
121 uint16 min_port, | 121 uint16 min_port, |
122 uint16 max_port, | 122 uint16 max_port, |
123 const std::string& username_fragment, | 123 const std::string& username_fragment, |
124 const std::string& password); | 124 const std::string& password); |
125 virtual ~Port(); | 125 virtual ~Port(); |
126 | 126 |
127 virtual const std::string& Type() const { return type_; } | 127 virtual const std::string& Type() const { return type_; } |
128 virtual rtc::Network* Network() const { return network_; } | 128 virtual rtc::Network* Network() const { return network_; } |
129 | 129 |
| 130 // This method will set the flag which enables standard ICE/STUN procedures |
| 131 // in STUN connectivity checks. Currently this method does |
| 132 // 1. Add / Verify MI attribute in STUN binding requests. |
| 133 // 2. Username attribute in STUN binding request will be RFRAF:LFRAG, |
| 134 // as opposed to RFRAGLFRAG. |
| 135 virtual void SetIceProtocolType(IceProtocolType protocol) { |
| 136 ice_protocol_ = protocol; |
| 137 } |
| 138 virtual IceProtocolType IceProtocol() const { return ice_protocol_; } |
| 139 |
130 // Methods to set/get ICE role and tiebreaker values. | 140 // Methods to set/get ICE role and tiebreaker values. |
131 IceRole GetIceRole() const { return ice_role_; } | 141 IceRole GetIceRole() const { return ice_role_; } |
132 void SetIceRole(IceRole role) { ice_role_ = role; } | 142 void SetIceRole(IceRole role) { ice_role_ = role; } |
133 | 143 |
134 void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } | 144 void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } |
135 uint64 IceTiebreaker() const { return tiebreaker_; } | 145 uint64 IceTiebreaker() const { return tiebreaker_; } |
136 | 146 |
137 virtual bool SharedSocket() const { return shared_socket_; } | 147 virtual bool SharedSocket() const { return shared_socket_; } |
138 void ResetSharedSocket() { shared_socket_ = false; } | 148 void ResetSharedSocket() { shared_socket_ = false; } |
139 | 149 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 uint16 min_port() { return min_port_; } | 266 uint16 min_port() { return min_port_; } |
257 uint16 max_port() { return max_port_; } | 267 uint16 max_port() { return max_port_; } |
258 | 268 |
259 // Timeout shortening function to speed up unit tests. | 269 // Timeout shortening function to speed up unit tests. |
260 void set_timeout_delay(int delay) { timeout_delay_ = delay; } | 270 void set_timeout_delay(int delay) { timeout_delay_ = delay; } |
261 | 271 |
262 // This method will return local and remote username fragements from the | 272 // This method will return local and remote username fragements from the |
263 // stun username attribute if present. | 273 // stun username attribute if present. |
264 bool ParseStunUsername(const StunMessage* stun_msg, | 274 bool ParseStunUsername(const StunMessage* stun_msg, |
265 std::string* local_username, | 275 std::string* local_username, |
266 std::string* remote_username) const; | 276 std::string* remote_username, |
| 277 IceProtocolType* remote_protocol_type) const; |
267 void CreateStunUsername(const std::string& remote_username, | 278 void CreateStunUsername(const std::string& remote_username, |
268 std::string* stun_username_attr_str) const; | 279 std::string* stun_username_attr_str) const; |
269 | 280 |
270 bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, | 281 bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, |
271 IceMessage* stun_msg, | 282 IceMessage* stun_msg, |
272 const std::string& remote_ufrag); | 283 const std::string& remote_ufrag); |
273 | 284 |
274 // Called when the socket is currently able to send. | 285 // Called when the socket is currently able to send. |
275 void OnReadyToSend(); | 286 void OnReadyToSend(); |
276 | 287 |
277 // Called when the Connection discovers a local peer reflexive candidate. | 288 // Called when the Connection discovers a local peer reflexive candidate. |
278 // Returns the index of the new local candidate. | 289 // Returns the index of the new local candidate. |
279 size_t AddPrflxCandidate(const Candidate& local); | 290 size_t AddPrflxCandidate(const Candidate& local); |
280 | 291 |
| 292 // Returns if RFC 5245 ICE protocol is used. |
| 293 bool IsStandardIce() const; |
| 294 |
| 295 // Returns if Google ICE protocol is used. |
| 296 bool IsGoogleIce() const; |
| 297 |
| 298 // Returns if Hybrid ICE protocol is used. |
| 299 bool IsHybridIce() const; |
| 300 |
281 void set_candidate_filter(uint32 candidate_filter) { | 301 void set_candidate_filter(uint32 candidate_filter) { |
282 candidate_filter_ = candidate_filter; | 302 candidate_filter_ = candidate_filter; |
283 } | 303 } |
284 | 304 |
285 protected: | 305 protected: |
286 enum { | 306 enum { |
287 MSG_CHECKTIMEOUT = 0, | 307 MSG_CHECKTIMEOUT = 0, |
288 MSG_FIRST_AVAILABLE | 308 MSG_FIRST_AVAILABLE |
289 }; | 309 }; |
290 | 310 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // | 377 // |
358 // Note: we should always use username_fragment() instead of using | 378 // Note: we should always use username_fragment() instead of using |
359 // |ice_username_fragment_| directly. For the details see the comment on | 379 // |ice_username_fragment_| directly. For the details see the comment on |
360 // username_fragment(). | 380 // username_fragment(). |
361 std::string ice_username_fragment_; | 381 std::string ice_username_fragment_; |
362 std::string password_; | 382 std::string password_; |
363 std::vector<Candidate> candidates_; | 383 std::vector<Candidate> candidates_; |
364 AddressMap connections_; | 384 AddressMap connections_; |
365 int timeout_delay_; | 385 int timeout_delay_; |
366 bool enable_port_packets_; | 386 bool enable_port_packets_; |
| 387 IceProtocolType ice_protocol_; |
367 IceRole ice_role_; | 388 IceRole ice_role_; |
368 uint64 tiebreaker_; | 389 uint64 tiebreaker_; |
369 bool shared_socket_; | 390 bool shared_socket_; |
370 // Information to use when going through a proxy. | 391 // Information to use when going through a proxy. |
371 std::string user_agent_; | 392 std::string user_agent_; |
372 rtc::ProxyInfo proxy_; | 393 rtc::ProxyInfo proxy_; |
373 | 394 |
374 // Candidate filter is pushed down to Port such that each Port could | 395 // Candidate filter is pushed down to Port such that each Port could |
375 // make its own decision on how to create candidates. For example, | 396 // make its own decision on how to create candidates. For example, |
376 // when IceTransportsType is set to relay, both RelayPort and | 397 // when IceTransportsType is set to relay, both RelayPort and |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 const rtc::PacketOptions& options); | 646 const rtc::PacketOptions& options); |
626 virtual int GetError() { return error_; } | 647 virtual int GetError() { return error_; } |
627 | 648 |
628 private: | 649 private: |
629 int error_; | 650 int error_; |
630 }; | 651 }; |
631 | 652 |
632 } // namespace cricket | 653 } // namespace cricket |
633 | 654 |
634 #endif // WEBRTC_P2P_BASE_PORT_H_ | 655 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |