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

ICE => Ice

上级 e1997532
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace RTC namespace RTC
{ {
class ICEServer class IceServer
{ {
public: public:
class Listener class Listener
...@@ -20,12 +20,12 @@ namespace RTC ...@@ -20,12 +20,12 @@ namespace RTC
* These callbacks are guaranteed to be called before ProcessSTUNMessage() * These callbacks are guaranteed to be called before ProcessSTUNMessage()
* returns, so the given pointers are still usable. * returns, so the given pointers are still usable.
*/ */
virtual void onOutgoingSTUNMessage(ICEServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source) = 0; virtual void onOutgoingSTUNMessage(IceServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source) = 0;
virtual void onICEValidPair(ICEServer* iceServer, RTC::TransportSource* source, bool has_use_candidate) = 0; virtual void onICEValidPair(IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate) = 0;
}; };
public: public:
ICEServer(Listener* listener, std::string& usernameFragment, std::string password); IceServer(Listener* listener, std::string& usernameFragment, std::string password);
void Close(); void Close();
void ProcessSTUNMessage(RTC::STUNMessage* msg, RTC::TransportSource* source); void ProcessSTUNMessage(RTC::STUNMessage* msg, RTC::TransportSource* source);
...@@ -43,13 +43,13 @@ namespace RTC ...@@ -43,13 +43,13 @@ namespace RTC
/* Inline methods. */ /* Inline methods. */
inline inline
std::string& ICEServer::GetUsernameFragment() std::string& IceServer::GetUsernameFragment()
{ {
return this->usernameFragment; return this->usernameFragment;
} }
inline inline
std::string& ICEServer::GetPassword() std::string& IceServer::GetPassword()
{ {
return this->password; return this->password;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "common.h" #include "common.h"
#include "RTC/IceCandidate.h" #include "RTC/IceCandidate.h"
#include "RTC/ICEServer.h" #include "RTC/IceServer.h"
#include "RTC/STUNMessage.h" #include "RTC/STUNMessage.h"
#include "RTC/TransportSource.h" #include "RTC/TransportSource.h"
#include "RTC/UDPSocket.h" #include "RTC/UDPSocket.h"
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace RTC namespace RTC
{ {
class IceTransport : class IceTransport :
public RTC::ICEServer::Listener, public RTC::IceServer::Listener,
public RTC::UDPSocket::Listener, public RTC::UDPSocket::Listener,
public RTC::TCPServer::Listener, public RTC::TCPServer::Listener,
public RTC::TCPConnection::Reader public RTC::TCPConnection::Reader
...@@ -51,10 +51,10 @@ namespace RTC ...@@ -51,10 +51,10 @@ namespace RTC
std::vector<IceCandidate>& GetIceLocalCandidates(); std::vector<IceCandidate>& GetIceLocalCandidates();
// IceTransport* CreateAssociatedGatherer(); // TODO: let's see. // IceTransport* CreateAssociatedGatherer(); // TODO: let's see.
/* Pure virtual methods inherited from RTC::ICEServer::Listener. */ /* Pure virtual methods inherited from RTC::IceServer::Listener. */
public: public:
virtual void onOutgoingSTUNMessage(RTC::ICEServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source) override; 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; virtual void onICEValidPair(RTC::IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate) override;
/* Private methods to unify UDP and TCP behavior. */ /* Private methods to unify UDP and TCP behavior. */
private: private:
...@@ -85,7 +85,7 @@ namespace RTC ...@@ -85,7 +85,7 @@ namespace RTC
// Passed by argument. // Passed by argument.
Listener* listener = nullptr; Listener* listener = nullptr;
// Allocated by this. // Allocated by this.
RTC::ICEServer* iceServer = nullptr; RTC::IceServer* iceServer = nullptr;
std::vector<RTC::UDPSocket*> udpSockets; std::vector<RTC::UDPSocket*> udpSockets;
std::vector<RTC::TCPServer*> tcpServers; std::vector<RTC::TCPServer*> tcpServers;
// Others. // Others.
......
#define MS_CLASS "RTC::ICEServer" #define MS_CLASS "RTC::IceServer"
#include "RTC/ICEServer.h" #include "RTC/IceServer.h"
#include "Logger.h" #include "Logger.h"
namespace RTC namespace RTC
{ {
/* Instance methods. */ /* Instance methods. */
ICEServer::ICEServer(Listener* listener, std::string& usernameFragment, std::string password) : IceServer::IceServer(Listener* listener, std::string& usernameFragment, std::string password) :
listener(listener), listener(listener),
usernameFragment(usernameFragment), usernameFragment(usernameFragment),
password(password) password(password)
...@@ -17,14 +17,14 @@ namespace RTC ...@@ -17,14 +17,14 @@ namespace RTC
MS_DEBUG("[usernameFragment:%s, password:%s]", this->usernameFragment.c_str(), this->password.c_str()); MS_DEBUG("[usernameFragment:%s, password:%s]", this->usernameFragment.c_str(), this->password.c_str());
} }
void ICEServer::Close() void IceServer::Close()
{ {
MS_TRACE(); MS_TRACE();
delete this; delete this;
} }
void ICEServer::ProcessSTUNMessage(RTC::STUNMessage* msg, RTC::TransportSource* source) void IceServer::ProcessSTUNMessage(RTC::STUNMessage* msg, RTC::TransportSource* source)
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -42,14 +42,14 @@ namespace RTC ...@@ -42,14 +42,14 @@ namespace RTC
MS_DEBUG("[udp:%s, tcp:%s]", MS_DEBUG("[udp:%s, tcp:%s]",
option_udp ? "true" : "false", option_tcp ? "true" : "false"); option_udp ? "true" : "false", option_tcp ? "true" : "false");
// Create an ICEServer. // Create an IceServer.
char _username_fragment[16]; char _username_fragment[16];
char _password[16]; char _password[16];
std::string usernameFragment = std::string(Utils::Crypto::GetRandomHexString(_username_fragment, 16), 16); std::string usernameFragment = std::string(Utils::Crypto::GetRandomHexString(_username_fragment, 16), 16);
std::string password = std::string(Utils::Crypto::GetRandomHexString(_password, 32), 32); std::string password = std::string(Utils::Crypto::GetRandomHexString(_password, 32), 32);
this->iceServer = new RTC::ICEServer(this, usernameFragment, password); this->iceServer = new RTC::IceServer(this, usernameFragment, password);
// Fill IceParameters. // Fill IceParameters.
this->iceLocalParameters.usernameFragment = this->iceServer->GetUsernameFragment(); this->iceLocalParameters.usernameFragment = this->iceServer->GetUsernameFragment();
...@@ -184,14 +184,14 @@ namespace RTC ...@@ -184,14 +184,14 @@ namespace RTC
return data; return data;
} }
void IceTransport::onOutgoingSTUNMessage(RTC::ICEServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source) void IceTransport::onOutgoingSTUNMessage(RTC::IceServer* iceServer, RTC::STUNMessage* msg, RTC::TransportSource* source)
{ {
MS_TRACE(); MS_TRACE();
// TODO // TODO
} }
void IceTransport::onICEValidPair(RTC::ICEServer* iceServer, RTC::TransportSource* source, bool has_use_candidate) void IceTransport::onICEValidPair(RTC::IceServer* iceServer, RTC::TransportSource* source, bool has_use_candidate)
{ {
MS_TRACE(); MS_TRACE();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论