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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, |
Taylor Brandstetter
2016/12/08 01:36:40
Thanks for doing this; preferably should be in a s
hnsl1
2016/12/12 16:08:13
Acknowledged.
| |
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; | 100 ProtocolFlags flags; |
106 | 101 |
107 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) | 102 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) |
108 : address(a), proto(p), secure(false) { } | 103 : address(a), proto(p), flags(PROTO_FLAG_NONE) {} |
109 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec) | 104 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, ProtocolFlags f) |
110 : address(a), proto(p), secure(sec) { } | 105 : address(a), proto(p), flags(f) {} |
111 | 106 |
112 bool operator==(const ProtocolAddress& o) const { | 107 bool operator==(const ProtocolAddress& o) const { |
113 return address == o.address && proto == o.proto && secure == o.secure; | 108 return address == o.address && proto == o.proto && flags == o.flags; |
114 } | 109 } |
115 bool operator!=(const ProtocolAddress& o) const { return !(*this == o); } | 110 bool operator!=(const ProtocolAddress& o) const { return !(*this == o); } |
116 }; | 111 }; |
117 | 112 |
118 typedef std::set<rtc::SocketAddress> ServerAddresses; | 113 typedef std::set<rtc::SocketAddress> ServerAddresses; |
119 | 114 |
120 // Represents a local communication mechanism that can be used to create | 115 // Represents a local communication mechanism that can be used to create |
121 // connections to similar mechanisms of the other client. Subclasses of this | 116 // connections to similar mechanisms of the other client. Subclasses of this |
122 // one add support for specific mechanisms like local UDP ports. | 117 // one add support for specific mechanisms like local UDP ports. |
123 class Port : public PortInterface, public rtc::MessageHandler, | 118 class Port : public PortInterface, public rtc::MessageHandler, |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
713 const rtc::PacketOptions& options) override; | 708 const rtc::PacketOptions& options) override; |
714 int GetError() override { return error_; } | 709 int GetError() override { return error_; } |
715 | 710 |
716 private: | 711 private: |
717 int error_ = 0; | 712 int error_ = 0; |
718 }; | 713 }; |
719 | 714 |
720 } // namespace cricket | 715 } // namespace cricket |
721 | 716 |
722 #endif // WEBRTC_P2P_BASE_PORT_H_ | 717 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |