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

Unified Diff: webrtc/p2p/base/turnport.cc

Issue 2685053004: Add the URL attribute to cricket::Candiate. (Closed)
Patch Set: Merge Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/turnport.h ('k') | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/turnport.cc
diff --git a/webrtc/p2p/base/turnport.cc b/webrtc/p2p/base/turnport.cc
index 7e0e64d6edacaf97751c3cbc56d18ca9a6f88dad..789842dfb5bb0858f384d831c94242608c587cb9 100644
--- a/webrtc/p2p/base/turnport.cc
+++ b/webrtc/p2p/base/turnport.cc
@@ -745,7 +745,7 @@ void TurnPort::OnAllocateSuccess(const rtc::SocketAddress& address,
ProtoToString(server_address_.proto), // The first hop protocol.
"", // TCP canddiate type, empty for turn candidates.
RELAY_PORT_TYPE, GetRelayPreference(server_address_.proto),
- server_priority_, true);
+ server_priority_, ReconstructedServerUrl(), true);
}
void TurnPort::OnAllocateError() {
@@ -1073,6 +1073,34 @@ bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address,
return true;
}
+std::string TurnPort::ReconstructedServerUrl() {
+ // draft-petithuguenin-behave-turn-uris-01
+ // turnURI = scheme ":" turn-host [ ":" turn-port ]
+ // [ "?transport=" transport ]
+ // scheme = "turn" / "turns"
+ // transport = "udp" / "tcp" / transport-ext
+ // transport-ext = 1*unreserved
+ // turn-host = IP-literal / IPv4address / reg-name
+ // turn-port = *DIGIT
+ std::string scheme = "turn";
+ std::string transport = "tcp";
+ switch (server_address_.proto) {
+ case PROTO_SSLTCP:
+ case PROTO_TLS:
+ scheme = "turns";
+ break;
+ case PROTO_UDP:
+ transport = "udp";
+ break;
+ case PROTO_TCP:
+ break;
+ }
+ std::ostringstream url;
+ url << scheme << ":" << server_address_.address.ipaddr().ToString() << ":"
+ << server_address_.address.port() << "?transport=" << transport;
+ return url.str();
+}
+
TurnAllocateRequest::TurnAllocateRequest(TurnPort* port)
: StunRequest(new TurnMessage()),
port_(port) {
« no previous file with comments | « webrtc/p2p/base/turnport.h ('k') | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698