| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #ifndef BIN_SOCKET_H_ | 5 #ifndef BIN_SOCKET_H_ |
| 6 #define BIN_SOCKET_H_ | 6 #define BIN_SOCKET_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class SocketAddress { | 37 class SocketAddress { |
| 38 public: | 38 public: |
| 39 enum { | 39 enum { |
| 40 TYPE_ANY = -1, | 40 TYPE_ANY = -1, |
| 41 TYPE_IPV4, | 41 TYPE_IPV4, |
| 42 TYPE_IPV6, | 42 TYPE_IPV6, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 enum { |
| 46 ADDRESS_LOOPBACK_IP_V4, |
| 47 ADDRESS_LOOPBACK_IP_V6, |
| 48 ADDRESS_ANY_IP_V4, |
| 49 ADDRESS_ANY_IP_V6, |
| 50 ADDRESS_FIRST = ADDRESS_LOOPBACK_IP_V4, |
| 51 ADDRESS_LAST = ADDRESS_ANY_IP_V6, |
| 52 }; |
| 53 |
| 45 explicit SocketAddress(struct addrinfo* addrinfo); | 54 explicit SocketAddress(struct addrinfo* addrinfo); |
| 46 | 55 |
| 47 int GetType() { | 56 int GetType() { |
| 48 if (addr_.ss.ss_family == AF_INET6) return TYPE_IPV6; | 57 if (addr_.ss.ss_family == AF_INET6) return TYPE_IPV6; |
| 49 return TYPE_IPV4; | 58 return TYPE_IPV4; |
| 50 } | 59 } |
| 51 | 60 |
| 52 const char* as_string() const { return as_string_; } | 61 const char* as_string() const { return as_string_; } |
| 53 const RawAddr& addr() const { return addr_; } | 62 const RawAddr& addr() const { return addr_; } |
| 54 | 63 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 intptr_t backlog); | 179 intptr_t backlog); |
| 171 | 180 |
| 172 DISALLOW_ALLOCATION(); | 181 DISALLOW_ALLOCATION(); |
| 173 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); | 182 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); |
| 174 }; | 183 }; |
| 175 | 184 |
| 176 } // namespace bin | 185 } // namespace bin |
| 177 } // namespace dart | 186 } // namespace dart |
| 178 | 187 |
| 179 #endif // BIN_SOCKET_H_ | 188 #endif // BIN_SOCKET_H_ |
| OLD | NEW |