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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // | 357 // |
378 // Note: we should always use username_fragment() instead of using | 358 // Note: we should always use username_fragment() instead of using |
379 // |ice_username_fragment_| directly. For the details see the comment on | 359 // |ice_username_fragment_| directly. For the details see the comment on |
380 // username_fragment(). | 360 // username_fragment(). |
381 std::string ice_username_fragment_; | 361 std::string ice_username_fragment_; |
382 std::string password_; | 362 std::string password_; |
383 std::vector<Candidate> candidates_; | 363 std::vector<Candidate> candidates_; |
384 AddressMap connections_; | 364 AddressMap connections_; |
385 int timeout_delay_; | 365 int timeout_delay_; |
386 bool enable_port_packets_; | 366 bool enable_port_packets_; |
387 IceProtocolType ice_protocol_; | |
388 IceRole ice_role_; | 367 IceRole ice_role_; |
389 uint64 tiebreaker_; | 368 uint64 tiebreaker_; |
390 bool shared_socket_; | 369 bool shared_socket_; |
391 // Information to use when going through a proxy. | 370 // Information to use when going through a proxy. |
392 std::string user_agent_; | 371 std::string user_agent_; |
393 rtc::ProxyInfo proxy_; | 372 rtc::ProxyInfo proxy_; |
394 | 373 |
395 // Candidate filter is pushed down to Port such that each Port could | 374 // Candidate filter is pushed down to Port such that each Port could |
396 // make its own decision on how to create candidates. For example, | 375 // make its own decision on how to create candidates. For example, |
397 // when IceTransportsType is set to relay, both RelayPort and | 376 // when IceTransportsType is set to relay, both RelayPort and |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 const rtc::PacketOptions& options); | 625 const rtc::PacketOptions& options); |
647 virtual int GetError() { return error_; } | 626 virtual int GetError() { return error_; } |
648 | 627 |
649 private: | 628 private: |
650 int error_; | 629 int error_; |
651 }; | 630 }; |
652 | 631 |
653 } // namespace cricket | 632 } // namespace cricket |
654 | 633 |
655 #endif // WEBRTC_P2P_BASE_PORT_H_ | 634 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |