| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 CF_NONE = 0x0, | 67 CF_NONE = 0x0, |
| 68 CF_HOST = 0x1, | 68 CF_HOST = 0x1, |
| 69 CF_REFLEXIVE = 0x2, | 69 CF_REFLEXIVE = 0x2, |
| 70 CF_RELAY = 0x4, | 70 CF_RELAY = 0x4, |
| 71 CF_ALL = 0x7, | 71 CF_ALL = 0x7, |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class PortAllocatorSession : public sigslot::has_slots<> { | 74 class PortAllocatorSession : public sigslot::has_slots<> { |
| 75 public: | 75 public: |
| 76 // Content name passed in mostly for logging and debugging. | 76 // Content name passed in mostly for logging and debugging. |
| 77 // TODO(mallinath) - Change username and password to ice_ufrag and ice_pwd. | |
| 78 PortAllocatorSession(const std::string& content_name, | 77 PortAllocatorSession(const std::string& content_name, |
| 79 int component, | 78 int component, |
| 80 const std::string& username, | 79 const std::string& ice_ufrag, |
| 81 const std::string& password, | 80 const std::string& ice_pwd, |
| 82 uint32 flags); | 81 uint32 flags); |
| 83 | 82 |
| 84 // Subclasses should clean up any ports created. | 83 // Subclasses should clean up any ports created. |
| 85 virtual ~PortAllocatorSession() {} | 84 virtual ~PortAllocatorSession() {} |
| 86 | 85 |
| 87 uint32 flags() const { return flags_; } | 86 uint32 flags() const { return flags_; } |
| 88 void set_flags(uint32 flags) { flags_ = flags; } | 87 void set_flags(uint32 flags) { flags_ = flags; } |
| 89 std::string content_name() const { return content_name_; } | 88 std::string content_name() const { return content_name_; } |
| 90 int component() const { return component_; } | 89 int component() const { return component_; } |
| 91 | 90 |
| 92 // Starts gathering STUN and Relay configurations. | 91 // Starts gathering STUN and Relay configurations. |
| 93 virtual void StartGettingPorts() = 0; | 92 virtual void StartGettingPorts() = 0; |
| 94 virtual void StopGettingPorts() = 0; | 93 virtual void StopGettingPorts() = 0; |
| 95 virtual bool IsGettingPorts() = 0; | 94 virtual bool IsGettingPorts() = 0; |
| 96 | 95 |
| 97 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 96 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; |
| 98 sigslot::signal2<PortAllocatorSession*, | 97 sigslot::signal2<PortAllocatorSession*, |
| 99 const std::vector<Candidate>&> SignalCandidatesReady; | 98 const std::vector<Candidate>&> SignalCandidatesReady; |
| 100 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; | 99 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; |
| 101 | 100 |
| 102 virtual uint32 generation() { return generation_; } | 101 virtual uint32 generation() { return generation_; } |
| 103 virtual void set_generation(uint32 generation) { generation_ = generation; } | 102 virtual void set_generation(uint32 generation) { generation_ = generation; } |
| 104 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; | 103 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; |
| 105 | 104 |
| 105 const std::string& ice_ufrag() const { return ice_ufrag_; } |
| 106 const std::string& ice_pwd() const { return ice_pwd_; } |
| 107 |
| 106 protected: | 108 protected: |
| 107 const std::string& username() const { return username_; } | 109 // TODO(deadbeef): Get rid of these when everyone switches to ice_ufrag and |
| 108 const std::string& password() const { return password_; } | 110 // ice_pwd. |
| 111 const std::string& username() const { return ice_ufrag_; } |
| 112 const std::string& password() const { return ice_pwd_; } |
| 109 | 113 |
| 110 std::string content_name_; | 114 std::string content_name_; |
| 111 int component_; | 115 int component_; |
| 112 | 116 |
| 113 private: | 117 private: |
| 114 uint32 flags_; | 118 uint32 flags_; |
| 115 uint32 generation_; | 119 uint32 generation_; |
| 116 std::string username_; | 120 std::string ice_ufrag_; |
| 117 std::string password_; | 121 std::string ice_pwd_; |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 class PortAllocator : public sigslot::has_slots<> { | 124 class PortAllocator : public sigslot::has_slots<> { |
| 121 public: | 125 public: |
| 122 PortAllocator() : | 126 PortAllocator() : |
| 123 flags_(kDefaultPortAllocatorFlags), | 127 flags_(kDefaultPortAllocatorFlags), |
| 124 min_port_(0), | 128 min_port_(0), |
| 125 max_port_(0), | 129 max_port_(0), |
| 126 step_delay_(kDefaultStepDelay), | 130 step_delay_(kDefaultStepDelay), |
| 127 allow_tcp_listen_(true), | 131 allow_tcp_listen_(true), |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 int max_port_; | 199 int max_port_; |
| 196 uint32 step_delay_; | 200 uint32 step_delay_; |
| 197 bool allow_tcp_listen_; | 201 bool allow_tcp_listen_; |
| 198 uint32 candidate_filter_; | 202 uint32 candidate_filter_; |
| 199 std::string origin_; | 203 std::string origin_; |
| 200 }; | 204 }; |
| 201 | 205 |
| 202 } // namespace cricket | 206 } // namespace cricket |
| 203 | 207 |
| 204 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 208 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
| OLD | NEW |