| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // Read and write the address to/from a sockaddr_storage. | 170 // Read and write the address to/from a sockaddr_storage. |
| 171 // Dual stack version always sets family to AF_INET6, and maps v4 addresses. | 171 // Dual stack version always sets family to AF_INET6, and maps v4 addresses. |
| 172 // The other version doesn't map, and outputs an AF_INET address for | 172 // The other version doesn't map, and outputs an AF_INET address for |
| 173 // v4 or mapped addresses, and AF_INET6 addresses for others. | 173 // v4 or mapped addresses, and AF_INET6 addresses for others. |
| 174 // Returns the size of the sockaddr_in or sockaddr_in6 structure that is | 174 // Returns the size of the sockaddr_in or sockaddr_in6 structure that is |
| 175 // written to the sockaddr_storage, or zero on failure. | 175 // written to the sockaddr_storage, or zero on failure. |
| 176 size_t ToDualStackSockAddrStorage(sockaddr_storage* saddr) const; | 176 size_t ToDualStackSockAddrStorage(sockaddr_storage* saddr) const; |
| 177 size_t ToSockAddrStorage(sockaddr_storage* saddr) const; | 177 size_t ToSockAddrStorage(sockaddr_storage* saddr) const; |
| 178 | 178 |
| 179 // Converts the IP address given in dotted form into compact form. | |
| 180 // Only dotted names (A.B.C.D) are converted. | |
| 181 // Output integer is returned in host byte order. | |
| 182 // TODO: Deprecate, replace wth agnostic versions. | |
| 183 static bool StringToIP(const std::string& str, uint32_t* ip); | |
| 184 static uint32_t StringToIP(const std::string& str); | |
| 185 | |
| 186 // Converts the IP address given in printable form into an IPAddress. | |
| 187 static bool StringToIP(const std::string& str, IPAddress* ip); | |
| 188 | |
| 189 private: | 179 private: |
| 190 std::string hostname_; | 180 std::string hostname_; |
| 191 IPAddress ip_; | 181 IPAddress ip_; |
| 192 uint16_t port_; | 182 uint16_t port_; |
| 193 int scope_id_; | 183 int scope_id_; |
| 194 bool literal_; // Indicates that 'hostname_' contains a literal IP string. | 184 bool literal_; // Indicates that 'hostname_' contains a literal IP string. |
| 195 }; | 185 }; |
| 196 | 186 |
| 197 bool SocketAddressFromSockAddrStorage(const sockaddr_storage& saddr, | 187 bool SocketAddressFromSockAddrStorage(const sockaddr_storage& saddr, |
| 198 SocketAddress* out); | 188 SocketAddress* out); |
| 199 SocketAddress EmptySocketAddressWithFamily(int family); | 189 SocketAddress EmptySocketAddressWithFamily(int family); |
| 200 | 190 |
| 201 } // namespace rtc | 191 } // namespace rtc |
| 202 | 192 |
| 203 #endif // WEBRTC_BASE_SOCKETADDRESS_H_ | 193 #endif // WEBRTC_BASE_SOCKETADDRESS_H_ |
| OLD | NEW |