提交 d318e260 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Work in DTLS stuff

上级 b13a9214
......@@ -128,6 +128,11 @@ class Transport extends EventEmitter
});
}
/**
* Start the DTLS stack
* @param {Object} remoteDtlsParameters Remote DTLS parameters
* @return {Promise}
*/
start(remoteDtlsParameters)
{
logger.debug('start() [remoteDtlsParameters:%o]', remoteDtlsParameters);
......@@ -140,7 +145,8 @@ class Transport extends EventEmitter
roomId : this._roomId,
peerId : this._peerId,
transportId : this._transportId,
remoteDtlsParameters :remoteDtlsParameters
role : remoteDtlsParameters.role,
fingerprint : remoteDtlsParameters.fingerprint
};
// Send Channel request
......@@ -155,6 +161,10 @@ class Transport extends EventEmitter
});
}
/**
* Create an asociated Transport for RTCP
* @return {Promise}
*/
createAssociatedTransport()
{
logger.debug('createAssociatedTransport()');
......
......@@ -177,7 +177,7 @@ app.put('/test-transport', function(req)
});
});
setInterval(() =>
setTimeout(() =>
{
room.dump()
.then((data) => debug('ROOM DUMP:\n%s', JSON.stringify(data, null, '\t')))
......
#ifndef MS_RTC_DTLS_AGENT_H
#define MS_RTC_DTLS_AGENT_H
#ifndef MS_RTC_DTLS_TRANSPORT_H
#define MS_RTC_DTLS_TRANSPORT_H
#include "common.h"
#include "RTC/SRTPSession.h"
#include "handles/Timer.h"
#include <string>
#include <map>
#include <vector>
#include <openssl/ssl.h>
#include <openssl/bio.h>
......@@ -13,28 +14,36 @@
namespace RTC
{
class DTLSAgent :
class DTLSTransport :
public Timer::Listener
{
public:
enum class DTLSRole
enum class Role
{
NONE = 0,
SERVER = 1,
CLIENT
AUTO = 1,
CLIENT,
SERVER
};
public:
enum class FingerprintHash
enum class FingerprintAlgorithm
{
NONE = 0,
SHA1 = 1,
NONE = 0,
SHA1 = 1,
SHA224,
SHA256,
SHA384,
SHA512
};
public:
struct Fingerprint
{
FingerprintAlgorithm algorithm;
std::string value;
};
private:
struct SrtpProfileMapEntry
{
......@@ -48,20 +57,22 @@ namespace RTC
public:
// NOTE: The caller MUST NOT call Reset() or Close() during the
// onOutgoingDTLSData() callback.
virtual void onOutgoingDTLSData(DTLSAgent* dtlsAgent, const MS_BYTE* data, size_t len) = 0;
virtual void onOutgoingDTLSData(DTLSTransport* dtlsTransport, const MS_BYTE* data, size_t len) = 0;
// NOTE: The caller MUST NOT call any method during the onDTLSConnected,
// onDTLSDisconnected or onDTLSFailed callbacks.
virtual void onDTLSConnected(DTLSAgent* dtlsAgent) = 0;
virtual void onDTLSDisconnected(DTLSAgent* dtlsAgent) = 0;
virtual void onDTLSFailed(DTLSAgent* dtlsAgent) = 0;
virtual void onSRTPKeyMaterial(DTLSAgent* dtlsAgent, RTC::SRTPSession::SRTPProfile srtp_profile, MS_BYTE* srtp_local_key, size_t srtp_local_key_len, MS_BYTE* srtp_remote_key, size_t srtp_remote_key_len) = 0;
virtual void onDTLSApplicationData(DTLSAgent* dtlsAgent, const MS_BYTE* data, size_t len) = 0;
virtual void onDTLSConnected(DTLSTransport* dtlsTransport) = 0;
virtual void onDTLSDisconnected(DTLSTransport* dtlsTransport) = 0;
virtual void onDTLSFailed(DTLSTransport* dtlsTransport) = 0;
virtual void onSRTPKeyMaterial(DTLSTransport* dtlsTransport, RTC::SRTPSession::SRTPProfile srtp_profile, MS_BYTE* srtp_local_key, size_t srtp_local_key_len, MS_BYTE* srtp_remote_key, size_t srtp_remote_key_len) = 0;
virtual void onDTLSApplicationData(DTLSTransport* dtlsTransport, const MS_BYTE* data, size_t len) = 0;
};
public:
static void ClassInit();
static void ClassDestroy();
static Json::Value& GetLocalFingerprints();
static Role GetRole(std::string role);
static FingerprintAlgorithm GetFingerprintAlgorithm(std::string fingerprint);
static bool IsDTLS(const MS_BYTE* data, size_t len);
private:
......@@ -74,21 +85,22 @@ namespace RTC
static X509* certificate;
static EVP_PKEY* privateKey;
static SSL_CTX* sslCtx;
static Json::Value localFingerprints;
typedef std::vector<SrtpProfileMapEntry> SRTPProfiles;
static SRTPProfiles srtpProfiles;
static MS_BYTE sslReadBuffer[];
static std::map<std::string, Role> string2Role;
static std::map<std::string, FingerprintAlgorithm> string2FingerprintAlgorithm;
static Json::Value localFingerprints;
static std::vector<SrtpProfileMapEntry> srtpProfiles;
public:
DTLSAgent(Listener* listener);
virtual ~DTLSAgent();
DTLSTransport(Listener* listener);
virtual ~DTLSTransport();
void Run(DTLSRole role);
void SetRemoteFingerprint(FingerprintHash hash, std::string& fingerprint);
void Start(Role role);
void SetRemoteFingerprint(Fingerprint fingerprint);
void Reset();
void Close();
void ProcessDTLSData(const MS_BYTE* data, size_t len);
bool IsRunning();
bool IsStarted();
bool IsConnected();
void SendApplicationData(const MS_BYTE* data, size_t len);
void Dump();
......@@ -119,15 +131,13 @@ namespace RTC
BIO* sslBioToNetwork = nullptr; // The BIO in which ssl writes.
Timer* timer = nullptr;
// Others.
// TODO: rename to localRole
DTLSRole role = DTLSRole::NONE;
FingerprintHash remoteFingerprintHash = FingerprintHash::NONE;
std::string remoteFingerprint;
bool isRunning = false;
bool isHandshakeDone = false;
bool isHandshakeDoneNow = false;
bool isConnected = false;
bool isCheckingStatus = false;
Role localRole = Role::NONE;
Fingerprint remoteFingerprint = { FingerprintAlgorithm::NONE, "" };
bool started = false;
bool handshakeDone = false;
bool handshakeDoneNow = false;
bool connected = false;
bool checkingStatus = false;
bool doReset = false;
bool doClose = false;
};
......@@ -135,7 +145,35 @@ namespace RTC
/* Inline static methods. */
inline
bool DTLSAgent::IsDTLS(const MS_BYTE* data, size_t len)
Json::Value& DTLSTransport::GetLocalFingerprints()
{
return DTLSTransport::localFingerprints;
}
inline
DTLSTransport::Role DTLSTransport::GetRole(std::string role)
{
auto it = DTLSTransport::string2Role.find(role);
if (it != DTLSTransport::string2Role.end())
return it->second;
else
return DTLSTransport::Role::NONE;
}
inline
DTLSTransport::FingerprintAlgorithm DTLSTransport::GetFingerprintAlgorithm(std::string fingerprint)
{
auto it = DTLSTransport::string2FingerprintAlgorithm.find(fingerprint);
if (it != DTLSTransport::string2FingerprintAlgorithm.end())
return it->second;
else
return DTLSTransport::FingerprintAlgorithm::NONE;
}
inline
bool DTLSTransport::IsDTLS(const MS_BYTE* data, size_t len)
{
return (
// Minimum DTLS record length is 13 bytes.
......@@ -148,15 +186,15 @@ namespace RTC
/* Inline instance methods. */
inline
bool DTLSAgent::IsConnected()
bool DTLSTransport::IsConnected()
{
return this->isConnected;
return this->connected;
}
inline
bool DTLSAgent::IsRunning()
bool DTLSTransport::IsStarted()
{
return this->isRunning;
return this->started;
}
}
......
......@@ -4,7 +4,7 @@
#include "common.h"
#include "RTC/IceCandidate.h"
#include "RTC/IceServer.h"
#include "RTC/DTLSAgent.h"
#include "RTC/DTLSTransport.h"
#include "RTC/STUNMessage.h"
#include "RTC/TransportSource.h"
#include "RTC/UDPSocket.h"
......@@ -18,10 +18,11 @@
namespace RTC
{
class Transport :
public RTC::IceServer::Listener,
public RTC::UDPSocket::Listener,
public RTC::TCPServer::Listener,
public RTC::TCPConnection::Reader
public RTC::TCPConnection::Reader,
public RTC::IceServer::Listener,
public RTC::DTLSTransport::Listener
{
public:
class Listener
......@@ -52,14 +53,10 @@ namespace RTC
Transport* CreateAssociatedTransport(unsigned int transportId);
private:
bool SetSendingSource(RTC::TransportSource* source);
bool IsValidSource(RTC::TransportSource* source);
int SetSendingSource(RTC::TransportSource* source);
int IsValidSource(RTC::TransportSource* source);
bool RemoveSource(RTC::TransportSource* source);
/* Pure virtual methods inherited from RTC::IceServer::Listener. */
public:
virtual void onOutgoingSTUNMessage(RTC::IceServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source) override;
virtual void onICEValidPair(RTC::IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate) override;
void RunDTLSTransportIfReady();
/* Private methods to unify UDP and TCP behavior. */
private:
......@@ -86,6 +83,20 @@ namespace RTC
virtual void onRTPDataRecv(RTC::TCPConnection *connection, const MS_BYTE* data, size_t len) override;
virtual void onRTCPDataRecv(RTC::TCPConnection *connection, const MS_BYTE* data, size_t len) override;
/* Pure virtual methods inherited from RTC::IceServer::Listener. */
public:
virtual void onOutgoingSTUNMessage(RTC::IceServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source) override;
virtual void onICEValidPair(RTC::IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate) override;
/* Pure virtual methods inherited from RTC::DTLSTransport::Listener. */
public:
virtual void onOutgoingDTLSData(RTC::DTLSTransport* dtlsTransport, const MS_BYTE* data, size_t len) override;
virtual void onDTLSConnected(RTC::DTLSTransport* dtlsTransport) override;
virtual void onDTLSDisconnected(RTC::DTLSTransport* dtlsTransport) override;
virtual void onDTLSFailed(RTC::DTLSTransport* dtlsTransport) override;
virtual void onSRTPKeyMaterial(RTC::DTLSTransport* dtlsTransport, RTC::SRTPSession::SRTPProfile srtp_profile, MS_BYTE* srtp_local_key, size_t srtp_local_key_len, MS_BYTE* srtp_remote_key, size_t srtp_remote_key_len) override;
virtual void onDTLSApplicationData(RTC::DTLSTransport* dtlsTransport, const MS_BYTE* data, size_t len) override;
public:
// Passed by argument.
unsigned int transportId;
......@@ -103,13 +114,18 @@ namespace RTC
RTC::IceServer* iceServer = nullptr;
std::vector<RTC::UDPSocket*> udpSockets;
std::vector<RTC::TCPServer*> tcpServers;
RTC::DTLSTransport* dtlsTransport = nullptr;
// Others.
bool allocated = false;
// Others (ICE).
std::vector<IceCandidate> iceLocalCandidates;
std::list<RTC::TransportSource> sources;
RTC::TransportSource* sendingSource = nullptr;
bool icePaired = false;
bool icePairedWithUseCandidate = false;
// Others (DTLS).
bool started = false;
RTC::DTLSTransport::Role dtlsLocalRole = RTC::DTLSTransport::Role::CLIENT;
};
/* Inline methods. */
......@@ -133,14 +149,23 @@ namespace RTC
* @param source: A RTC::TransportSource (which is a UDP tuple or TCP connection).
* @return: true if the given source was not an already valid source,
* false otherwise.
* @return: 1 if it's the current sending source, 2 if it's another
* valid source, 0 if it's not a valid source.
*/
inline
bool Transport::SetSendingSource(RTC::TransportSource* source)
int Transport::SetSendingSource(RTC::TransportSource* source)
{
// If the give source is already a valid one return.
// Check whether this is already a valid source.
// NOTE: The IsValidSource() method will also mark it as sending source.
if (IsValidSource(source))
return false;
switch (IsValidSource(source))
{
// This is already the sending source.
case 1:
return 1;
// This is another valid source.
case 2:
return 2;
}
// If there are Transport::maxSources sources then close and remove the last one.
if (this->sources.size() == Transport::maxSources)
......@@ -162,7 +187,7 @@ namespace RTC
if (this->sendingSource->IsUDP())
this->sendingSource->StoreUdpRemoteAddress();
return true;
return 0;
}
/**
......@@ -171,34 +196,36 @@ namespace RTC
* source for the outgoing data.
*
* @param source: The RTC::TransportSource to check.
* @return: true if it is a valid source, false otherwise.
* @return: 1 if it's the current sending source, 2 if it's another
* valid source, 0 if it's not a valid source.
*/
inline
bool Transport::IsValidSource(RTC::TransportSource* source)
int Transport::IsValidSource(RTC::TransportSource* source)
{
// If there is no sending source yet then we know that the sources list
// is empty, so return false.
// is empty, so return 0.
if (!this->sendingSource)
return false;
return 0;
// First check the current sending source. If it matches then return true.
// First check the current sending source. If it matches then return 1.
if (this->sendingSource->Compare(source))
return true;
return 1;
// Otherwise check other valid source in the sources list.
for (auto it = this->sources.begin(); it != this->sources.end(); ++it)
{
RTC::TransportSource* valid_source = &(*it);
// If found set it as sending source.
// If found set it as sending source and return 2.
if (valid_source->Compare(source))
{
this->sendingSource = valid_source;
return true;
return 2;
}
}
return false;
// Otherwise it is not a valid source so return 0.
return 0;
}
/**
......@@ -236,6 +263,8 @@ namespace RTC
// This is just useful is there are just TCP sources.
this->icePaired = false;
this->icePairedWithUseCandidate = false;
// TODO: This should fire a 'icefailed' event.
}
}
......
......@@ -16,12 +16,12 @@ public:
public:
/* Struct for the data field of uv_req_t when writing into the connection. */
typedef struct UvWriteData
struct UvWriteData
{
TCPConnection* connection;
uv_write_t req;
MS_BYTE store[1];
} UvWriteData;
TCPConnection* connection;
uv_write_t req;
MS_BYTE store[1];
};
public:
TCPConnection(size_t bufferSize);
......
......@@ -9,12 +9,12 @@ class UDPSocket
{
public:
/* Struct for the data field of uv_req_t when sending a datagram. */
typedef struct UvSendData
struct UvSendData
{
UDPSocket* socket;
uv_udp_send_t req;
MS_BYTE store[1];
} UvSendData;
UDPSocket* socket;
uv_udp_send_t req;
MS_BYTE store[1];
};
private:
static MS_BYTE readBuffer[];
......
......@@ -9,12 +9,12 @@ class UnixStreamSocket
{
public:
/* Struct for the data field of uv_req_t when writing data. */
typedef struct UvWriteData
struct UvWriteData
{
UnixStreamSocket* socket;
uv_write_t req;
MS_BYTE store[1];
} UvWriteData;
UnixStreamSocket* socket;
uv_write_t req;
MS_BYTE store[1];
};
public:
UnixStreamSocket(int fd, size_t bufferSize);
......
......@@ -2,7 +2,7 @@
#include "RTC/TCPConnection.h"
#include "RTC/STUNMessage.h"
#include "RTC/DTLSAgent.h"
#include "RTC/DTLSTransport.h"
#include "RTC/RTPPacket.h"
#include "RTC/RTCPPacket.h"
#include "Utils.h"
......@@ -84,7 +84,7 @@ namespace RTC
this->reader->onRTPDataRecv(this, packet, packet_len);
}
// Check if it's DTLS.
else if (DTLSAgent::IsDTLS(packet, packet_len))
else if (DTLSTransport::IsDTLS(packet, packet_len))
{
this->reader->onDTLSDataRecv(this, packet, packet_len);
}
......
......@@ -51,6 +51,7 @@ namespace RTC
{
this->iceComponent = IceComponent::RTP;
// Create a ICE server.
this->iceServer = new RTC::IceServer(this,
Utils::Crypto::GetRandomString(16),
Utils::Crypto::GetRandomString(32));
......@@ -66,6 +67,7 @@ namespace RTC
{
this->iceComponent = IceComponent::RTCP;
// Create a ICE server.
this->iceServer = new RTC::IceServer(this,
rtpTransport->GetIceUsernameFragment(),
rtpTransport->GetIcePassword());
......@@ -184,6 +186,9 @@ namespace RTC
MS_THROW_ERROR("could not open any IP:port");
}
// Create a DTLS agent.
this->dtlsTransport = new RTC::DTLSTransport(this);
// Hack to avoid that Close() above attempts to delete this.
this->allocated = true;
}
......@@ -200,8 +205,8 @@ namespace RTC
if (this->iceServer)
this->iceServer->Close();
// if (this->dtlsAgent)
// this->dtlsAgent->Close();
if (this->dtlsTransport)
this->dtlsTransport->Close();
// if (this->srtpRecvSession)
// this->srtpRecvSession->Close();
......@@ -257,7 +262,7 @@ namespace RTC
}
// Add `dtlsLocalFingerprints`.
data[k_dtlsLocalFingerprints] = RTC::DTLSAgent::GetLocalFingerprints();
data[k_dtlsLocalFingerprints] = RTC::DTLSTransport::GetLocalFingerprints();
return data;
}
......@@ -291,7 +296,72 @@ namespace RTC
case Channel::Request::MethodId::transport_start:
{
// TODO
static const Json::StaticString k_role("role");
static const Json::StaticString v_auto("auto");
static const Json::StaticString v_client("client");
static const Json::StaticString v_server("server");
static const Json::StaticString k_fingerprint("fingerprint");
static const Json::StaticString k_algorithm("algorithm");
static const Json::StaticString k_value("value");
RTC::DTLSTransport::FingerprintAlgorithm fingerprint_algorithm;
std::string fingerprint_value;
RTC::DTLSTransport::Role role = RTC::DTLSTransport::Role::AUTO; // Default value.
// Ensure this method is not called twice.
if (this->started)
{
MS_ERROR("method already called");
request->Reject(500, "method already called");
return;
}
this->started = true;
// Validate request data.
if (!request->data[k_fingerprint].isObject())
{
MS_ERROR("missing .fingerprint");
request->Reject(500, "missing .fingerprint");
return;
}
if (!request->data[k_fingerprint][k_algorithm].isString() ||
!request->data[k_fingerprint][k_value].isString())
{
MS_ERROR("missing .fingerprint.algorithm and/or .fingerprint.value");
request->Reject(500, "missing .fingerprint.algorithm and/or .fingerprint.value");
return;
}
fingerprint_algorithm = RTC::DTLSTransport::GetFingerprintAlgorithm(request->data[k_fingerprint][k_algorithm].asString());
if (fingerprint_algorithm == RTC::DTLSTransport::FingerprintAlgorithm::NONE)
{
MS_ERROR("unsupported .fingerprint.algorithm");
request->Reject(500, "unsupported .fingerprint.algorithm");
return;
}
fingerprint_value = request->data[k_fingerprint][k_value].asString();
if (request->data[k_role].isString())
{
role = RTC::DTLSTransport::GetRole(request->data[k_role].asString());
if (role == RTC::DTLSTransport::Role::NONE)
{
MS_ERROR("invalid .role");
request->Reject(500, "invalid .role");
return;
}
}
break;
}
......@@ -315,32 +385,12 @@ namespace RTC
return new RTC::Transport(this->listener, transportId, nullData, this);
}
void Transport::onOutgoingSTUNMessage(RTC::IceServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source)
{
MS_TRACE();
// Send the STUN response over the same transport source.
source->Send(msg->GetRaw(), msg->GetLength());
}
void Transport::onICEValidPair(RTC::IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate)
inline
void Transport::RunDTLSTransportIfReady()
{
MS_TRACE();
this->icePaired = true;
if (has_use_candidate)
this->icePairedWithUseCandidate = true;
/*
* RFC 5245 section 11.2 "Receiving Media":
*
* ICE implementations MUST be prepared to receive media on each component
* on any candidates provided for that component.
*/
if (SetSendingSource(source))
MS_DEBUG("got an ICE valid pair [UseCandidate:%s]", has_use_candidate ? "true" : "false");
// TODO: more
// TODO
}
inline
......@@ -431,13 +481,12 @@ namespace RTC
{
MS_TRACE();
// RTC::TransportSource source(connection);
RTC::TransportSource source(connection);
// if (RemoveSource(&source))
// {
// MS_DEBUG("valid source %s:", is_closed_by_peer ? "closed by peer" : "locally closed");
// source.Dump();
// }
if (RemoveSource(&source))
{
MS_DEBUG("valid source %s:", is_closed_by_peer ? "closed by peer" : "locally closed");
}
}
void Transport::onSTUNDataRecv(RTC::TCPConnection *connection, const MS_BYTE* data, size_t len)
......@@ -471,4 +520,113 @@ namespace RTC
RTC::TransportSource source(connection);
onRTCPDataRecv(&source, data, len);
}
void Transport::onOutgoingSTUNMessage(RTC::IceServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source)
{
MS_TRACE();
// Send the STUN response over the same transport source.
source->Send(msg->GetRaw(), msg->GetLength());
}
void Transport::onICEValidPair(RTC::IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate)
{
MS_TRACE();
/*
* RFC 5245 section 11.2 "Receiving Media":
*
* ICE implementations MUST be prepared to receive media on each component
* on any candidates provided for that component.
*/
this->icePaired = true;
if (has_use_candidate)
this->icePairedWithUseCandidate = true;
switch (SetSendingSource(source))
{
// This is a new source.
case 0:
MS_DEBUG("got a new ICE valid pair [UseCandidate:%s]", has_use_candidate ? "true" : "false");
break;
// This is already the sending source.
case 1:
break;
// This is another valid source.
case 2:
MS_DEBUG("got a previous ICE valid pair [UseCandidate:%s]", has_use_candidate ? "true" : "false");
break;
}
// If ready, run the DTLS handler.
RunDTLSTransportIfReady();
}
void Transport::onOutgoingDTLSData(RTC::DTLSTransport* dtlsTransport, const MS_BYTE* data, size_t len)
{
MS_TRACE();
if (!this->sendingSource)
{
MS_DEBUG("no sending address set, cannot send DTLS packet");
return;
}
// TODO: remove
MS_DEBUG("sending DTLS data to to:");
this->sendingSource->Dump();
this->sendingSource->Send(data, len);
}
void Transport::onDTLSConnected(RTC::DTLSTransport* dtlsTransport)
{
MS_TRACE();
MS_DEBUG("DTLS connected");
}
void Transport::onDTLSDisconnected(RTC::DTLSTransport* dtlsTransport)
{
MS_TRACE();
MS_DEBUG("DTLS disconnected");
// TODO
// Reset();
}
void Transport::onDTLSFailed(RTC::DTLSTransport* dtlsTransport)
{
MS_TRACE();
MS_DEBUG("DTLS failed");
// TODO
// Reset();
}
void Transport::onSRTPKeyMaterial(RTC::DTLSTransport* dtlsTransport, RTC::SRTPSession::SRTPProfile srtp_profile, MS_BYTE* srtp_local_key, size_t srtp_local_key_len, MS_BYTE* srtp_remote_key, size_t srtp_remote_key_len)
{
MS_TRACE();
MS_DEBUG("got SRTP key material");
// TODO
// SetLocalSRTPKey(srtp_profile, srtp_local_key, srtp_local_key_len);
// SetRemoteSRTPKey(srtp_profile, srtp_remote_key, srtp_remote_key_len);
}
void Transport::onDTLSApplicationData(RTC::DTLSTransport* dtlsTransport, const MS_BYTE* data, size_t len)
{
MS_TRACE();
MS_DEBUG("DTLS application data received [size:%zu]", len);
// TMP
MS_DEBUG("data: %s", std::string((char*)data, len).c_str());
}
}
......@@ -2,7 +2,7 @@
#include "RTC/UDPSocket.h"
#include "RTC/STUNMessage.h"
#include "RTC/DTLSAgent.h"
#include "RTC/DTLSTransport.h"
#include "RTC/RTPPacket.h"
#include "RTC/RTCPPacket.h"
#include "Settings.h"
......@@ -368,7 +368,7 @@ namespace RTC
}
// Check if it's DTLS.
if (DTLSAgent::IsDTLS(data, len))
if (DTLSTransport::IsDTLS(data, len))
{
this->listener->onDTLSDataRecv(this, data, len, addr);
return;
......
......@@ -326,7 +326,7 @@ void TCPConnection::onUvReadAlloc(size_t suggested_size, uv_buf_t* buf)
if (this->bufferSize > this->bufferDataLen)
{
buf->len = this->bufferSize - this->bufferDataLen;
MS_DEBUG("available space in the buffer: %zu", buf->len);
// MS_DEBUG("available space in the buffer: %zu", buf->len);
}
else
{
......
......@@ -10,7 +10,7 @@
#include "Channel/UnixStreamSocket.h"
#include "RTC/UDPSocket.h"
#include "RTC/TCPServer.h"
#include "RTC/DTLSAgent.h"
#include "RTC/DTLSTransport.h"
#include "RTC/SRTPSession.h"
#include "Loop.h"
#include "MediaSoupError.h"
......@@ -113,7 +113,7 @@ void init()
DepUsrSCTP::ClassInit();
RTC::UDPSocket::ClassInit();
RTC::TCPServer::ClassInit();
RTC::DTLSAgent::ClassInit();
RTC::DTLSTransport::ClassInit();
RTC::SRTPSession::ClassInit();
Utils::Crypto::ClassInit();
}
......@@ -159,7 +159,7 @@ void destroy()
DepOpenSSL::ClassDestroy();
DepLibSRTP::ClassDestroy();
DepUsrSCTP::ClassDestroy();
RTC::DTLSAgent::ClassDestroy();
RTC::DTLSTransport::ClassDestroy();
Utils::Crypto::ClassDestroy();
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论