OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
7 | 7 |
8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
9 #include <stdio.h> // NOLINT | 9 #include <stdio.h> // NOLINT |
10 #include <stdlib.h> // NOLINT | 10 #include <stdlib.h> // NOLINT |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 ASSERT(*os_error == NULL); | 237 ASSERT(*os_error == NULL); |
238 *os_error = new OSError(status, | 238 *os_error = new OSError(status, |
239 gai_strerror(status), | 239 gai_strerror(status), |
240 OSError::kGetAddressInfo); | 240 OSError::kGetAddressInfo); |
241 return false; | 241 return false; |
242 } | 242 } |
243 return true; | 243 return true; |
244 } | 244 } |
245 | 245 |
246 | 246 |
| 247 bool Socket::ParseAddress(int type, const char* address, RawAddr* addr) { |
| 248 int result; |
| 249 if (type == SocketAddress::TYPE_IPV4) { |
| 250 result = inet_pton(AF_INET, address, &addr->in.sin_addr); |
| 251 } else { |
| 252 ASSERT(type == SocketAddress::TYPE_IPV6); |
| 253 result = inet_pton(AF_INET6, address, &addr->in6.sin6_addr); |
| 254 } |
| 255 return result == 1; |
| 256 } |
| 257 |
| 258 |
247 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces( | 259 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces( |
248 int type, | 260 int type, |
249 OSError** os_error) { | 261 OSError** os_error) { |
250 // The ifaddrs.h header is not provided on Android. An Android | 262 // The ifaddrs.h header is not provided on Android. An Android |
251 // implementation would have to use IOCTL or netlink. | 263 // implementation would have to use IOCTL or netlink. |
252 return NULL; | 264 return NULL; |
253 } | 265 } |
254 | 266 |
255 | 267 |
256 intptr_t ServerSocket::CreateBindListen(RawAddr addr, | 268 intptr_t ServerSocket::CreateBindListen(RawAddr addr, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 IPPROTO_TCP, | 374 IPPROTO_TCP, |
363 TCP_NODELAY, | 375 TCP_NODELAY, |
364 reinterpret_cast<char *>(&on), | 376 reinterpret_cast<char *>(&on), |
365 sizeof(on))) == 0; | 377 sizeof(on))) == 0; |
366 } | 378 } |
367 | 379 |
368 } // namespace bin | 380 } // namespace bin |
369 } // namespace dart | 381 } // namespace dart |
370 | 382 |
371 #endif // defined(TARGET_OS_ANDROID) | 383 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |