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