![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/lib/node_modules/mediasoup/worker/src/RTC/ |
Upload File : |
#define MS_CLASS "RTC::TransportTuple" // #define MS_LOG_DEV_LEVEL 3 #include "RTC/TransportTuple.hpp" #include "Logger.hpp" #include "Utils.hpp" #include <string> namespace RTC { /* Instance methods. */ void TransportTuple::FillJson(json& jsonObject) const { MS_TRACE(); int family; std::string ip; uint16_t port; Utils::IP::GetAddressInfo(GetLocalAddress(), family, ip, port); // Add localIp. if (this->localAnnouncedIp.empty()) jsonObject["localIp"] = ip; else jsonObject["localIp"] = this->localAnnouncedIp; // Add localPort. jsonObject["localPort"] = port; Utils::IP::GetAddressInfo(GetRemoteAddress(), family, ip, port); // Add remoteIp. jsonObject["remoteIp"] = ip; // Add remotePort. jsonObject["remotePort"] = port; // Add protocol. switch (GetProtocol()) { case Protocol::UDP: jsonObject["protocol"] = "udp"; break; case Protocol::TCP: jsonObject["protocol"] = "tcp"; break; } } void TransportTuple::Dump() const { MS_TRACE(); MS_DUMP("<TransportTuple>"); int family; std::string ip; uint16_t port; Utils::IP::GetAddressInfo(GetLocalAddress(), family, ip, port); MS_DUMP(" localIp : %s", ip.c_str()); MS_DUMP(" localPort : %" PRIu16, port); Utils::IP::GetAddressInfo(GetRemoteAddress(), family, ip, port); MS_DUMP(" remoteIp : %s", ip.c_str()); MS_DUMP(" remotePort : %" PRIu16, port); switch (GetProtocol()) { case Protocol::UDP: MS_DUMP(" protocol : udp"); break; case Protocol::TCP: MS_DUMP(" protocol : tcp"); break; } MS_DUMP("</TransportTuple>"); } } // namespace RTC