Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1277)

Side by Side Diff: webrtc/p2p/base/portallocator.h

Issue 1414313003: Reland of Adding the ability to change ICE servers through SetConfiguration. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding "override" to applicable methods to fix compile warning. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/client/basicportallocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_ 11 #ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_
12 #define WEBRTC_P2P_BASE_PORTALLOCATOR_H_ 12 #define WEBRTC_P2P_BASE_PORTALLOCATOR_H_
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/p2p/base/port.h"
17 #include "webrtc/p2p/base/portinterface.h" 18 #include "webrtc/p2p/base/portinterface.h"
18 #include "webrtc/base/helpers.h" 19 #include "webrtc/base/helpers.h"
19 #include "webrtc/base/proxyinfo.h" 20 #include "webrtc/base/proxyinfo.h"
20 #include "webrtc/base/sigslot.h" 21 #include "webrtc/base/sigslot.h"
21 22
22 namespace cricket { 23 namespace cricket {
23 24
24 // PortAllocator is responsible for allocating Port types for a given 25 // PortAllocator is responsible for allocating Port types for a given
25 // P2PSocket. It also handles port freeing. 26 // P2PSocket. It also handles port freeing.
26 // 27 //
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 65
65 // CF = CANDIDATE FILTER 66 // CF = CANDIDATE FILTER
66 enum { 67 enum {
67 CF_NONE = 0x0, 68 CF_NONE = 0x0,
68 CF_HOST = 0x1, 69 CF_HOST = 0x1,
69 CF_REFLEXIVE = 0x2, 70 CF_REFLEXIVE = 0x2,
70 CF_RELAY = 0x4, 71 CF_RELAY = 0x4,
71 CF_ALL = 0x7, 72 CF_ALL = 0x7,
72 }; 73 };
73 74
75 // TODO(deadbeef): Rename to TurnCredentials (and username to ufrag).
76 struct RelayCredentials {
77 RelayCredentials() {}
78 RelayCredentials(const std::string& username, const std::string& password)
79 : username(username), password(password) {}
80
81 std::string username;
82 std::string password;
83 };
84
85 typedef std::vector<ProtocolAddress> PortList;
86 // TODO(deadbeef): Rename to TurnServerConfig.
87 struct RelayServerConfig {
88 RelayServerConfig(RelayType type) : type(type), priority(0) {}
89
90 RelayType type;
91 PortList ports;
92 RelayCredentials credentials;
93 int priority;
94 };
95
74 class PortAllocatorSession : public sigslot::has_slots<> { 96 class PortAllocatorSession : public sigslot::has_slots<> {
75 public: 97 public:
76 // Content name passed in mostly for logging and debugging. 98 // Content name passed in mostly for logging and debugging.
77 PortAllocatorSession(const std::string& content_name, 99 PortAllocatorSession(const std::string& content_name,
78 int component, 100 int component,
79 const std::string& ice_ufrag, 101 const std::string& ice_ufrag,
80 const std::string& ice_pwd, 102 const std::string& ice_pwd,
81 uint32_t flags); 103 uint32_t flags);
82 104
83 // Subclasses should clean up any ports created. 105 // Subclasses should clean up any ports created.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 flags_(kDefaultPortAllocatorFlags), 152 flags_(kDefaultPortAllocatorFlags),
131 min_port_(0), 153 min_port_(0),
132 max_port_(0), 154 max_port_(0),
133 step_delay_(kDefaultStepDelay), 155 step_delay_(kDefaultStepDelay),
134 allow_tcp_listen_(true), 156 allow_tcp_listen_(true),
135 candidate_filter_(CF_ALL) { 157 candidate_filter_(CF_ALL) {
136 // This will allow us to have old behavior on non webrtc clients. 158 // This will allow us to have old behavior on non webrtc clients.
137 } 159 }
138 virtual ~PortAllocator() {} 160 virtual ~PortAllocator() {}
139 161
162 // Set STUN and TURN servers to be used in future sessions.
163 virtual void SetIceServers(
164 const ServerAddresses& stun_servers,
165 const std::vector<RelayServerConfig>& turn_servers) = 0;
166
140 PortAllocatorSession* CreateSession( 167 PortAllocatorSession* CreateSession(
141 const std::string& sid, 168 const std::string& sid,
142 const std::string& content_name, 169 const std::string& content_name,
143 int component, 170 int component,
144 const std::string& ice_ufrag, 171 const std::string& ice_ufrag,
145 const std::string& ice_pwd); 172 const std::string& ice_pwd);
146 173
147 uint32_t flags() const { return flags_; } 174 uint32_t flags() const { return flags_; }
148 void set_flags(uint32_t flags) { flags_ = flags; } 175 void set_flags(uint32_t flags) { flags_ = flags; }
149 176
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 int max_port_; 227 int max_port_;
201 uint32_t step_delay_; 228 uint32_t step_delay_;
202 bool allow_tcp_listen_; 229 bool allow_tcp_listen_;
203 uint32_t candidate_filter_; 230 uint32_t candidate_filter_;
204 std::string origin_; 231 std::string origin_;
205 }; 232 };
206 233
207 } // namespace cricket 234 } // namespace cricket
208 235
209 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ 236 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/client/basicportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698