#include "rtc_base/socket_address.h"
#include "absl/strings/string_view.h"
#include "rtc_base/numerics/safe_conversions.h"
#if defined(WEBRTC_POSIX)
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#if defined(OPENBSD)
#include <netinet/in_systm.h>
#endif
#if !defined(__native_client__)
#include <netinet/ip.h>
#endif
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#endif
#include "rtc_base/byte_order.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/strings/string_builder.h"
#if defined(WEBRTC_WIN)
#include "rtc_base/win32.h"
#endif
namespace rtc {
SocketAddress::SocketAddress() { … }
SocketAddress::SocketAddress(absl::string_view hostname, int port) { … }
SocketAddress::SocketAddress(uint32_t ip_as_host_order_integer, int port) { … }
SocketAddress::SocketAddress(const IPAddress& ip, int port) { … }
SocketAddress::SocketAddress(const SocketAddress& addr) { … }
void SocketAddress::Clear() { … }
bool SocketAddress::IsNil() const { … }
bool SocketAddress::IsComplete() const { … }
SocketAddress& SocketAddress::operator=(const SocketAddress& addr) { … }
void SocketAddress::SetIP(uint32_t ip_as_host_order_integer) { … }
void SocketAddress::SetIP(const IPAddress& ip) { … }
void SocketAddress::SetIP(absl::string_view hostname) { … }
void SocketAddress::SetResolvedIP(uint32_t ip_as_host_order_integer) { … }
void SocketAddress::SetResolvedIP(const IPAddress& ip) { … }
void SocketAddress::SetPort(int port) { … }
uint32_t SocketAddress::ip() const { … }
const IPAddress& SocketAddress::ipaddr() const { … }
uint16_t SocketAddress::port() const { … }
std::string SocketAddress::HostAsURIString() const { … }
std::string SocketAddress::HostAsSensitiveURIString() const { … }
std::string SocketAddress::PortAsString() const { … }
std::string SocketAddress::ToString() const { … }
std::string SocketAddress::ToSensitiveString() const { … }
std::string SocketAddress::ToSensitiveNameAndAddressString() const { … }
bool SocketAddress::FromString(absl::string_view str) { … }
bool SocketAddress::IsAnyIP() const { … }
bool SocketAddress::IsLoopbackIP() const { … }
bool SocketAddress::IsPrivateIP() const { … }
bool SocketAddress::IsUnresolvedIP() const { … }
bool SocketAddress::operator==(const SocketAddress& addr) const { … }
bool SocketAddress::operator<(const SocketAddress& addr) const { … }
bool SocketAddress::EqualIPs(const SocketAddress& addr) const { … }
bool SocketAddress::EqualPorts(const SocketAddress& addr) const { … }
size_t SocketAddress::Hash() const { … }
void SocketAddress::ToSockAddr(sockaddr_in* saddr) const { … }
bool SocketAddress::FromSockAddr(const sockaddr_in& saddr) { … }
static size_t ToSockAddrStorageHelper(sockaddr_storage* addr,
const IPAddress& ip,
uint16_t port,
int scope_id) { … }
size_t SocketAddress::ToDualStackSockAddrStorage(sockaddr_storage* addr) const { … }
size_t SocketAddress::ToSockAddrStorage(sockaddr_storage* addr) const { … }
bool SocketAddressFromSockAddrStorage(const sockaddr_storage& addr,
SocketAddress* out) { … }
SocketAddress EmptySocketAddressWithFamily(int family) { … }
}