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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 std::string username; | 85 std::string username; |
86 std::string password; | 86 std::string password; |
87 }; | 87 }; |
88 | 88 |
89 typedef std::vector<ProtocolAddress> PortList; | 89 typedef std::vector<ProtocolAddress> PortList; |
90 // TODO(deadbeef): Rename to TurnServerConfig. | 90 // TODO(deadbeef): Rename to TurnServerConfig. |
91 struct RelayServerConfig { | 91 struct RelayServerConfig { |
92 RelayServerConfig(RelayType type) : type(type), priority(0) {} | 92 RelayServerConfig(RelayType type) : type(type), priority(0) {} |
93 | 93 |
| 94 RelayServerConfig(const std::string& address, |
| 95 int port, |
| 96 const std::string& username, |
| 97 const std::string& password, |
| 98 ProtocolType proto, |
| 99 bool secure) |
| 100 : type(RELAY_TURN), credentials(username, password) { |
| 101 ports.push_back( |
| 102 ProtocolAddress(rtc::SocketAddress(address, port), proto, secure)); |
| 103 } |
| 104 |
94 RelayType type; | 105 RelayType type; |
95 PortList ports; | 106 PortList ports; |
96 RelayCredentials credentials; | 107 RelayCredentials credentials; |
97 int priority; | 108 int priority; |
98 }; | 109 }; |
99 | 110 |
100 class PortAllocatorSession : public sigslot::has_slots<> { | 111 class PortAllocatorSession : public sigslot::has_slots<> { |
101 public: | 112 public: |
102 // Content name passed in mostly for logging and debugging. | 113 // Content name passed in mostly for logging and debugging. |
103 PortAllocatorSession(const std::string& content_name, | 114 PortAllocatorSession(const std::string& content_name, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 candidate_filter_(CF_ALL) { | 172 candidate_filter_(CF_ALL) { |
162 // This will allow us to have old behavior on non webrtc clients. | 173 // This will allow us to have old behavior on non webrtc clients. |
163 } | 174 } |
164 virtual ~PortAllocator() {} | 175 virtual ~PortAllocator() {} |
165 | 176 |
166 // Set STUN and TURN servers to be used in future sessions. | 177 // Set STUN and TURN servers to be used in future sessions. |
167 virtual void SetIceServers( | 178 virtual void SetIceServers( |
168 const ServerAddresses& stun_servers, | 179 const ServerAddresses& stun_servers, |
169 const std::vector<RelayServerConfig>& turn_servers) = 0; | 180 const std::vector<RelayServerConfig>& turn_servers) = 0; |
170 | 181 |
| 182 // Sets the network types to ignore. |
| 183 // Values are defined by the AdapterType enum. |
| 184 virtual void SetNetworkIgnoreMask(int network_ignore_mask) = 0; |
| 185 |
171 PortAllocatorSession* CreateSession( | 186 PortAllocatorSession* CreateSession( |
172 const std::string& sid, | 187 const std::string& sid, |
173 const std::string& content_name, | 188 const std::string& content_name, |
174 int component, | 189 int component, |
175 const std::string& ice_ufrag, | 190 const std::string& ice_ufrag, |
176 const std::string& ice_pwd); | 191 const std::string& ice_pwd); |
177 | 192 |
178 uint32_t flags() const { return flags_; } | 193 uint32_t flags() const { return flags_; } |
179 void set_flags(uint32_t flags) { flags_ = flags; } | 194 void set_flags(uint32_t flags) { flags_ = flags; } |
180 | 195 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 int max_port_; | 246 int max_port_; |
232 uint32_t step_delay_; | 247 uint32_t step_delay_; |
233 bool allow_tcp_listen_; | 248 bool allow_tcp_listen_; |
234 uint32_t candidate_filter_; | 249 uint32_t candidate_filter_; |
235 std::string origin_; | 250 std::string origin_; |
236 }; | 251 }; |
237 | 252 |
238 } // namespace cricket | 253 } // namespace cricket |
239 | 254 |
240 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 255 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
OLD | NEW |