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

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

Issue 2568833002: Refactor "secure bool" into explicit PROTO_TLS. (Closed)
Patch Set: GetRelayPreference(): Add RTC_DCHECK(proto == PROTO_UDP). Created 4 years 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/port_unittest.cc ('k') | webrtc/p2p/base/portinterface.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
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 typedef std::vector<ProtocolAddress> PortList; 113 typedef std::vector<ProtocolAddress> PortList;
114 // TODO(deadbeef): Rename to TurnServerConfig. 114 // TODO(deadbeef): Rename to TurnServerConfig.
115 struct RelayServerConfig { 115 struct RelayServerConfig {
116 RelayServerConfig(RelayType type) : type(type) {} 116 RelayServerConfig(RelayType type) : type(type) {}
117 117
118 RelayServerConfig(const std::string& address, 118 RelayServerConfig(const std::string& address,
119 int port, 119 int port,
120 const std::string& username, 120 const std::string& username,
121 const std::string& password, 121 const std::string& password,
122 ProtocolType proto)
123 : type(RELAY_TURN), credentials(username, password) {
124 ports.push_back(ProtocolAddress(rtc::SocketAddress(address, port), proto));
125 }
126
127 // Legacy constructor where "secure" and PROTO_TCP implies PROTO_TLS.
128 RelayServerConfig(const std::string& address,
129 int port,
130 const std::string& username,
131 const std::string& password,
122 ProtocolType proto, 132 ProtocolType proto,
123 bool secure) 133 bool secure)
124 : type(RELAY_TURN), credentials(username, password) { 134 : RelayServerConfig(address,
125 ports.push_back( 135 port,
126 ProtocolAddress(rtc::SocketAddress(address, port), proto, secure)); 136 username,
127 } 137 password,
138 (proto == PROTO_TCP && secure ? PROTO_TLS : proto)) {}
128 139
129 bool operator==(const RelayServerConfig& o) const { 140 bool operator==(const RelayServerConfig& o) const {
130 return type == o.type && ports == o.ports && credentials == o.credentials && 141 return type == o.type && ports == o.ports && credentials == o.credentials &&
131 priority == o.priority; 142 priority == o.priority;
132 } 143 }
133 bool operator!=(const RelayServerConfig& o) const { return !(*this == o); } 144 bool operator!=(const RelayServerConfig& o) const { return !(*this == o); }
134 145
135 RelayType type; 146 RelayType type;
136 PortList ports; 147 PortList ports;
137 RelayCredentials credentials; 148 RelayCredentials credentials;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 int allocated_pooled_session_count_ = 0; 430 int allocated_pooled_session_count_ = 0;
420 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; 431 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_;
421 bool prune_turn_ports_ = false; 432 bool prune_turn_ports_ = false;
422 433
423 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; 434 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr;
424 }; 435 };
425 436
426 } // namespace cricket 437 } // namespace cricket
427 438
428 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ 439 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port_unittest.cc ('k') | webrtc/p2p/base/portinterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698