2014-10-28 22:20:11 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef P2P_BASE_TURNPORT_H_
|
|
|
|
|
#define P2P_BASE_TURNPORT_H_
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <list>
|
|
|
|
|
#include <set>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "p2p/base/port.h"
|
|
|
|
|
#include "p2p/client/basicportallocator.h"
|
|
|
|
|
#include "rtc_base/asyncinvoker.h"
|
|
|
|
|
#include "rtc_base/asyncpacketsocket.h"
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
namespace rtc {
|
|
|
|
|
class AsyncResolver;
|
|
|
|
|
class SignalThread;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 14:01:40 +02:00
|
|
|
namespace webrtc {
|
|
|
|
|
class TurnCustomizer;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-28 22:20:11 +00:00
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
extern const char TURN_PORT_TYPE[];
|
|
|
|
|
class TurnAllocateRequest;
|
|
|
|
|
class TurnEntry;
|
|
|
|
|
|
|
|
|
|
class TurnPort : public Port {
|
|
|
|
|
public:
|
2015-08-03 10:23:31 -07:00
|
|
|
enum PortState {
|
|
|
|
|
STATE_CONNECTING, // Initial state, cannot send any packets.
|
|
|
|
|
STATE_CONNECTED, // Socket connected, ready to send stun requests.
|
|
|
|
|
STATE_READY, // Received allocate success, can send any packets.
|
2016-06-22 16:26:29 -07:00
|
|
|
STATE_RECEIVEONLY, // Had REFRESH_REQUEST error, cannot send any packets.
|
|
|
|
|
STATE_DISCONNECTED, // TCP connection died, cannot send/receive any
|
|
|
|
|
// packets.
|
2015-08-03 10:23:31 -07:00
|
|
|
};
|
Make Port (and subclasses) fully "Network"-based, instead of IP-based.
For ICE, we want sockets that are bound to specific network interfaces,
rather than to specific IP addresses. So, a while ago, we added a
"Network" class that gets passed into the Port constructor, in
addition to the IP address as before.
But we never finished the job of removing the IP address field, such that
a Port only guarantees something about the network interface it's
associated with, and not the specific IP address it ends up with.
This CL does that, and as a consequence, if a port ends up bound to
an IP address other than the "best" one (returned by Network::GetBestIP),
this *won't* be treated as an error.
This is relevant to Android, where even though we pass an IP address
into "Bind" as a way of identifying the network, the socket actually
gets bound using "android_setsocknetwork", which doesn't provide any
guarantees about the IP address. So, if a network interface has multiple
IPv6 addresses (for instance), we may not correctly predict the one
the OS will choose, and that's ok.
This CL also moves "SetAlternateLocalAddress" from VirtualSocket to
VirtualSocketServer, which makes for much more readable test code.
The next step, if there is one, is to pass along the Network class all
the way to SocketServer::Bind. Then the socket server could do smart
things with the network information. We could even stick a platform-
specific network handle in the Network object, such that the socket
server could use it for the binding, or for "sendmsg", for example.
See bug 7026 for more context about the sendmsg idea.
BUG=webrtc:7715
Review-Url: https://codereview.webrtc.org/2989303002
Cr-Commit-Position: refs/heads/master@{#19251}
2017-08-04 15:01:57 -07:00
|
|
|
// Create a TURN port using the shared UDP socket, |socket|.
|
2014-10-28 22:20:11 +00:00
|
|
|
static TurnPort* Create(rtc::Thread* thread,
|
|
|
|
|
rtc::PacketSocketFactory* factory,
|
|
|
|
|
rtc::Network* network,
|
|
|
|
|
rtc::AsyncPacketSocket* socket,
|
|
|
|
|
const std::string& username, // ice username.
|
|
|
|
|
const std::string& password, // ice password.
|
|
|
|
|
const ProtocolAddress& server_address,
|
|
|
|
|
const RelayCredentials& credentials,
|
2015-01-10 00:47:02 +00:00
|
|
|
int server_priority,
|
2017-10-10 14:01:40 +02:00
|
|
|
const std::string& origin,
|
|
|
|
|
webrtc::TurnCustomizer* customizer) {
|
2014-11-06 20:19:22 +00:00
|
|
|
return new TurnPort(thread, factory, network, socket, username, password,
|
2017-10-10 14:01:40 +02:00
|
|
|
server_address, credentials, server_priority, origin,
|
|
|
|
|
customizer);
|
2014-10-28 22:20:11 +00:00
|
|
|
}
|
|
|
|
|
|
Make Port (and subclasses) fully "Network"-based, instead of IP-based.
For ICE, we want sockets that are bound to specific network interfaces,
rather than to specific IP addresses. So, a while ago, we added a
"Network" class that gets passed into the Port constructor, in
addition to the IP address as before.
But we never finished the job of removing the IP address field, such that
a Port only guarantees something about the network interface it's
associated with, and not the specific IP address it ends up with.
This CL does that, and as a consequence, if a port ends up bound to
an IP address other than the "best" one (returned by Network::GetBestIP),
this *won't* be treated as an error.
This is relevant to Android, where even though we pass an IP address
into "Bind" as a way of identifying the network, the socket actually
gets bound using "android_setsocknetwork", which doesn't provide any
guarantees about the IP address. So, if a network interface has multiple
IPv6 addresses (for instance), we may not correctly predict the one
the OS will choose, and that's ok.
This CL also moves "SetAlternateLocalAddress" from VirtualSocket to
VirtualSocketServer, which makes for much more readable test code.
The next step, if there is one, is to pass along the Network class all
the way to SocketServer::Bind. Then the socket server could do smart
things with the network information. We could even stick a platform-
specific network handle in the Network object, such that the socket
server could use it for the binding, or for "sendmsg", for example.
See bug 7026 for more context about the sendmsg idea.
BUG=webrtc:7715
Review-Url: https://codereview.webrtc.org/2989303002
Cr-Commit-Position: refs/heads/master@{#19251}
2017-08-04 15:01:57 -07:00
|
|
|
// Create a TURN port that will use a new socket, bound to |network| and
|
|
|
|
|
// using a port in the range between |min_port| and |max_port|.
|
2014-10-28 22:20:11 +00:00
|
|
|
static TurnPort* Create(rtc::Thread* thread,
|
|
|
|
|
rtc::PacketSocketFactory* factory,
|
|
|
|
|
rtc::Network* network,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint16_t min_port,
|
|
|
|
|
uint16_t max_port,
|
2014-10-28 22:20:11 +00:00
|
|
|
const std::string& username, // ice username.
|
|
|
|
|
const std::string& password, // ice password.
|
|
|
|
|
const ProtocolAddress& server_address,
|
|
|
|
|
const RelayCredentials& credentials,
|
2015-01-10 00:47:02 +00:00
|
|
|
int server_priority,
|
2017-08-29 12:18:32 -07:00
|
|
|
const std::string& origin,
|
2017-09-08 12:50:41 -07:00
|
|
|
const std::vector<std::string>& tls_alpn_protocols,
|
2017-10-10 14:01:40 +02:00
|
|
|
const std::vector<std::string>& tls_elliptic_curves,
|
|
|
|
|
webrtc::TurnCustomizer* customizer) {
|
Make Port (and subclasses) fully "Network"-based, instead of IP-based.
For ICE, we want sockets that are bound to specific network interfaces,
rather than to specific IP addresses. So, a while ago, we added a
"Network" class that gets passed into the Port constructor, in
addition to the IP address as before.
But we never finished the job of removing the IP address field, such that
a Port only guarantees something about the network interface it's
associated with, and not the specific IP address it ends up with.
This CL does that, and as a consequence, if a port ends up bound to
an IP address other than the "best" one (returned by Network::GetBestIP),
this *won't* be treated as an error.
This is relevant to Android, where even though we pass an IP address
into "Bind" as a way of identifying the network, the socket actually
gets bound using "android_setsocknetwork", which doesn't provide any
guarantees about the IP address. So, if a network interface has multiple
IPv6 addresses (for instance), we may not correctly predict the one
the OS will choose, and that's ok.
This CL also moves "SetAlternateLocalAddress" from VirtualSocket to
VirtualSocketServer, which makes for much more readable test code.
The next step, if there is one, is to pass along the Network class all
the way to SocketServer::Bind. Then the socket server could do smart
things with the network information. We could even stick a platform-
specific network handle in the Network object, such that the socket
server could use it for the binding, or for "sendmsg", for example.
See bug 7026 for more context about the sendmsg idea.
BUG=webrtc:7715
Review-Url: https://codereview.webrtc.org/2989303002
Cr-Commit-Position: refs/heads/master@{#19251}
2017-08-04 15:01:57 -07:00
|
|
|
return new TurnPort(thread, factory, network, min_port, max_port, username,
|
|
|
|
|
password, server_address, credentials, server_priority,
|
2017-10-10 14:01:40 +02:00
|
|
|
origin, tls_alpn_protocols, tls_elliptic_curves,
|
|
|
|
|
customizer);
|
2014-10-28 22:20:11 +00:00
|
|
|
}
|
|
|
|
|
|
2017-10-30 10:00:15 -07:00
|
|
|
~TurnPort() override;
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
const ProtocolAddress& server_address() const { return server_address_; }
|
2015-01-10 00:47:02 +00:00
|
|
|
// Returns an empty address if the local address has not been assigned.
|
|
|
|
|
rtc::SocketAddress GetLocalAddress() const;
|
2014-10-28 22:20:11 +00:00
|
|
|
|
2015-08-03 10:23:31 -07:00
|
|
|
bool ready() const { return state_ == STATE_READY; }
|
|
|
|
|
bool connected() const {
|
|
|
|
|
return state_ == STATE_READY || state_ == STATE_CONNECTED;
|
|
|
|
|
}
|
2014-10-28 22:20:11 +00:00
|
|
|
const RelayCredentials& credentials() const { return credentials_; }
|
|
|
|
|
|
2017-10-30 10:00:15 -07:00
|
|
|
ProtocolType GetProtocol() const override;
|
|
|
|
|
|
|
|
|
|
virtual TlsCertPolicy GetTlsCertPolicy() const;
|
|
|
|
|
virtual void SetTlsCertPolicy(TlsCertPolicy tls_cert_policy);
|
|
|
|
|
|
|
|
|
|
virtual std::vector<std::string> GetTlsAlpnProtocols() const;
|
|
|
|
|
virtual std::vector<std::string> GetTlsEllipticCurves() const;
|
|
|
|
|
|
|
|
|
|
void PrepareAddress() override;
|
|
|
|
|
Connection* CreateConnection(const Candidate& c,
|
|
|
|
|
PortInterface::CandidateOrigin origin) override;
|
|
|
|
|
int SendTo(const void* data,
|
|
|
|
|
size_t size,
|
|
|
|
|
const rtc::SocketAddress& addr,
|
|
|
|
|
const rtc::PacketOptions& options,
|
|
|
|
|
bool payload) override;
|
|
|
|
|
int SetOption(rtc::Socket::Option opt, int value) override;
|
|
|
|
|
int GetOption(rtc::Socket::Option opt, int* value) override;
|
|
|
|
|
int GetError() override;
|
|
|
|
|
|
|
|
|
|
bool HandleIncomingPacket(rtc::AsyncPacketSocket* socket,
|
|
|
|
|
const char* data,
|
|
|
|
|
size_t size,
|
|
|
|
|
const rtc::SocketAddress& remote_addr,
|
|
|
|
|
const rtc::PacketTime& packet_time) override;
|
2014-10-28 22:20:11 +00:00
|
|
|
virtual void OnReadPacket(rtc::AsyncPacketSocket* socket,
|
|
|
|
|
const char* data, size_t size,
|
|
|
|
|
const rtc::SocketAddress& remote_addr,
|
|
|
|
|
const rtc::PacketTime& packet_time);
|
|
|
|
|
|
2017-10-30 10:00:15 -07:00
|
|
|
void OnSentPacket(rtc::AsyncPacketSocket* socket,
|
|
|
|
|
const rtc::SentPacket& sent_packet) override;
|
2014-10-28 22:20:11 +00:00
|
|
|
virtual void OnReadyToSend(rtc::AsyncPacketSocket* socket);
|
2017-10-30 10:00:15 -07:00
|
|
|
bool SupportsProtocol(const std::string& protocol) const override;
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
void OnSocketConnect(rtc::AsyncPacketSocket* socket);
|
|
|
|
|
void OnSocketClose(rtc::AsyncPacketSocket* socket, int error);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::string& hash() const { return hash_; }
|
|
|
|
|
const std::string& nonce() const { return nonce_; }
|
|
|
|
|
|
|
|
|
|
int error() const { return error_; }
|
|
|
|
|
|
|
|
|
|
void OnAllocateMismatch();
|
|
|
|
|
|
|
|
|
|
rtc::AsyncPacketSocket* socket() const {
|
|
|
|
|
return socket_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-17 11:36:31 -08:00
|
|
|
// For testing only.
|
|
|
|
|
rtc::AsyncInvoker* invoker() { return &invoker_; }
|
|
|
|
|
|
2014-10-28 22:20:11 +00:00
|
|
|
// Signal with resolved server address.
|
|
|
|
|
// Parameters are port, server address and resolved server address.
|
|
|
|
|
// This signal will be sent only if server address is resolved successfully.
|
|
|
|
|
sigslot::signal3<TurnPort*,
|
|
|
|
|
const rtc::SocketAddress&,
|
|
|
|
|
const rtc::SocketAddress&> SignalResolvedServerAddress;
|
|
|
|
|
|
2015-12-11 15:16:54 -08:00
|
|
|
// All public methods/signals below are for testing only.
|
|
|
|
|
sigslot::signal2<TurnPort*, int> SignalTurnRefreshResult;
|
2014-10-28 22:20:11 +00:00
|
|
|
sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int>
|
|
|
|
|
SignalCreatePermissionResult;
|
2016-01-05 09:06:12 -08:00
|
|
|
void FlushRequests(int msg_type) { request_manager_.Flush(msg_type); }
|
|
|
|
|
bool HasRequests() { return !request_manager_.empty(); }
|
2015-12-11 15:16:54 -08:00
|
|
|
void set_credentials(RelayCredentials& credentials) {
|
|
|
|
|
credentials_ = credentials;
|
|
|
|
|
}
|
|
|
|
|
// Finds the turn entry with |address| and sets its channel id.
|
|
|
|
|
// Returns true if the entry is found.
|
|
|
|
|
bool SetEntryChannelId(const rtc::SocketAddress& address, int channel_id);
|
2016-01-29 13:22:31 -08:00
|
|
|
// Visible for testing.
|
|
|
|
|
// Shuts down the turn port, usually because of some fatal errors.
|
|
|
|
|
void Close();
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
TurnPort(rtc::Thread* thread,
|
|
|
|
|
rtc::PacketSocketFactory* factory,
|
|
|
|
|
rtc::Network* network,
|
|
|
|
|
rtc::AsyncPacketSocket* socket,
|
|
|
|
|
const std::string& username,
|
|
|
|
|
const std::string& password,
|
|
|
|
|
const ProtocolAddress& server_address,
|
|
|
|
|
const RelayCredentials& credentials,
|
2015-01-10 00:47:02 +00:00
|
|
|
int server_priority,
|
2017-10-10 14:01:40 +02:00
|
|
|
const std::string& origin,
|
|
|
|
|
webrtc::TurnCustomizer* customizer);
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
TurnPort(rtc::Thread* thread,
|
|
|
|
|
rtc::PacketSocketFactory* factory,
|
|
|
|
|
rtc::Network* network,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint16_t min_port,
|
|
|
|
|
uint16_t max_port,
|
2014-10-28 22:20:11 +00:00
|
|
|
const std::string& username,
|
|
|
|
|
const std::string& password,
|
|
|
|
|
const ProtocolAddress& server_address,
|
|
|
|
|
const RelayCredentials& credentials,
|
2015-01-10 00:47:02 +00:00
|
|
|
int server_priority,
|
2017-08-29 12:18:32 -07:00
|
|
|
const std::string& origin,
|
2017-09-08 12:50:41 -07:00
|
|
|
const std::vector<std::string>& tls_alpn_protocols,
|
2017-10-10 14:01:40 +02:00
|
|
|
const std::vector<std::string>& tls_elliptic_curves,
|
|
|
|
|
webrtc::TurnCustomizer* customizer);
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
enum {
|
2015-12-11 15:16:54 -08:00
|
|
|
MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE,
|
2015-01-10 02:41:32 +00:00
|
|
|
MSG_ALLOCATE_MISMATCH,
|
2016-01-05 09:06:12 -08:00
|
|
|
MSG_TRY_ALTERNATE_SERVER,
|
|
|
|
|
MSG_REFRESH_ERROR
|
2014-10-28 22:20:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::list<TurnEntry*> EntryList;
|
|
|
|
|
typedef std::map<rtc::Socket::Option, int> SocketOptionsMap;
|
|
|
|
|
typedef std::set<rtc::SocketAddress> AttemptedServerSet;
|
|
|
|
|
|
2017-10-30 10:00:15 -07:00
|
|
|
void OnMessage(rtc::Message* pmsg) override;
|
|
|
|
|
void HandleConnectionDestroyed(Connection* conn) override;
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
bool CreateTurnClientSocket();
|
|
|
|
|
|
|
|
|
|
void set_nonce(const std::string& nonce) { nonce_ = nonce; }
|
|
|
|
|
void set_realm(const std::string& realm) {
|
|
|
|
|
if (realm != realm_) {
|
|
|
|
|
realm_ = realm;
|
|
|
|
|
UpdateHash();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-22 16:26:29 -07:00
|
|
|
void OnRefreshError();
|
|
|
|
|
void HandleRefreshError();
|
2014-10-28 22:20:11 +00:00
|
|
|
bool SetAlternateServer(const rtc::SocketAddress& address);
|
|
|
|
|
void ResolveTurnAddress(const rtc::SocketAddress& address);
|
|
|
|
|
void OnResolveResult(rtc::AsyncResolverInterface* resolver);
|
|
|
|
|
|
|
|
|
|
void AddRequestAuthInfo(StunMessage* msg);
|
|
|
|
|
void OnSendStunPacket(const void* data, size_t size, StunRequest* request);
|
|
|
|
|
// Stun address from allocate success response.
|
|
|
|
|
// Currently used only for testing.
|
|
|
|
|
void OnStunAddress(const rtc::SocketAddress& address);
|
|
|
|
|
void OnAllocateSuccess(const rtc::SocketAddress& address,
|
|
|
|
|
const rtc::SocketAddress& stun_address);
|
|
|
|
|
void OnAllocateError();
|
|
|
|
|
void OnAllocateRequestTimeout();
|
|
|
|
|
|
|
|
|
|
void HandleDataIndication(const char* data, size_t size,
|
|
|
|
|
const rtc::PacketTime& packet_time);
|
|
|
|
|
void HandleChannelData(int channel_id, const char* data, size_t size,
|
|
|
|
|
const rtc::PacketTime& packet_time);
|
|
|
|
|
void DispatchPacket(const char* data, size_t size,
|
|
|
|
|
const rtc::SocketAddress& remote_addr,
|
|
|
|
|
ProtocolType proto, const rtc::PacketTime& packet_time);
|
|
|
|
|
|
|
|
|
|
bool ScheduleRefresh(int lifetime);
|
|
|
|
|
void SendRequest(StunRequest* request, int delay);
|
|
|
|
|
int Send(const void* data, size_t size,
|
|
|
|
|
const rtc::PacketOptions& options);
|
|
|
|
|
void UpdateHash();
|
|
|
|
|
bool UpdateNonce(StunMessage* response);
|
2016-02-01 15:19:08 -08:00
|
|
|
void ResetNonce();
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
bool HasPermission(const rtc::IPAddress& ipaddr) const;
|
|
|
|
|
TurnEntry* FindEntry(const rtc::SocketAddress& address) const;
|
|
|
|
|
TurnEntry* FindEntry(int channel_id) const;
|
2015-12-02 16:43:25 -08:00
|
|
|
bool EntryExists(TurnEntry* e);
|
2015-11-17 11:36:31 -08:00
|
|
|
void CreateOrRefreshEntry(const rtc::SocketAddress& address);
|
|
|
|
|
void DestroyEntry(TurnEntry* entry);
|
|
|
|
|
// Destroys the entry only if |timestamp| matches the destruction timestamp
|
|
|
|
|
// in |entry|.
|
2016-03-16 08:55:44 -07:00
|
|
|
void DestroyEntryIfNotCancelled(TurnEntry* entry, int64_t timestamp);
|
2015-11-17 11:36:31 -08:00
|
|
|
void ScheduleEntryDestruction(TurnEntry* entry);
|
2014-10-28 22:20:11 +00:00
|
|
|
|
2016-06-22 16:26:29 -07:00
|
|
|
// Marks the connection with remote address |address| failed and
|
|
|
|
|
// pruned (a.k.a. write-timed-out). Returns true if a connection is found.
|
|
|
|
|
bool FailAndPruneConnection(const rtc::SocketAddress& address);
|
2015-12-11 15:16:54 -08:00
|
|
|
|
2017-02-13 12:47:27 -08:00
|
|
|
// Reconstruct the URL of the server which the candidate is gathered from.
|
|
|
|
|
std::string ReconstructedServerUrl();
|
|
|
|
|
|
2017-10-10 14:01:40 +02:00
|
|
|
void TurnCustomizerMaybeModifyOutgoingStunMessage(StunMessage* message);
|
|
|
|
|
bool TurnCustomizerAllowChannelData(const void* data,
|
|
|
|
|
size_t size, bool payload);
|
|
|
|
|
|
2014-10-28 22:20:11 +00:00
|
|
|
ProtocolAddress server_address_;
|
2017-01-09 08:35:45 -08:00
|
|
|
TlsCertPolicy tls_cert_policy_ = TlsCertPolicy::TLS_CERT_POLICY_SECURE;
|
2017-08-29 12:18:32 -07:00
|
|
|
std::vector<std::string> tls_alpn_protocols_;
|
2017-09-08 12:50:41 -07:00
|
|
|
std::vector<std::string> tls_elliptic_curves_;
|
2014-10-28 22:20:11 +00:00
|
|
|
RelayCredentials credentials_;
|
|
|
|
|
AttemptedServerSet attempted_server_addresses_;
|
|
|
|
|
|
|
|
|
|
rtc::AsyncPacketSocket* socket_;
|
|
|
|
|
SocketOptionsMap socket_options_;
|
|
|
|
|
rtc::AsyncResolverInterface* resolver_;
|
|
|
|
|
int error_;
|
|
|
|
|
|
|
|
|
|
StunRequestManager request_manager_;
|
|
|
|
|
std::string realm_; // From 401/438 response message.
|
|
|
|
|
std::string nonce_; // From 401/438 response message.
|
|
|
|
|
std::string hash_; // Digest of username:realm:password
|
|
|
|
|
|
|
|
|
|
int next_channel_number_;
|
|
|
|
|
EntryList entries_;
|
|
|
|
|
|
2015-08-03 10:23:31 -07:00
|
|
|
PortState state_;
|
2014-10-28 22:20:11 +00:00
|
|
|
// By default the value will be set to 0. This value will be used in
|
|
|
|
|
// calculating the candidate priority.
|
|
|
|
|
int server_priority_;
|
|
|
|
|
|
|
|
|
|
// The number of retries made due to allocate mismatch error.
|
|
|
|
|
size_t allocate_mismatch_retries_;
|
|
|
|
|
|
2015-11-17 11:36:31 -08:00
|
|
|
rtc::AsyncInvoker invoker_;
|
|
|
|
|
|
2017-10-10 14:01:40 +02:00
|
|
|
// Optional TurnCustomizer that can modify outgoing messages.
|
|
|
|
|
webrtc::TurnCustomizer *turn_customizer_ = nullptr;
|
|
|
|
|
|
2014-10-28 22:20:11 +00:00
|
|
|
friend class TurnEntry;
|
|
|
|
|
friend class TurnAllocateRequest;
|
|
|
|
|
friend class TurnRefreshRequest;
|
|
|
|
|
friend class TurnCreatePermissionRequest;
|
|
|
|
|
friend class TurnChannelBindRequest;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cricket
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // P2P_BASE_TURNPORT_H_
|