Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: runtime/bin/socket.h

Issue 16514010: Add NetworkAdaptor to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test file. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/socket.cc » ('j') | sdk/lib/io/socket.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | runtime/bin/socket.cc » ('j') | sdk/lib/io/socket.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698