| 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 | |
| 140 // Methods to set/get ICE role and tiebreaker values. | 130 // Methods to set/get ICE role and tiebreaker values. |
| 141 IceRole GetIceRole() const { return ice_role_; } | 131 IceRole GetIceRole() const { return ice_role_; } |
| 142 void SetIceRole(IceRole role) { ice_role_ = role; } | 132 void SetIceRole(IceRole role) { ice_role_ = role; } |
| 143 | 133 |
| 144 void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } | 134 void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } |
| 145 uint64 IceTiebreaker() const { return tiebreaker_; } | 135 uint64 IceTiebreaker() const { return tiebreaker_; } |
| 146 | 136 |
| 147 virtual bool SharedSocket() const { return shared_socket_; } | 137 virtual bool SharedSocket() const { return shared_socket_; } |
| 148 void ResetSharedSocket() { shared_socket_ = false; } | 138 void ResetSharedSocket() { shared_socket_ = false; } |
| 149 | 139 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 uint16 min_port() { return min_port_; } | 256 uint16 min_port() { return min_port_; } |
| 267 uint16 max_port() { return max_port_; } | 257 uint16 max_port() { return max_port_; } |
| 268 | 258 |
| 269 // Timeout shortening function to speed up unit tests. | 259 // Timeout shortening function to speed up unit tests. |
| 270 void set_timeout_delay(int delay) { timeout_delay_ = delay; } | 260 void set_timeout_delay(int delay) { timeout_delay_ = delay; } |
| 271 | 261 |
| 272 // This method will return local and remote username fragements from the | 262 // This method will return local and remote username fragements from the |
| 273 // stun username attribute if present. | 263 // stun username attribute if present. |
| 274 bool ParseStunUsername(const StunMessage* stun_msg, | 264 bool ParseStunUsername(const StunMessage* stun_msg, |
| 275 std::string* local_username, | 265 std::string* local_username, |
| 276 std::string* remote_username, | 266 std::string* remote_username) const; |
| 277 IceProtocolType* remote_protocol_type) const; | |
| 278 void CreateStunUsername(const std::string& remote_username, | 267 void CreateStunUsername(const std::string& remote_username, |
| 279 std::string* stun_username_attr_str) const; | 268 std::string* stun_username_attr_str) const; |
| 280 | 269 |
| 281 bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, | 270 bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, |
| 282 IceMessage* stun_msg, | 271 IceMessage* stun_msg, |
| 283 const std::string& remote_ufrag); | 272 const std::string& remote_ufrag); |
| 284 | 273 |
| 285 // Called when the socket is currently able to send. | 274 // Called when the socket is currently able to send. |
| 286 void OnReadyToSend(); | 275 void OnReadyToSend(); |
| 287 | 276 |
| 288 // Called when the Connection discovers a local peer reflexive candidate. | 277 // Called when the Connection discovers a local peer reflexive candidate. |
| 289 // Returns the index of the new local candidate. | 278 // Returns the index of the new local candidate. |
| 290 size_t AddPrflxCandidate(const Candidate& local); | 279 size_t AddPrflxCandidate(const Candidate& local); |
| 291 | 280 |
| 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 | |
| 301 void set_candidate_filter(uint32 candidate_filter) { | 281 void set_candidate_filter(uint32 candidate_filter) { |
| 302 candidate_filter_ = candidate_filter; | 282 candidate_filter_ = candidate_filter; |
| 303 } | 283 } |
| 304 | 284 |
| 305 protected: | 285 protected: |
| 306 enum { | 286 enum { |
| 307 MSG_CHECKTIMEOUT = 0, | 287 MSG_CHECKTIMEOUT = 0, |
| 308 MSG_FIRST_AVAILABLE | 288 MSG_FIRST_AVAILABLE |
| 309 }; | 289 }; |
| 310 | 290 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // | 353 // |
| 374 // Note: we should always use username_fragment() instead of using | 354 // Note: we should always use username_fragment() instead of using |
| 375 // |ice_username_fragment_| directly. For the details see the comment on | 355 // |ice_username_fragment_| directly. For the details see the comment on |
| 376 // username_fragment(). | 356 // username_fragment(). |
| 377 std::string ice_username_fragment_; | 357 std::string ice_username_fragment_; |
| 378 std::string password_; | 358 std::string password_; |
| 379 std::vector<Candidate> candidates_; | 359 std::vector<Candidate> candidates_; |
| 380 AddressMap connections_; | 360 AddressMap connections_; |
| 381 int timeout_delay_; | 361 int timeout_delay_; |
| 382 bool enable_port_packets_; | 362 bool enable_port_packets_; |
| 383 IceProtocolType ice_protocol_; | |
| 384 IceRole ice_role_; | 363 IceRole ice_role_; |
| 385 uint64 tiebreaker_; | 364 uint64 tiebreaker_; |
| 386 bool shared_socket_; | 365 bool shared_socket_; |
| 387 // Information to use when going through a proxy. | 366 // Information to use when going through a proxy. |
| 388 std::string user_agent_; | 367 std::string user_agent_; |
| 389 rtc::ProxyInfo proxy_; | 368 rtc::ProxyInfo proxy_; |
| 390 | 369 |
| 391 // Candidate filter is pushed down to Port such that each Port could | 370 // Candidate filter is pushed down to Port such that each Port could |
| 392 // make its own decision on how to create candidates. For example, | 371 // make its own decision on how to create candidates. For example, |
| 393 // when IceTransportsType is set to relay, both RelayPort and | 372 // when IceTransportsType is set to relay, both RelayPort and |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 const rtc::PacketOptions& options); | 616 const rtc::PacketOptions& options); |
| 638 virtual int GetError() { return error_; } | 617 virtual int GetError() { return error_; } |
| 639 | 618 |
| 640 private: | 619 private: |
| 641 int error_; | 620 int error_; |
| 642 }; | 621 }; |
| 643 | 622 |
| 644 } // namespace cricket | 623 } // namespace cricket |
| 645 | 624 |
| 646 #endif // WEBRTC_P2P_BASE_PORT_H_ | 625 #endif // WEBRTC_P2P_BASE_PORT_H_ |
| OLD | NEW |