Chromium Code Reviews| Index: runtime/bin/socket.h |
| diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h |
| index 46780fc54a1338e29090208a783608741d8d6ab3..23574906e527b4e47ab3f672d7dc7e9e1f6e763e 100644 |
| --- a/runtime/bin/socket.h |
| +++ b/runtime/bin/socket.h |
| @@ -51,7 +51,9 @@ class SocketAddress { |
| ADDRESS_LAST = ADDRESS_ANY_IP_V6, |
| }; |
| - explicit SocketAddress(struct addrinfo* addrinfo); |
| + explicit SocketAddress(struct sockaddr* sockaddr); |
| + |
| + virtual ~SocketAddress() {} |
| int GetType() { |
| if (addr_.ss.ss_family == AF_INET6) return TYPE_IPV6; |
| @@ -96,6 +98,23 @@ class SocketAddress { |
| DISALLOW_COPY_AND_ASSIGN(SocketAddress); |
| }; |
| +class AdaptorSocketAddress : public SocketAddress { |
|
Søren Gjesse
2013/06/10 12:26:38
Instead of inheriting here why not have the Socket
|
| + public: |
| + explicit AdaptorSocketAddress(struct sockaddr* sockaddr, const char* name) |
| + : SocketAddress(sockaddr), name_(name) {} |
|
Søren Gjesse
2013/06/10 12:26:38
4 space indent.
|
| + |
| + virtual ~AdaptorSocketAddress() { |
| + delete name_; |
| + } |
| + |
| + const char* name() const { return name_; } |
| + |
| + private: |
| + const char* name_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SocketAddress); |
| +}; |
| + |
| class SocketAddresses { |
| public: |
| explicit SocketAddresses(intptr_t count) |
| @@ -124,6 +143,7 @@ class Socket { |
| public: |
| enum SocketRequest { |
| kLookupRequest = 0, |
| + kListAdaptorsRequest = 1, |
| }; |
| static bool Initialize(); |
| @@ -149,6 +169,11 @@ class Socket { |
| int type, |
| OSError** os_error); |
| + // List adaptors. Returns the SocketAddresses. |
| + static SocketAddresses* ListAdaptors(bool include_loopback, |
| + int type, |
| + OSError** os_error); |
| + |
| static Dart_Port GetServicePort(); |
| static Dart_Handle SetSocketIdNativeField(Dart_Handle socket, intptr_t id); |
| @@ -181,6 +206,7 @@ class ServerSocket { |
| intptr_t backlog, |
| bool v6_only = false); |
| + private: |
| DISALLOW_ALLOCATION(); |
| DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); |
| }; |