| 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 |
| 11 #include <string.h> // NOLINT | 11 #include <string.h> // NOLINT |
| 12 #include <sys/stat.h> // NOLINT | 12 #include <sys/stat.h> // NOLINT |
| 13 #include <unistd.h> // NOLINT | 13 #include <unistd.h> // NOLINT |
| 14 #include <netinet/tcp.h> // NOLINT | 14 #include <netinet/tcp.h> // NOLINT |
| 15 | 15 |
| 16 #include "bin/fdutils.h" | 16 #include "bin/fdutils.h" |
| 17 #include "bin/file.h" | 17 #include "bin/file.h" |
| 18 #include "bin/log.h" | 18 #include "bin/log.h" |
| 19 #include "bin/socket.h" | 19 #include "bin/socket.h" |
| 20 | 20 |
| 21 | 21 |
| 22 namespace dart { | 22 namespace dart { |
| 23 namespace bin { | 23 namespace bin { |
| 24 | 24 |
| 25 SocketAddress::SocketAddress(struct sockaddr* sockaddr) { | 25 SocketAddress::SocketAddress(struct sockaddr* sockaddr) { |
| 26 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN); | 26 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN); |
| 27 RawAddr* raw = reinterpret_cast<RawAddr*>(sockaddr); | 27 RawAddr* raw = reinterpret_cast<RawAddr*>(sockaddr); |
| 28 const char* result; |
| 28 if (sockaddr->sa_family == AF_INET) { | 29 if (sockaddr->sa_family == AF_INET) { |
| 29 result = inet_ntop(sockaddr->sa_family, | 30 result = inet_ntop(sockaddr->sa_family, |
| 30 &raw->in.sin_addr, | 31 &raw->in.sin_addr, |
| 31 as_string_, | 32 as_string_, |
| 32 INET_ADDRSTRLEN); | 33 INET_ADDRSTRLEN); |
| 33 } else { | 34 } else { |
| 34 ASSERT(sockaddr->sa_family == AF_INET6); | 35 ASSERT(sockaddr->sa_family == AF_INET6); |
| 35 result = inet_ntop(sockaddr->sa_family, | 36 result = inet_ntop(sockaddr->sa_family, |
| 36 &raw->in6.sin6_addr, | 37 &raw->in6.sin6_addr, |
| 37 as_string_, | 38 as_string_, |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 IPPROTO_TCP, | 384 IPPROTO_TCP, |
| 384 TCP_NODELAY, | 385 TCP_NODELAY, |
| 385 reinterpret_cast<char *>(&on), | 386 reinterpret_cast<char *>(&on), |
| 386 sizeof(on))) == 0; | 387 sizeof(on))) == 0; |
| 387 } | 388 } |
| 388 | 389 |
| 389 } // namespace bin | 390 } // namespace bin |
| 390 } // namespace dart | 391 } // namespace dart |
| 391 | 392 |
| 392 #endif // defined(TARGET_OS_ANDROID) | 393 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |