remove deprecated StringToIP() methods from SocketAddress API
This patch removes StringToIP() methods as fixes the TODO there and there are no callers at the moment for these methods. BUG=None R=perkj@webrtc.org Review URL: https://codereview.webrtc.org/1535993002 Cr-Commit-Position: refs/heads/master@{#11088}
This commit is contained in:
@ -307,39 +307,6 @@ size_t SocketAddress::ToSockAddrStorage(sockaddr_storage* addr) const {
|
||||
return ToSockAddrStorageHelper(addr, ip_, port_, scope_id_);
|
||||
}
|
||||
|
||||
bool SocketAddress::StringToIP(const std::string& hostname, uint32_t* ip) {
|
||||
in_addr addr;
|
||||
if (rtc::inet_pton(AF_INET, hostname.c_str(), &addr) == 0)
|
||||
return false;
|
||||
*ip = NetworkToHost32(addr.s_addr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SocketAddress::StringToIP(const std::string& hostname, IPAddress* ip) {
|
||||
in_addr addr4;
|
||||
if (rtc::inet_pton(AF_INET, hostname.c_str(), &addr4) > 0) {
|
||||
if (ip) {
|
||||
*ip = IPAddress(addr4);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
in6_addr addr6;
|
||||
if (rtc::inet_pton(AF_INET6, hostname.c_str(), &addr6) > 0) {
|
||||
if (ip) {
|
||||
*ip = IPAddress(addr6);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t SocketAddress::StringToIP(const std::string& hostname) {
|
||||
uint32_t ip = 0;
|
||||
StringToIP(hostname, &ip);
|
||||
return ip;
|
||||
}
|
||||
|
||||
bool SocketAddressFromSockAddrStorage(const sockaddr_storage& addr,
|
||||
SocketAddress* out) {
|
||||
if (!out) {
|
||||
|
@ -176,16 +176,6 @@ class SocketAddress {
|
||||
size_t ToDualStackSockAddrStorage(sockaddr_storage* saddr) const;
|
||||
size_t ToSockAddrStorage(sockaddr_storage* saddr) const;
|
||||
|
||||
// Converts the IP address given in dotted form into compact form.
|
||||
// Only dotted names (A.B.C.D) are converted.
|
||||
// Output integer is returned in host byte order.
|
||||
// TODO: Deprecate, replace wth agnostic versions.
|
||||
static bool StringToIP(const std::string& str, uint32_t* ip);
|
||||
static uint32_t StringToIP(const std::string& str);
|
||||
|
||||
// Converts the IP address given in printable form into an IPAddress.
|
||||
static bool StringToIP(const std::string& str, IPAddress* ip);
|
||||
|
||||
private:
|
||||
std::string hostname_;
|
||||
IPAddress ip_;
|
||||
|
Reference in New Issue
Block a user