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

Add announced IPv4/IPv6 settings (fixes #53)

上级 1731ac94
...@@ -16,6 +16,8 @@ const VALID_WORKER_PARAMETERS = ...@@ -16,6 +16,8 @@ const VALID_WORKER_PARAMETERS =
'logTags', 'logTags',
'rtcListenIPv4', 'rtcListenIPv4',
'rtcListenIPv6', 'rtcListenIPv6',
'rtcAnnouncedListenIPv4',
'rtcAnnouncedListenIPv6',
'rtcMinPort', 'rtcMinPort',
'rtcMaxPort', 'rtcMaxPort',
'dtlsCertificateFile', 'dtlsCertificateFile',
...@@ -62,6 +64,12 @@ class Server extends EventEmitter ...@@ -62,6 +64,12 @@ class Server extends EventEmitter
if (options.rtcListenIPv6 === null || options.rtcListenIPv6 === undefined) if (options.rtcListenIPv6 === null || options.rtcListenIPv6 === undefined)
delete options.rtcListenIPv6; delete options.rtcListenIPv6;
if (!options.rtcAnnouncedListenIPv4 || options.rtcListenIPv4 === false)
delete options.rtcAnnouncedListenIPv4;
if (!options.rtcAnnouncedListenIPv6 || options.rtcListenIPv6 === false)
delete options.rtcAnnouncedListenIPv6;
if (!check.greaterOrEqual(options.rtcMinPort, 1024)) if (!check.greaterOrEqual(options.rtcMinPort, 1024))
options.rtcMinPort = 10000; options.rtcMinPort = 10000;
......
...@@ -26,6 +26,10 @@ module.exports = ...@@ -26,6 +26,10 @@ module.exports =
* values are a IPv4, `true` (auto-detect) and `false` (disabled). * values are a IPv4, `true` (auto-detect) and `false` (disabled).
* @param {string|boolean} [options.rtcListenIPv6=true] - IPv6 for RTC. Valid * @param {string|boolean} [options.rtcListenIPv6=true] - IPv6 for RTC. Valid
* values are a IPv6, `true` (auto-detect) and `false` (disabled). * values are a IPv6, `true` (auto-detect) and `false` (disabled).
* @param {string} [options.rtcAnnouncedListenIPv4] - Announced IPv4 for RTC. Valid
* value is a IPv4.
* @param {string} [options.rtcAnnouncedListenIPv6] - Announced IPv6 for RTC. Valid
* value is a IPv6.
* @param {number} [options.rtcMinPort=10000] - Minimun RTC port. * @param {number} [options.rtcMinPort=10000] - Minimun RTC port.
* @param {number} [options.rtcMaxPort=59999] - Maximum RTC port. * @param {number} [options.rtcMaxPort=59999] - Maximum RTC port.
* @param {string} [options.dtlsCertificateFile] - Path to DTLS certificate. * @param {string} [options.dtlsCertificateFile] - Path to DTLS certificate.
......
...@@ -40,6 +40,7 @@ namespace RTC ...@@ -40,6 +40,7 @@ namespace RTC
// Others. // Others.
std::string foundation; std::string foundation;
uint32_t priority; uint32_t priority;
int family = 0;
std::string ip; std::string ip;
Protocol protocol; Protocol protocol;
uint16_t port; uint16_t port;
......
...@@ -26,17 +26,21 @@ public: ...@@ -26,17 +26,21 @@ public:
// Struct holding the configuration. // Struct holding the configuration.
struct Configuration struct Configuration
{ {
LogLevel logLevel { LogLevel::LOG_DEBUG }; LogLevel logLevel { LogLevel::LOG_DEBUG };
struct LogTags logTags; struct LogTags logTags;
std::string rtcListenIPv4; std::string rtcListenIPv4;
std::string rtcListenIPv6; std::string rtcListenIPv6;
uint16_t rtcMinPort { 10000 }; std::string rtcAnnouncedListenIPv4;
uint16_t rtcMaxPort { 59999 }; std::string rtcAnnouncedListenIPv6;
uint16_t rtcMinPort { 10000 };
uint16_t rtcMaxPort { 59999 };
std::string dtlsCertificateFile; std::string dtlsCertificateFile;
std::string dtlsPrivateKeyFile; std::string dtlsPrivateKeyFile;
// Private fields. // Private fields.
bool hasIPv4 { false }; bool hasIPv4 { false };
bool hasIPv6 { false }; bool hasIPv6 { false };
bool hasAnnouncedIPv4 { false };
bool hasAnnouncedIPv6 { false };
}; };
public: public:
...@@ -49,6 +53,8 @@ private: ...@@ -49,6 +53,8 @@ private:
static void SetLogLevel(std::string &level); static void SetLogLevel(std::string &level);
static void SetRtcListenIPv4(const std::string &ip); static void SetRtcListenIPv4(const std::string &ip);
static void SetRtcListenIPv6(const std::string &ip); static void SetRtcListenIPv6(const std::string &ip);
static void SetRtcAnnouncedListenIPv4(const std::string &ip);
static void SetRtcAnnouncedListenIPv6(const std::string &ip);
static void SetRtcPorts(); static void SetRtcPorts();
static void SetDtlsCertificateAndPrivateKeyFiles(); static void SetDtlsCertificateAndPrivateKeyFiles();
static void SetLogTags(std::vector<std::string>& tags); static void SetLogTags(std::vector<std::string>& tags);
......
...@@ -42,6 +42,7 @@ public: ...@@ -42,6 +42,7 @@ public:
void Write(const uint8_t* data1, size_t len1, const uint8_t* data2, size_t len2); void Write(const uint8_t* data1, size_t len1, const uint8_t* data2, size_t len2);
void Write(const std::string &data); void Write(const std::string &data);
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress();
int GetLocalFamily();
const std::string& GetLocalIP(); const std::string& GetLocalIP();
uint16_t GetLocalPort(); uint16_t GetLocalPort();
const struct sockaddr* GetPeerAddress(); const struct sockaddr* GetPeerAddress();
...@@ -114,6 +115,12 @@ const struct sockaddr* TcpConnection::GetLocalAddress() ...@@ -114,6 +115,12 @@ const struct sockaddr* TcpConnection::GetLocalAddress()
return (const struct sockaddr*)this->localAddr; return (const struct sockaddr*)this->localAddr;
} }
inline
int TcpConnection::GetLocalFamily()
{
return ((const struct sockaddr*)&this->localAddr)->sa_family;
}
inline inline
const std::string& TcpConnection::GetLocalIP() const std::string& TcpConnection::GetLocalIP()
{ {
......
...@@ -21,6 +21,7 @@ public: ...@@ -21,6 +21,7 @@ public:
virtual void Dump(); virtual void Dump();
bool IsClosing(); bool IsClosing();
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress();
int GetLocalFamily();
const std::string& GetLocalIP(); const std::string& GetLocalIP();
uint16_t GetLocalPort(); uint16_t GetLocalPort();
size_t GetNumConnections(); size_t GetNumConnections();
...@@ -71,4 +72,29 @@ size_t TcpServer::GetNumConnections() ...@@ -71,4 +72,29 @@ size_t TcpServer::GetNumConnections()
return this->connections.size(); return this->connections.size();
} }
inline
const struct sockaddr* TcpServer::GetLocalAddress()
{
return (const struct sockaddr*)&this->localAddr;
}
inline
int TcpServer::GetLocalFamily()
{
return ((const struct sockaddr*)&this->localAddr)->sa_family;
}
inline
const std::string& TcpServer::GetLocalIP()
{
return this->localIP;
}
inline
uint16_t TcpServer::GetLocalPort()
{
return this->localPort;
}
#endif #endif
...@@ -36,6 +36,7 @@ public: ...@@ -36,6 +36,7 @@ public:
void Send(const uint8_t* data, size_t len, const std::string &ip, uint16_t port); void Send(const uint8_t* data, size_t len, const std::string &ip, uint16_t port);
void Send(const std::string &data, const std::string &ip, uint16_t port); void Send(const std::string &data, const std::string &ip, uint16_t port);
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress();
int GetLocalFamily();
const std::string& GetLocalIP(); const std::string& GetLocalIP();
uint16_t GetLocalPort(); uint16_t GetLocalPort();
...@@ -86,6 +87,12 @@ const struct sockaddr* UdpSocket::GetLocalAddress() ...@@ -86,6 +87,12 @@ const struct sockaddr* UdpSocket::GetLocalAddress()
return (const struct sockaddr*)&this->localAddr; return (const struct sockaddr*)&this->localAddr;
} }
inline
int UdpSocket::GetLocalFamily()
{
return ((const struct sockaddr*)&this->localAddr)->sa_family;
}
inline inline
const std::string& UdpSocket::GetLocalIP() const std::string& UdpSocket::GetLocalIP()
{ {
......
...@@ -45,7 +45,7 @@ void DepLibSRTP::ClassInit() ...@@ -45,7 +45,7 @@ void DepLibSRTP::ClassInit()
srtp_err_status_t err; srtp_err_status_t err;
MS_DEBUG_TAG(info, "loaded libsrtp version: %s", srtp_get_version_string()); MS_DEBUG_TAG(info, "loaded libsrtp version: \"%s\"", srtp_get_version_string());
err = srtp_init(); err = srtp_init();
if (DepLibSRTP::IsError(err)) if (DepLibSRTP::IsError(err))
......
...@@ -39,7 +39,7 @@ void DepLibUV::PrintVersion() ...@@ -39,7 +39,7 @@ void DepLibUV::PrintVersion()
{ {
MS_TRACE(); MS_TRACE();
MS_DEBUG_TAG(info, "loaded libuv version: %s", uv_version_string()); MS_DEBUG_TAG(info, "loaded libuv version: \"%s\"", uv_version_string());
} }
void DepLibUV::RunLoop() void DepLibUV::RunLoop()
......
...@@ -19,7 +19,7 @@ void DepOpenSSL::ClassInit() ...@@ -19,7 +19,7 @@ void DepOpenSSL::ClassInit()
{ {
MS_TRACE(); MS_TRACE();
MS_DEBUG_TAG(info, "loaded openssl version: %s", SSLeay_version(SSLEAY_VERSION)); MS_DEBUG_TAG(info, "loaded openssl version: \"%s\"", SSLeay_version(SSLEAY_VERSION));
// Initialize OpenSSL stuff. // Initialize OpenSSL stuff.
SSL_load_error_strings(); SSL_load_error_strings();
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// #define MS_LOG_DEV // #define MS_LOG_DEV
#include "RTC/IceCandidate.hpp" #include "RTC/IceCandidate.hpp"
#include "Settings.hpp"
namespace RTC namespace RTC
{ {
...@@ -10,26 +11,75 @@ namespace RTC ...@@ -10,26 +11,75 @@ namespace RTC
IceCandidate::IceCandidate(RTC::UdpSocket* udpSocket, uint32_t priority) : IceCandidate::IceCandidate(RTC::UdpSocket* udpSocket, uint32_t priority) :
foundation("udpcandidate"), foundation("udpcandidate"),
priority(priority), priority(priority),
ip(udpSocket->GetLocalIP()), family(udpSocket->GetLocalFamily()),
protocol(Protocol::UDP), protocol(Protocol::UDP),
port(udpSocket->GetLocalPort()), port(udpSocket->GetLocalPort()),
type(CandidateType::HOST) type(CandidateType::HOST)
{} {
switch (this->family)
{
case AF_INET:
{
if (Settings::configuration.hasAnnouncedIPv4)
this->ip = Settings::configuration.rtcAnnouncedListenIPv4;
else
this->ip = udpSocket->GetLocalIP();
break;
}
case AF_INET6:
{
if (Settings::configuration.hasAnnouncedIPv6)
this->ip = Settings::configuration.rtcAnnouncedListenIPv6;
else
this->ip = udpSocket->GetLocalIP();
break;
}
}
}
IceCandidate::IceCandidate(RTC::TcpServer* tcpServer, uint32_t priority) : IceCandidate::IceCandidate(RTC::TcpServer* tcpServer, uint32_t priority) :
foundation("tcpcandidate"), foundation("tcpcandidate"),
priority(priority), priority(priority),
ip(tcpServer->GetLocalIP()), family(tcpServer->GetLocalFamily()),
protocol(Protocol::TCP), protocol(Protocol::TCP),
port(tcpServer->GetLocalPort()), port(tcpServer->GetLocalPort()),
type(CandidateType::HOST), type(CandidateType::HOST),
tcpType(TcpCandidateType::PASSIVE) tcpType(TcpCandidateType::PASSIVE)
{} {
switch (this->family)
{
case AF_INET:
{
if (Settings::configuration.hasAnnouncedIPv4)
this->ip = Settings::configuration.rtcAnnouncedListenIPv4;
else
this->ip = tcpServer->GetLocalIP();
break;
}
case AF_INET6:
{
if (Settings::configuration.hasAnnouncedIPv6)
this->ip = Settings::configuration.rtcAnnouncedListenIPv6;
else
this->ip = tcpServer->GetLocalIP();
break;
}
}
}
Json::Value IceCandidate::toJson() Json::Value IceCandidate::toJson()
{ {
static const Json::StaticString k_foundation("foundation"); static const Json::StaticString k_foundation("foundation");
static const Json::StaticString k_priority("priority"); static const Json::StaticString k_priority("priority");
static const Json::StaticString k_family("family");
static const Json::StaticString v_ipv4("ipv4");
static const Json::StaticString v_ipv6("ipv6");
static const Json::StaticString k_ip("ip"); static const Json::StaticString k_ip("ip");
static const Json::StaticString k_port("port"); static const Json::StaticString k_port("port");
static const Json::StaticString k_type("type"); static const Json::StaticString k_type("type");
...@@ -43,6 +93,18 @@ namespace RTC ...@@ -43,6 +93,18 @@ namespace RTC
Json::Value json(Json::objectValue); Json::Value json(Json::objectValue);
json[k_foundation] = this->foundation; json[k_foundation] = this->foundation;
switch (this->family)
{
case AF_INET:
json[k_family] = v_ipv4;
break;
case AF_INET6:
json[k_family] = v_ipv6;
break;
}
json[k_priority] = (Json::UInt)this->priority; json[k_priority] = (Json::UInt)this->priority;
json[k_ip] = this->ip; json[k_ip] = this->ip;
json[k_port] = (Json::UInt)this->port; json[k_port] = (Json::UInt)this->port;
......
...@@ -57,14 +57,16 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -57,14 +57,16 @@ void Settings::SetConfiguration(int argc, char* argv[])
struct option options[] = struct option options[] =
{ {
{ "logLevel", optional_argument, nullptr, 'l' }, { "logLevel", optional_argument, nullptr, 'l' },
{ "logTag", optional_argument, nullptr, 't' }, { "logTag", optional_argument, nullptr, 't' },
{ "rtcListenIPv4", optional_argument, nullptr, '4' }, { "rtcListenIPv4", optional_argument, nullptr, '4' },
{ "rtcListenIPv6", optional_argument, nullptr, '6' }, { "rtcListenIPv6", optional_argument, nullptr, '6' },
{ "rtcMinPort", optional_argument, nullptr, 'm' }, { "rtcAnnouncedListenIPv4", optional_argument, nullptr, '5' },
{ "rtcMaxPort", optional_argument, nullptr, 'M' }, { "rtcAnnouncedListenIPv6", optional_argument, nullptr, '7' },
{ "dtlsCertificateFile", optional_argument, nullptr, 'c' }, { "rtcMinPort", optional_argument, nullptr, 'm' },
{ "dtlsPrivateKeyFile", optional_argument, nullptr, 'p' }, { "rtcMaxPort", optional_argument, nullptr, 'M' },
{ "dtlsCertificateFile", optional_argument, nullptr, 'c' },
{ "dtlsPrivateKeyFile", optional_argument, nullptr, 'p' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
...@@ -74,7 +76,7 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -74,7 +76,7 @@ void Settings::SetConfiguration(int argc, char* argv[])
while ((c = getopt_long_only(argc, argv, "", options, &option_index)) != -1) while ((c = getopt_long_only(argc, argv, "", options, &option_index)) != -1)
{ {
if (!optarg) if (!optarg)
MS_THROW_ERROR("parameters without value not allowed"); MS_THROW_ERROR("unknown configuration parameter: %s", optarg);
switch (c) switch (c)
{ {
...@@ -98,6 +100,16 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -98,6 +100,16 @@ void Settings::SetConfiguration(int argc, char* argv[])
SetRtcListenIPv6(value_string); SetRtcListenIPv6(value_string);
break; break;
case '5':
value_string = std::string(optarg);
SetRtcAnnouncedListenIPv4(value_string);
break;
case '7':
value_string = std::string(optarg);
SetRtcAnnouncedListenIPv6(value_string);
break;
case 'm': case 'm':
Settings::configuration.rtcMinPort = std::stoi(optarg); Settings::configuration.rtcMinPort = std::stoi(optarg);
break; break;
...@@ -143,6 +155,18 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -143,6 +155,18 @@ void Settings::SetConfiguration(int argc, char* argv[])
if (!Settings::configuration.hasIPv4 && !Settings::configuration.hasIPv6) if (!Settings::configuration.hasIPv4 && !Settings::configuration.hasIPv6)
MS_THROW_ERROR("at least rtcListenIPv4 or rtcListenIPv6 must be enabled"); MS_THROW_ERROR("at least rtcListenIPv4 or rtcListenIPv6 must be enabled");
// Clean RTP announced IPs if not available.
if (!Settings::configuration.hasIPv4)
{
Settings::configuration.rtcAnnouncedListenIPv4 = "";
Settings::configuration.hasAnnouncedIPv4 = false;
}
if (!Settings::configuration.hasIPv6)
{
Settings::configuration.rtcAnnouncedListenIPv6 = "";
Settings::configuration.hasAnnouncedIPv6 = false;
}
// Validate RTC ports. // Validate RTC ports.
Settings::SetRtcPorts(); Settings::SetRtcPorts();
...@@ -171,25 +195,33 @@ void Settings::PrintConfiguration() ...@@ -171,25 +195,33 @@ void Settings::PrintConfiguration()
MS_DEBUG_TAG(info, "<configuration>"); MS_DEBUG_TAG(info, "<configuration>");
MS_DEBUG_TAG(info, "logLevel: \"%s\"", Settings::logLevel2String[Settings::configuration.logLevel].c_str()); MS_DEBUG_TAG(info, " logLevel : \"%s\"", Settings::logLevel2String[Settings::configuration.logLevel].c_str());
for (auto& tag : log_tags) for (auto& tag : log_tags)
{ {
MS_DEBUG_TAG(info, "logTag: \"%s\"", tag.c_str()); MS_DEBUG_TAG(info, " logTag : \"%s\"", tag.c_str());
} }
if (Settings::configuration.hasIPv4) if (Settings::configuration.hasIPv4)
MS_DEBUG_TAG(info, "rtcListenIPv4: \"%s\"", Settings::configuration.rtcListenIPv4.c_str()); MS_DEBUG_TAG(info, " rtcListenIPv4 : \"%s\"", Settings::configuration.rtcListenIPv4.c_str());
else else
MS_DEBUG_TAG(info, "rtcListenIPv4: (unavailable)"); MS_DEBUG_TAG(info, " rtcListenIPv4 : (unavailable)");
if (Settings::configuration.hasIPv6) if (Settings::configuration.hasIPv6)
MS_DEBUG_TAG(info, "rtcListenIPv6: \"%s\"", Settings::configuration.rtcListenIPv6.c_str()); MS_DEBUG_TAG(info, " rtcListenIPv6 : \"%s\"", Settings::configuration.rtcListenIPv6.c_str());
else
MS_DEBUG_TAG(info, " rtcListenIPv6 : (unavailable)");
if (Settings::configuration.hasAnnouncedIPv4)
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv4 : \"%s\"", Settings::configuration.rtcAnnouncedListenIPv4.c_str());
else
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv4 : (unset)");
if (Settings::configuration.hasAnnouncedIPv6)
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv6 : \"%s\"", Settings::configuration.rtcAnnouncedListenIPv6.c_str());
else else
MS_DEBUG_TAG(info, "rtcListenIPv6: (unavailable)"); MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv6 : (unset)");
MS_DEBUG_TAG(info, "rtcMinPort: %" PRIu16, Settings::configuration.rtcMinPort); MS_DEBUG_TAG(info, " rtcMinPort : %" PRIu16, Settings::configuration.rtcMinPort);
MS_DEBUG_TAG(info, "rtcMaxPort: %" PRIu16, Settings::configuration.rtcMaxPort); MS_DEBUG_TAG(info, " rtcMaxPort : %" PRIu16, Settings::configuration.rtcMaxPort);
if (!Settings::configuration.dtlsCertificateFile.empty()) if (!Settings::configuration.dtlsCertificateFile.empty())
{ {
MS_DEBUG_TAG(info, "dtlsCertificateFile: \"%s\"", Settings::configuration.dtlsCertificateFile.c_str()); MS_DEBUG_TAG(info, " dtlsCertificateFile : \"%s\"", Settings::configuration.dtlsCertificateFile.c_str());
MS_DEBUG_TAG(info, "dtlsPrivateKeyFile: \"%s\"", Settings::configuration.dtlsPrivateKeyFile.c_str()); MS_DEBUG_TAG(info, " dtlsPrivateKeyFile : \"%s\"", Settings::configuration.dtlsPrivateKeyFile.c_str());
} }
MS_DEBUG_TAG(info, "</configuration>"); MS_DEBUG_TAG(info, "</configuration>");
...@@ -401,6 +433,44 @@ void Settings::SetRtcListenIPv6(const std::string &ip) ...@@ -401,6 +433,44 @@ void Settings::SetRtcListenIPv6(const std::string &ip)
MS_THROW_ERROR("cannot bind on '%s' for rtcListenIPv6: %s", ip.c_str(), std::strerror(bind_errno)); MS_THROW_ERROR("cannot bind on '%s' for rtcListenIPv6: %s", ip.c_str(), std::strerror(bind_errno));
} }
void Settings::SetRtcAnnouncedListenIPv4(const std::string &ip)
{
MS_TRACE();
switch (Utils::IP::GetFamily(ip))
{
case AF_INET:
if (ip == "0.0.0.0")
MS_THROW_ERROR("rtcAnnouncedListenIPv4 cannot be '0.0.0.0'");
Settings::configuration.rtcAnnouncedListenIPv4 = ip;
Settings::configuration.hasAnnouncedIPv4 = true;
break;
case AF_INET6:
MS_THROW_ERROR("invalid IPv6 '%s' for rtcAnnouncedListenIPv4", ip.c_str());
default:
MS_THROW_ERROR("invalid value '%s' for rtcAnnouncedListenIPv4", ip.c_str());
}
}
void Settings::SetRtcAnnouncedListenIPv6(const std::string &ip)
{
MS_TRACE();
switch (Utils::IP::GetFamily(ip))
{
case AF_INET6:
if (ip == "::")
MS_THROW_ERROR("rtcAnnouncedListenIPv6 cannot be '::'");
Settings::configuration.rtcAnnouncedListenIPv6 = ip;
Settings::configuration.hasAnnouncedIPv6 = true;
break;
case AF_INET:
MS_THROW_ERROR("invalid IPv4 '%s' for rtcAnnouncedListenIPv6", ip.c_str());
default:
MS_THROW_ERROR("invalid value '%s' for rtcAnnouncedListenIPv6", ip.c_str());
}
}
void Settings::SetRtcPorts() void Settings::SetRtcPorts()
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -43,7 +43,7 @@ namespace Utils ...@@ -43,7 +43,7 @@ namespace Utils
*/ */
%%write data; %%write data;
// Used by Ragel: // Used by Ragel.
size_t cs; size_t cs;
const unsigned char* p; const unsigned char* p;
const unsigned char* pe; const unsigned char* pe;
......
...@@ -162,27 +162,6 @@ void TcpServer::Dump() ...@@ -162,27 +162,6 @@ void TcpServer::Dump()
MS_DUMP("</TcpServer>"); MS_DUMP("</TcpServer>");
} }
const struct sockaddr* TcpServer::GetLocalAddress()
{
MS_TRACE();
return (const struct sockaddr*)&this->localAddr;
}
const std::string& TcpServer::GetLocalIP()
{
MS_TRACE();
return this->localIP;
}
uint16_t TcpServer::GetLocalPort()
{
MS_TRACE();
return this->localPort;
}
bool TcpServer::SetLocalAddress() bool TcpServer::SetLocalAddress()
{ {
MS_TRACE(); MS_TRACE();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论