Index: chrome/common/extensions/api/experimental_socket.idl |
diff --git a/chrome/common/extensions/api/experimental_socket.idl b/chrome/common/extensions/api/experimental_socket.idl |
index e405b48f28990623e0db120b711509439d4e3f74..a06ec2aa79f4e8a8d6b1286fa44ac6cb4e6f8c6d 100644 |
--- a/chrome/common/extensions/api/experimental_socket.idl |
+++ b/chrome/common/extensions/api/experimental_socket.idl |
@@ -56,6 +56,34 @@ namespace experimental.socket { |
long port; |
}; |
+ dictionary SocketInfo { |
+ // The type of the passed socket. This will be <code>tcp</code> or |
+ // <code>udp</code>. |
+ SocketType socketType; |
+ |
+ // The current state of this socket as known by the API. |
+ // |
+ // This may not represent the actual underlying state of the socket; |
+ // however, it will be true after a successful call to |
+ // <code>connect()</code> and false after a <code>disconnect()</code> call. |
+ boolean connected; |
+ |
+ // If the underlying socket is connected, contains the IPv4/6 address of |
+ // the peer. |
+ DOMString? peerAddress; |
+ |
+ // If the underlying socket is connected, contains the port of the |
+ // connected peer. |
+ long? peerPort; |
+ |
+ // If the underlying socket is bound or connected, contains its local |
+ /// IPv4/6 address. |
+ DOMString? localAddress; |
+ |
+ // If the underlying socket is bound or connected, contains its local port. |
+ long? localPort; |
+ }; |
+ |
callback RecvFromCallback = void (RecvFromInfo recvFromInfo); |
callback SendToCallback = void (WriteInfo writeInfo); |
@@ -64,6 +92,8 @@ namespace experimental.socket { |
callback SetNoDelayCallback = void (boolean result); |
+ callback GetInfoCallback = void (SocketInfo result); |
+ |
interface Functions { |
// Creates a socket of the specified type that will connect to the specified |
// remote machine. |
@@ -162,6 +192,12 @@ namespace experimental.socket { |
static void setNoDelay(long socketId, |
boolean noDelay, |
SetNoDelayCallback callback); |
+ |
+ // Retrieve the state of the given socket. |
+ // |socketId| : The socketId. |
+ // |callback| : Called when the state is available. |
+ static void getInfo(long socketId, |
+ GetInfoCallback callback); |
}; |
}; |