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

Side by Side Diff: webrtc/p2p/base/port.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/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/base/port.cc » ('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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // The number of pings that must fail to respond before we become unwritable. 75 // The number of pings that must fail to respond before we become unwritable.
76 static const uint32_t CONNECTION_WRITE_CONNECT_FAILURES = 5; 76 static const uint32_t CONNECTION_WRITE_CONNECT_FAILURES = 5;
77 77
78 enum RelayType { 78 enum RelayType {
79 RELAY_GTURN, // Legacy google relay service. 79 RELAY_GTURN, // Legacy google relay service.
80 RELAY_TURN // Standard (TURN) relay service. 80 RELAY_TURN // Standard (TURN) relay service.
81 }; 81 };
82 82
83 enum IcePriorityValue { 83 enum IcePriorityValue {
84 // The reason we are choosing Relay preference 2 is because, we can run 84 ICE_TYPE_PREFERENCE_RELAY_TLS = 0,
85 // Relay from client to server on UDP/TCP/TLS. To distinguish the transport 85 ICE_TYPE_PREFERENCE_RELAY_TCP = 1,
86 // protocol, we prefer UDP over TCP over TLS. 86 ICE_TYPE_PREFERENCE_RELAY_UDP = 2,
87 // For UDP ICE_TYPE_PREFERENCE_RELAY will be 2.
88 // For TCP ICE_TYPE_PREFERENCE_RELAY will be 1.
89 // For TLS ICE_TYPE_PREFERENCE_RELAY will be 0.
90 // Check turnport.cc for setting these values.
91 ICE_TYPE_PREFERENCE_RELAY = 2,
92 ICE_TYPE_PREFERENCE_PRFLX_TCP = 80, 87 ICE_TYPE_PREFERENCE_PRFLX_TCP = 80,
93 ICE_TYPE_PREFERENCE_HOST_TCP = 90, 88 ICE_TYPE_PREFERENCE_HOST_TCP = 90,
94 ICE_TYPE_PREFERENCE_SRFLX = 100, 89 ICE_TYPE_PREFERENCE_SRFLX = 100,
95 ICE_TYPE_PREFERENCE_PRFLX = 110, 90 ICE_TYPE_PREFERENCE_PRFLX = 110,
96 ICE_TYPE_PREFERENCE_HOST = 126 91 ICE_TYPE_PREFERENCE_HOST = 126
97 }; 92 };
98 93
99 const char* ProtoToString(ProtocolType proto); 94 const char* ProtoToString(ProtocolType proto);
100 bool StringToProto(const char* value, ProtocolType* proto); 95 bool StringToProto(const char* value, ProtocolType* proto);
101 96
102 struct ProtocolAddress { 97 struct ProtocolAddress {
103 rtc::SocketAddress address; 98 rtc::SocketAddress address;
104 ProtocolType proto; 99 ProtocolType proto;
105 bool secure;
106 100
107 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) 101 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p)
108 : address(a), proto(p), secure(false) { } 102 : address(a), proto(p) {}
109 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec)
110 : address(a), proto(p), secure(sec) { }
111 103
112 bool operator==(const ProtocolAddress& o) const { 104 bool operator==(const ProtocolAddress& o) const {
113 return address == o.address && proto == o.proto && secure == o.secure; 105 return address == o.address && proto == o.proto;
114 } 106 }
115 bool operator!=(const ProtocolAddress& o) const { return !(*this == o); } 107 bool operator!=(const ProtocolAddress& o) const { return !(*this == o); }
116 }; 108 };
117 109
118 typedef std::set<rtc::SocketAddress> ServerAddresses; 110 typedef std::set<rtc::SocketAddress> ServerAddresses;
119 111
120 // Represents a local communication mechanism that can be used to create 112 // Represents a local communication mechanism that can be used to create
121 // connections to similar mechanisms of the other client. Subclasses of this 113 // connections to similar mechanisms of the other client. Subclasses of this
122 // one add support for specific mechanisms like local UDP ports. 114 // one add support for specific mechanisms like local UDP ports.
123 class Port : public PortInterface, public rtc::MessageHandler, 115 class Port : public PortInterface, public rtc::MessageHandler,
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 const rtc::PacketOptions& options) override; 705 const rtc::PacketOptions& options) override;
714 int GetError() override { return error_; } 706 int GetError() override { return error_; }
715 707
716 private: 708 private:
717 int error_ = 0; 709 int error_ = 0;
718 }; 710 };
719 711
720 } // namespace cricket 712 } // namespace cricket
721 713
722 #endif // WEBRTC_P2P_BASE_PORT_H_ 714 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/base/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698